summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-05-05 16:29:03 -0700
committerAndrew Lee <anwlee@google.com>2015-05-05 17:54:52 -0700
commit222c96dbbfa184416d459b2661ca89438a0eed85 (patch)
tree44b4711a74d8f933866a283d39ffab13d2f74258
parent5e6431ec9df6cb62cab970c0b46618be3570c2f7 (diff)
Shown actions for queries with at least one digit.
It can be confusing to show the "smartdial" string converting chars to digits, so only show the actions in a potential vanity-scenario. Bug: 20699894 Change-Id: I4df5e94841c519cc591d1d5333d48efa739124e7
-rw-r--r--src/com/android/dialer/list/RegularSearchListAdapter.java18
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;
+ }
}