Merge "Add slide up transition when call shortcut is dismissed" into klp-dev
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml
index 1a8b2f3..fce25ea 100644
--- a/res/layout/phone_favorite_tile_view.xml
+++ b/res/layout/phone_favorite_tile_view.xml
@@ -87,15 +87,20 @@
<ImageView
android:id="@+id/contact_favorite_star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignRight="@id/contact_tile_image"
- android:layout_alignEnd="@id/contact_tile_image"
- android:layout_alignBottom="@id/contact_tile_image"
- android:layout_marginRight="7dip"
- android:layout_marginEnd="7dip"
- android:layout_marginBottom="7dip"
+ android:background="?android:attr/selectableItemBackground"
+ android:layout_height="@dimen/contact_tile_info_button_height_and_width"
+ android:layout_width="@dimen/contact_tile_info_button_height_and_width"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
android:src="@drawable/ic_star_marked_as_fav"
+ android:scaleType="center"
android:visibility="gone" />
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 86540ef..4bc1787 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -190,7 +190,6 @@
private boolean mIsCallLog = true;
private int mNumMissedCalls = 0;
private int mNumMissedCallsShown = 0;
- private Uri mCurrentPhotoUri;
private View mBadgeContainer;
private ImageView mBadgeImageView;
@@ -846,19 +845,11 @@
}
private void setPhoto(CallLogListItemViews views, long photoId, Uri contactUri) {
- mCurrentPhotoUri = null;
views.quickContactView.assignContactUri(contactUri);
mContactPhotoManager.loadThumbnail(views.quickContactView, photoId, false /* darkTheme */);
}
private void setPhoto(CallLogListItemViews views, Uri photoUri, Uri contactUri) {
- if (photoUri.equals(mCurrentPhotoUri)) {
- // photo manager will perform a fade in transition. To avoid flicker, do not set the
- // same photo multiple times.
- return;
- }
-
- mCurrentPhotoUri = photoUri;
views.quickContactView.assignContactUri(contactUri);
mContactPhotoManager.loadDirectoryPhoto(views.quickContactView, photoUri,
false /* darkTheme */);
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 64484cb..bcba9ff 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -30,6 +30,7 @@
import com.android.contacts.common.util.Constants;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.service.CachedNumberLookupService;
+import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo;
import com.android.dialerbind.ObjectFactory;
import org.json.JSONException;
@@ -228,7 +229,9 @@
if (info != null && info != ContactInfo.EMPTY) {
info.formattedNumber = formatPhoneNumber(number, null, countryIso);
} else if (mCachedNumberLookupService != null) {
- info = mCachedNumberLookupService.lookupCachedContactFromNumber(mContext, number);
+ CachedContactInfo cacheInfo = mCachedNumberLookupService
+ .lookupCachedContactFromNumber(mContext, number);
+ info = cacheInfo != null ? cacheInfo.getContactInfo() : null;
}
return info;
}
diff --git a/src/com/android/dialer/list/RegularSearchFragment.java b/src/com/android/dialer/list/RegularSearchFragment.java
index 2a80b3e..21c8c31 100644
--- a/src/com/android/dialer/list/RegularSearchFragment.java
+++ b/src/com/android/dialer/list/RegularSearchFragment.java
@@ -49,7 +49,7 @@
final RegularSearchListAdapter adapter =
(RegularSearchListAdapter) getAdapter();
mCachedNumberLookupService.addContact(getContext(),
- adapter.getContactInfo(position));
+ adapter.getContactInfo(mCachedNumberLookupService, position));
}
}
}
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java
index 05af3c7..d0617b7 100644
--- a/src/com/android/dialer/list/RegularSearchListAdapter.java
+++ b/src/com/android/dialer/list/RegularSearchListAdapter.java
@@ -23,6 +23,8 @@
import com.android.contacts.common.list.DirectoryPartition;
import com.android.contacts.common.list.PhoneNumberListAdapter;
+import com.android.dialer.calllog.ContactInfo;
+import com.android.dialer.service.CachedNumberLookupService;
import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo;
/**
@@ -34,8 +36,10 @@
super(context);
}
- public CachedContactInfo getContactInfo(int position) {
- CachedContactInfo info = new CachedContactInfo();
+ public CachedContactInfo getContactInfo(
+ CachedNumberLookupService lookupService, int position) {
+ ContactInfo info = new ContactInfo();
+ CachedContactInfo cacheInfo = lookupService.buildCachedContactInfo(info);
final Cursor item = (Cursor) getItem(position);
if (item != null) {
info.name = item.getString(PhoneQuery.DISPLAY_NAME);
@@ -44,19 +48,21 @@
info.number = item.getString(PhoneQuery.PHONE_NUMBER);
final String photoUriStr = item.getString(PhoneQuery.PHOTO_URI);
info.photoUri = photoUriStr == null ? null : Uri.parse(photoUriStr);
- info.lookupKey = item.getString(PhoneQuery.LOOKUP_KEY);
+
+ cacheInfo.setLookupKey(item.getString(PhoneQuery.LOOKUP_KEY));
final int partitionIndex = getPartitionForPosition(position);
final DirectoryPartition partition =
(DirectoryPartition) getPartition(partitionIndex);
final long directoryId = partition.getDirectoryId();
- info.sourceName = partition.getLabel();
- info.sourceType = isExtendedDirectory(directoryId) ?
- CachedContactInfo.SOURCE_TYPE_EXTENDED :
- CachedContactInfo.SOURCE_TYPE_DIRECTORY;
- info.sourceId = (int) directoryId;
+ final String sourceName = partition.getLabel();
+ if (isExtendedDirectory(directoryId)) {
+ cacheInfo.setExtendedSource(sourceName, directoryId);
+ } else {
+ cacheInfo.setDirectorySource(sourceName, directoryId);
+ }
}
- return info;
+ return cacheInfo;
}
@Override
diff --git a/src/com/android/dialer/service/CachedNumberLookupService.java b/src/com/android/dialer/service/CachedNumberLookupService.java
index cba158b..62881d2 100644
--- a/src/com/android/dialer/service/CachedNumberLookupService.java
+++ b/src/com/android/dialer/service/CachedNumberLookupService.java
@@ -7,29 +7,27 @@
public interface CachedNumberLookupService {
- public class CachedContactInfo extends ContactInfo {
- public static final int SOURCE_TYPE_DIRECTORY = 1;
- public static final int SOURCE_TYPE_EXTENDED = 2;
- public static final int SOURCE_TYPE_PLACES = 3;
- public static final int SOURCE_TYPE_PROFILE = 4;
+ public interface CachedContactInfo {
+ public ContactInfo getContactInfo();
- public String sourceName;
- public int sourceType;
- public int sourceId;
- public String lookupKey;
+ public void setDirectorySource(String name, long directoryId);
+ public void setExtendedSource(String name, long directoryId);
+ public void setLookupKey(String lookupKey);
}
+ public CachedContactInfo buildCachedContactInfo(ContactInfo info);
+
/**
* Perform a lookup using the cached number lookup service to return contact
* information stored in the cache that corresponds to the given number.
*
* @param context Valid context
* @param number Phone number to lookup the cache for
- * @return A {@link ContactInfo} containing the contact information if the phone
+ * @return A {@link CachedContactInfo} containing the contact information if the phone
* number is found in the cache, {@link ContactInfo#EMPTY} if the phone number was
* not found in the cache, and null if there was an error when querying the cache.
*/
- public ContactInfo lookupCachedContactFromNumber(Context context, String number);
+ public CachedContactInfo lookupCachedContactFromNumber(Context context, String number);
public void addContact(Context context, CachedContactInfo info);