summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Mai <garymai@google.com>2019-05-16 14:41:12 -0700
committerGary Mai <garymai@google.com>2019-05-16 14:45:50 -0700
commitd7e7c92fafd6c38d9fb7355c0a9a8ff269013fb1 (patch)
tree6c7ed10febec95a7534153234049913c25a31ebf
parent465ff075de1219197ba58599732321c4479b9598 (diff)
downloadpackages_apps_Contacts-d7e7c92fafd6c38d9fb7355c0a9a8ff269013fb1.tar.gz
packages_apps_Contacts-d7e7c92fafd6c38d9fb7355c0a9a8ff269013fb1.tar.bz2
packages_apps_Contacts-d7e7c92fafd6c38d9fb7355c0a9a8ff269013fb1.zip
Fix "Set default" in QuickContact
QuickContactActivity's context menu shows up "Set default" item even when contact has only one phone number or email. Add back the logic that checked whether there was only one of these. It was accidentally removed in ag/6001361 Test: Verified single phone number and single email entries don't have "Set default" FIXES: 132227659 Change-Id: Ie08af672688eb1691107e9b19d73e09692dc433d
-rw-r--r--src/com/android/contacts/quickcontact/QuickContactActivity.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index fcbfba91b..6d206b6a5 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -992,6 +992,14 @@ public class QuickContactActivity extends ContactsActivity {
}
private void bindDataToCards(Cp2DataCardModel cp2DataCardModel) {
+ final Map<String, List<DataItem>> dataItemsMap = cp2DataCardModel.dataItemsMap;
+
+ final List<DataItem> phoneDataItems = dataItemsMap.get(Phone.CONTENT_ITEM_TYPE);
+ mOnlyOnePhoneNumber = phoneDataItems != null && phoneDataItems.size() == 1;
+
+ final List<DataItem> emailDataItems = dataItemsMap.get(Email.CONTENT_ITEM_TYPE);
+ mOnlyOneEmail = emailDataItems != null && emailDataItems.size() == 1;
+
populateContactAndAboutCard(cp2DataCardModel, /* shouldAddPhoneticName */ true);
}