summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-09-20 18:54:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-20 18:54:35 +0000
commitda97085e042123d7634c3d5122ad71bf01a514c9 (patch)
treefc1ebb8b6d5cf4debdc3e510ac49c461961d4848 /src
parentb4e70627beed03f6dc4038d536f843e42343bf08 (diff)
parent604d48099cd8e0bcf2f992237082600837630038 (diff)
Merge "Ignore separators when typing in Dialer search box" into klp-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/DialerPhoneNumberListAdapter.java24
-rw-r--r--src/com/android/dialer/list/RegularSearchListAdapter.java1
-rw-r--r--src/com/android/dialer/list/SearchFragment.java4
-rw-r--r--src/com/android/dialer/list/SmartDialSearchFragment.java2
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;
}