diff options
Diffstat (limited to 'src/com/android/dialer/list/RegularSearchListAdapter.java')
-rw-r--r-- | src/com/android/dialer/list/RegularSearchListAdapter.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index 390dbb56c..627262ebe 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -19,6 +19,7 @@ import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; +import android.text.TextUtils; import com.android.contacts.common.list.DirectoryPartition; import com.android.contacts.common.list.PhoneNumberListAdapter; @@ -27,7 +28,7 @@ import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo; /** * List adapter to display regular search results. */ -public class RegularSearchListAdapter extends PhoneNumberListAdapter { +public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { public RegularSearchListAdapter(Context context) { super(context); @@ -59,4 +60,16 @@ public class RegularSearchListAdapter extends PhoneNumberListAdapter { } return info; } + + @Override + public void setQueryString(String queryString) { + final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); + 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. + setShortcutEnabled(SHORTCUT_ADD_NUMBER_TO_CONTACTS, showNumberShortcuts); + setShortcutEnabled(SHORTCUT_ADD_NEW_NAMED_CONTACT, !showNumberShortcuts); + super.setQueryString(queryString); + } } |