Merge "Enlarge the click area of star in favorite tiles" into klp-dev
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index a4702c6..12a0f2b 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -496,14 +496,6 @@
mSearchView = (EditText) findViewById(R.id.search_view);
mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener);
mSearchView.setHint(getString(R.string.dialer_hint_find_contact));
- mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() {
- @Override
- public void onFocusChange(View view, boolean hasFocus) {
- if (hasFocus) {
- showInputMethod(view.findFocus());
- }
- }
- });
}
final AnimatorListener mHideListener = new AnimatorListenerAdapter() {
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/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index eca4d97..d4fa7d4 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -74,7 +74,7 @@
PhoneFavoritesTileAdapter.OnDataSetChangedForAnimationListener {
private static final String TAG = PhoneFavoriteFragment.class.getSimpleName();
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private int mAnimationDuration;
diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java
index 4e0b8ff..10b9e9a 100644
--- a/src/com/android/dialer/list/PhoneFavoriteListView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteListView.java
@@ -325,6 +325,11 @@
}
final ContactTileRow tile = (ContactTileRow) child;
+
+ if (tile.getTileAdapter().hasPotentialRemoveEntryIndex()) {
+ return false;
+ }
+
final int itemIndex = tile.getItemIndex(x, y);
if (itemIndex != -1 && mOnDragDropListener != null) {
final PhoneFavoriteTileView tileView =
@@ -386,7 +391,8 @@
// Draw the drag shadow at its last known location if the drag shadow exists.
if (mDragShadowOverlay != null) {
- mDragShadowOverlay.setLayoutParams(getDragShadowLayoutParams());
+ mDragShadowOverlay.setX(mDragShadowLeft);
+ mDragShadowOverlay.setY(mDragShadowTop);
}
final ContactTileRow tile = (ContactTileRow) child;
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index ae9414a..ce18a2b 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -667,6 +667,10 @@
mPotentialRemoveEntryIndex = -1;
}
+ public boolean hasPotentialRemoveEntryIndex() {
+ return isIndexInBound(mPotentialRemoveEntryIndex);
+ }
+
/**
* Clears all temporary variables at a new interaction.
*/
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);