summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-09-24 15:13:56 -0700
committerYorke Lee <yorkelee@google.com>2013-09-24 15:55:19 -0700
commit43f543900efac8edc10159851184da8cfca3d81a (patch)
tree25fa9f3bfb5c5cc3b9b86507758ae4c574daf6ef /src
parent121b28e859806d27ed852f47c1994c9d473bfd0d (diff)
downloadandroid_packages_apps_Dialer-43f543900efac8edc10159851184da8cfca3d81a.tar.gz
android_packages_apps_Dialer-43f543900efac8edc10159851184da8cfca3d81a.tar.bz2
android_packages_apps_Dialer-43f543900efac8edc10159851184da8cfca3d81a.zip
Restore the phone disambiguation dialog
As discussed: 1) If a contact has more than one phone number and no default set, don't show the phone number type. Instead, just center the contact name. 2) Clicking on a contact with more than one phone number and no default will launch the disambiguation dialog. 3) If a contact has a default phone number set or only has one phone number, show the phone number type. 4) Add phone number type to the top 3 contacts, if one is present. Change-Id: I6a60fc6111e8f9494eca5e35d7cfbaf40aa99e57
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 1247d35ed..64387fa01 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -109,6 +109,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
private int mPhoneNumberIndex;
private int mPhoneNumberTypeIndex;
private int mPhoneNumberLabelIndex;
+ private int mIsDefaultNumberIndex;
protected int mPinnedIndex;
protected int mContactIdIndex;
@@ -203,6 +204,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
mPhoneNumberIndex = ContactTileLoaderFactory.PHONE_NUMBER;
mPhoneNumberTypeIndex = ContactTileLoaderFactory.PHONE_NUMBER_TYPE;
mPhoneNumberLabelIndex = ContactTileLoaderFactory.PHONE_NUMBER_LABEL;
+ mIsDefaultNumberIndex = ContactTileLoaderFactory.IS_DEFAULT_NUMBER;
mPinnedIndex = ContactTileLoaderFactory.PINNED;
mContactIdIndex = ContactTileLoaderFactory.CONTACT_ID_FOR_DATA;
}
@@ -256,11 +258,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
final LongSparseArray<Object> duplicates = new LongSparseArray<Object>(cursor.getCount());
- // Dummy object that we're inserting into the sparse array as a value so that we can use
- // the sparse array as a set to check for duplicates
-
- final Object dummy = new Object();
-
// Track the length of {@link #mContactEntries} and compare to {@link #TILES_SOFT_LIMIT}.
int counter = 0;
@@ -277,9 +274,14 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
id = cursor.getLong(mContactIdIndex);
}
- if (duplicates.get(id) == null) {
- duplicates.put(id, dummy);
- } else {
+ final ContactEntry existing = (ContactEntry) duplicates.get(id);
+ if (existing != null) {
+ // Check if the existing number is a default number. If not, clear the phone number
+ // and label fields so that the disambiguation dialog will show up.
+ if (!existing.isDefaultNumber) {
+ existing.phoneLabel = null;
+ existing.phoneNumber = null;
+ }
continue;
}
@@ -288,6 +290,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
final int pinned = cursor.getInt(mPinnedIndex);
final String name = cursor.getString(mNameIndex);
final boolean isStarred = cursor.getInt(mStarredIndex) > 0;
+ final boolean isDefaultNumber = cursor.getInt(mIsDefaultNumberIndex) > 0;
final ContactEntry contact = new ContactEntry();
@@ -298,8 +301,9 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
contact.lookupKey = ContentUris.withAppendedId(
Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);
contact.isFavorite = isStarred;
+ contact.isDefaultNumber = isDefaultNumber;
- // Set phone number, label and status
+ // Set phone number and label
final int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex);
final String phoneNumberCustomLabel = cursor.getString(mPhoneNumberLabelIndex);
contact.phoneLabel = (String) Phone.getTypeLabel(mResources, phoneNumberType,
@@ -309,6 +313,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
contact.pinned = pinned;
mContactEntries.add(contact);
+ duplicates.put(id, contact);
+
counter++;
}