diff options
author | Andrew Lee <anwlee@google.com> | 2015-05-06 00:57:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-06 00:57:32 +0000 |
commit | 7206436bffa67f2cc2d86995b06ebba5b640c02a (patch) | |
tree | ab10b4b94ef24137f41247230496bb7850b93b92 | |
parent | 573c2d564a4e105f6e35dbb59a68a54b59a4d962 (diff) | |
parent | 222c96dbbfa184416d459b2661ca89438a0eed85 (diff) |
Merge "Shown actions for queries with at least one digit." into mnc-dev
-rw-r--r-- | src/com/android/dialer/list/RegularSearchListAdapter.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index 3c55bc012..6c7045814 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -68,7 +68,9 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { @Override public void setQueryString(String queryString) { - final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); + // Don't show actions if the query string contains a letter. + final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()) + && hasDigitsInQueryString(); boolean changed = false; changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts); @@ -79,4 +81,18 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { } super.setQueryString(queryString); } + + /** + * Whether there is at least one digit in the query string. + */ + private boolean hasDigitsInQueryString() { + String queryString = getQueryString(); + int length = queryString.length(); + for (int i = 0; i < length; i++) { + if (Character.isDigit(queryString.charAt(i))) { + return true; + } + } + return false; + } } |