diff options
| author | Tom Taylor <tomtaylor@google.com> | 2012-10-16 13:13:29 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-16 13:13:29 -0700 |
| commit | 022e7fb24f9faf30608e3f16bdaadba05be3f136 (patch) | |
| tree | f2b820f85fd3f1c2c61f6c31dbc9c7724e960ca4 | |
| parent | 74ee30d2f0191e74c29c2cafc970ed286c27ec6c (diff) | |
| parent | 0453ec9b61f1c416c8a79e401f9d3358bef2c59f (diff) | |
| download | android_frameworks_ex-022e7fb24f9faf30608e3f16bdaadba05be3f136.tar.gz android_frameworks_ex-022e7fb24f9faf30608e3f16bdaadba05be3f136.tar.bz2 android_frameworks_ex-022e7fb24f9faf30608e3f16bdaadba05be3f136.zip | |
am 0453ec9b: am b32dd40a: SMS text messaging omits numbers in parentheses
* commit '0453ec9b61f1c416c8a79e401f9d3358bef2c59f':
SMS text messaging omits numbers in parentheses
| -rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index ec95e47..f4346b8 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -88,6 +88,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * RecipientEditTextView is an auto complete text view for use with applications @@ -194,6 +195,15 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private boolean mDragEnabled = false; + // This pattern comes from android.util.Patterns. It has been tweaked to handle a "1" before + // parens, so numbers such as "1 (425) 222-2342" match. + private static final Pattern PHONE_PATTERN + = Pattern.compile( // sdd = space, dot, or dash + "(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>* + + "(1?[ ]*\\([0-9]+\\)[\\- \\.]*)?" // 1(<digits>)<sdd>* + + "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit> + + private final Runnable mAddTextWatcher = new Runnable() { @Override public void run() { @@ -912,7 +922,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements return false; } - Matcher match = Patterns.PHONE.matcher(number); + Matcher match = PHONE_PATTERN.matcher(number); return match.matches(); } |
