From 5b8a5cb6b8e15913bb6faa8f44b4b69a62eff85e Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 19 Mar 2015 15:12:16 -0700 Subject: Cleanup logic for showing/hiding shortcuts. + Update SEND_SMS in the regular search list adapter. Before, it was showing up all the time, even when it wasn't supposed to. + Hide CREATE and ADD in the regular search list adapter. + Move disabling of DIRECT_CALL to the smart dial adapter. It's only used by the single fragment right now, so centralizes the enabling of the shortcuts. Bug: 19372539 Change-Id: Iea9108e83f15026d86400a5d1e63d5c011b2770a --- src/com/android/dialer/list/RegularSearchListAdapter.java | 5 +++-- src/com/android/dialer/list/SmartDialNumberListAdapter.java | 1 + src/com/android/dialer/list/SmartDialSearchFragment.java | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index 722dc2ed6..3c55bc012 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -33,6 +33,8 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { public RegularSearchListAdapter(Context context) { super(context); + setShortcutEnabled(SHORTCUT_CREATE_NEW_CONTACT, false); + setShortcutEnabled(SHORTCUT_ADD_TO_EXISTING_CONTACT, false); } public CachedContactInfo getContactInfo( @@ -69,8 +71,7 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); boolean changed = false; changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts); - changed |= setShortcutEnabled(SHORTCUT_CREATE_NEW_CONTACT, 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())); if (changed) { diff --git a/src/com/android/dialer/list/SmartDialNumberListAdapter.java b/src/com/android/dialer/list/SmartDialNumberListAdapter.java index 22ee92df2..fe27a25ab 100644 --- a/src/com/android/dialer/list/SmartDialNumberListAdapter.java +++ b/src/com/android/dialer/list/SmartDialNumberListAdapter.java @@ -46,6 +46,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter { public SmartDialNumberListAdapter(Context context) { super(context); mNameMatcher = new SmartDialNameMatcher("", SmartDialPrefix.getMap()); + setShortcutEnabled(SmartDialNumberListAdapter.SHORTCUT_DIRECT_CALL, false); if (DEBUG) { Log.v(TAG, "Constructing List Adapter"); diff --git a/src/com/android/dialer/list/SmartDialSearchFragment.java b/src/com/android/dialer/list/SmartDialSearchFragment.java index 6c521147e..082bc4360 100644 --- a/src/com/android/dialer/list/SmartDialSearchFragment.java +++ b/src/com/android/dialer/list/SmartDialSearchFragment.java @@ -38,8 +38,6 @@ public class SmartDialSearchFragment extends SearchFragment { SmartDialNumberListAdapter adapter = new SmartDialNumberListAdapter(getActivity()); adapter.setUseCallableUri(super.usesCallableUri()); adapter.setQuickContactEnabled(true); - // Disable the direct call shortcut. The call button will already be showing. - adapter.setShortcutEnabled(SmartDialNumberListAdapter.SHORTCUT_DIRECT_CALL, false); // Set adapter's query string to restore previous instance state. adapter.setQueryString(getQueryString()); return adapter; -- cgit v1.2.3