diff options
author | Tom Taylor <tomtaylor@google.com> | 2012-11-15 13:57:41 -0800 |
---|---|---|
committer | Tom Taylor <tomtaylor@google.com> | 2012-11-15 13:57:41 -0800 |
commit | f5ac32862370c6dd004baa0ac838bced8794a0d8 (patch) | |
tree | 27affbff2816c28be1d862a619b8ac63038a97b0 /chips/src/com | |
parent | a34f71153cebf524807767886dad4defc32d8d4d (diff) | |
download | android_frameworks_ex-f5ac32862370c6dd004baa0ac838bced8794a0d8.tar.gz android_frameworks_ex-f5ac32862370c6dd004baa0ac838bced8794a0d8.tar.bz2 android_frameworks_ex-f5ac32862370c6dd004baa0ac838bced8794a0d8.zip |
SMS text messaging omits numbers in parentheses
Bug 7355280
Very localized fix. Tweak the phone number matching pattern to handle a
"1" before parens. This change was originally incorporated in MR1, but
wiped out by some automerger change. Bringing the change back for MR1.1.
Change-Id: Ifd11762fb7253fab69ca912dff6b62c5673bf216
Diffstat (limited to 'chips/src/com')
-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 011b1e9..5327389 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() { @@ -938,7 +948,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements return false; } - Matcher match = Patterns.PHONE.matcher(number); + Matcher match = PHONE_PATTERN.matcher(number); return match.matches(); } |