diff options
author | Yorke Lee <yorkelee@google.com> | 2013-09-19 17:44:12 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-09-20 08:53:17 -0700 |
commit | 604d48099cd8e0bcf2f992237082600837630038 (patch) | |
tree | 7c91f26c6815f45ea9e369023323eda7a8a3d4ec | |
parent | 4e710e70b47d1236640ef0e2c98134e15e0c6be2 (diff) |
Ignore separators when typing in Dialer search box
Bug: 10842248
Change-Id: Id0c65385af4277120ba6a57c357b980caec149c2
4 files changed, 3 insertions, 28 deletions
diff --git a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java index e9117107e..4f3a4dabf 100644 --- a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java +++ b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java @@ -3,7 +3,6 @@ package com.android.dialer.list; import android.content.Context; import android.content.res.Resources; import android.telephony.PhoneNumberUtils; -import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; @@ -29,9 +28,8 @@ 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_NEW_NAMED_CONTACT = 2; - public final static int SHORTCUT_COUNT = 3; + public final static int SHORTCUT_COUNT = 2; private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT]; @@ -147,10 +145,6 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { text = resources.getString(R.string.search_shortcut_add_to_contacts); drawableId = R.drawable.ic_add_person_dk; break; - case SHORTCUT_ADD_NEW_NAMED_CONTACT: - text = resources.getString(R.string.search_shortcut_add_to_contacts); - drawableId = R.drawable.ic_add_person_dk; - break; default: throw new IllegalArgumentException("Invalid shortcut type"); } @@ -169,20 +163,8 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { @Override public void setQueryString(String queryString) { - boolean containsNonDialableCharacters = false; - for (int i = 0; i < queryString.length(); i++) { - if (!PhoneNumberUtils.isDialable(queryString.charAt(i))) { - containsNonDialableCharacters = true; - break; - } - } - - if (containsNonDialableCharacters) { - mFormattedQueryString = null; - } else { - mFormattedQueryString = PhoneNumberUtils.formatNumber(queryString, mCountryIso); - } - + mFormattedQueryString = PhoneNumberUtils.formatNumber( + PhoneNumberUtils.convertAndStrip(queryString), mCountryIso); super.setQueryString(queryString); } } diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java index 58779124e..05af3c7ff 100644 --- a/src/com/android/dialer/list/RegularSearchListAdapter.java +++ b/src/com/android/dialer/list/RegularSearchListAdapter.java @@ -67,7 +67,6 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter { // 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); } } diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index 0302d9724..006729b93 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -106,10 +106,6 @@ public class SearchFragment extends PhoneNumberPickerFragment { final String number = adapter.getFormattedQueryString(); final Intent intent = DialtactsActivity.getAddNumberToContactIntent(number); startActivityWithErrorToast(intent); - } else if (shortcutType == DialerPhoneNumberListAdapter.SHORTCUT_ADD_NEW_NAMED_CONTACT) { - final String name = adapter.getQueryString(); - final Intent intent = DialtactsActivity.getInsertContactWithNameIntent(name); - startActivityWithErrorToast(intent); } } diff --git a/src/com/android/dialer/list/SmartDialSearchFragment.java b/src/com/android/dialer/list/SmartDialSearchFragment.java index 4248c85fb..0efe9186b 100644 --- a/src/com/android/dialer/list/SmartDialSearchFragment.java +++ b/src/com/android/dialer/list/SmartDialSearchFragment.java @@ -41,8 +41,6 @@ public class SmartDialSearchFragment extends SearchFragment { // Disable the direct call shortcut for the smart dial fragment, since the call button // will already be showing anyway. adapter.setShortcutEnabled(SmartDialNumberListAdapter.SHORTCUT_DIRECT_CALL, false); - adapter.setShortcutEnabled(SmartDialNumberListAdapter.SHORTCUT_ADD_NEW_NAMED_CONTACT, - false); return adapter; } |