From 0247a9b7e357c05155081bd4e4bee3333c5179b5 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 18 Mar 2015 15:10:55 -0700 Subject: Change add contact shortcut to be for "existing". We're going to "fork" the add action into "existing" and "new". This converts the existing shortcut action to the scenario for adding to an existing contact, and the action for adding to a new contact will be added as a follow up. Bug: 19372539 Change-Id: I9e78fa5637a6f0ff22ce1d74bca3fe98e531242f --- res/values/strings.xml | 5 +++-- src/com/android/dialer/list/DialerPhoneNumberListAdapter.java | 8 ++++---- src/com/android/dialer/list/RegularSearchListAdapter.java | 5 +---- src/com/android/dialer/list/SearchFragment.java | 2 +- src/com/android/dialer/list/SmartDialNumberListAdapter.java | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 2b100f6f8..07460ec4a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -502,8 +502,9 @@ %s - - Add to contacts + + Add to existing contact Send SMS diff --git a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java index 86e852846..089937259 100644 --- a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java +++ b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java @@ -27,7 +27,7 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { public final static int SHORTCUT_INVALID = -1; public final static int SHORTCUT_DIRECT_CALL = 0; - public final static int SHORTCUT_ADD_NUMBER_TO_CONTACTS = 1; + public final static int SHORTCUT_ADD_TO_EXISTING_CONTACT = 1; public final static int SHORTCUT_SEND_SMS_MESSAGE = 2; public final static int SHORTCUT_MAKE_VIDEO_CALL = 3; @@ -143,9 +143,9 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { text = resources.getString(R.string.search_shortcut_call_number, number); drawableId = R.drawable.ic_search_phone; break; - case SHORTCUT_ADD_NUMBER_TO_CONTACTS: - text = resources.getString(R.string.search_shortcut_add_to_contacts); - drawableId = R.drawable.ic_search_add_contact; + case SHORTCUT_ADD_TO_EXISTING_CONTACT: + text = resources.getString(R.string.search_shortcut_add_to_existing_contact); + drawableId = R.drawable.ic_person_24dp; break; case SHORTCUT_SEND_SMS_MESSAGE: text = resources.getString(R.string.search_shortcut_send_sms_message); diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index 9d6694a7f..87d4fd2c8 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -69,10 +69,7 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); boolean changed = false; changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts); - // Either one of the add contacts options should be enabled. If the user entered - // a dialable number, then clicking add to contact should add it as a number. - // Otherwise, it should add it to a new contact as a name. - changed |= setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts); + changed |= setShortcutEnabled(SHORTCUT_ADD_TO_EXISTING_CONTACT, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); if (changed) { diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index ba014380c..e60936234 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -163,7 +163,7 @@ public class SearchFragment extends PhoneNumberPickerFragment { listener.onCallNumberDirectly(getQueryString()); } break; - case DialerPhoneNumberListAdapter.SHORTCUT_ADD_NUMBER_TO_CONTACTS: + case DialerPhoneNumberListAdapter.SHORTCUT_ADD_TO_EXISTING_CONTACT: final String number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getFormattedQueryString() : mAddToContactNumber; final Intent intent = DialtactsActivity.getAddNumberToContactIntent(number); diff --git a/src/com/android/dialer/list/SmartDialNumberListAdapter.java b/src/com/android/dialer/list/SmartDialNumberListAdapter.java index 3696fb900..ed01baf2f 100644 --- a/src/com/android/dialer/list/SmartDialNumberListAdapter.java +++ b/src/com/android/dialer/list/SmartDialNumberListAdapter.java @@ -116,7 +116,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter { public void setQueryString(String queryString) { final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); boolean changed = false; - changed |= setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts); + changed |= setShortcutEnabled(SHORTCUT_ADD_TO_EXISTING_CONTACT, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); -- cgit v1.2.3