From 6413ac6689b3d33cf2e42715575d3119d2c90f00 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Thu, 21 Mar 2013 10:28:50 -0700 Subject: Area code gets eaten in Chips Bug 8436028 New code for tokenizing an address stripped the area code from a manually entered phone number. When chips is in "phone number" mode, call a new function (essentially the old function before the change) to create a fake entry directly from the phone number. Change-Id: I2d62ff24aacd8eadb9086840bd4d003cf39db177 --- chips/src/com/android/ex/chips/RecipientEditTextView.java | 2 +- chips/src/com/android/ex/chips/RecipientEntry.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'chips') diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index 5e433fa..8659103 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -1010,7 +1010,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements return null; } if (isPhoneQuery() && isPhoneNumber(token)) { - return RecipientEntry.constructFakeEntry(token, true); + return RecipientEntry.constructFakePhoneEntry(token, true); } Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(token); String display = null; diff --git a/chips/src/com/android/ex/chips/RecipientEntry.java b/chips/src/com/android/ex/chips/RecipientEntry.java index f7155b0..44bc767 100644 --- a/chips/src/com/android/ex/chips/RecipientEntry.java +++ b/chips/src/com/android/ex/chips/RecipientEntry.java @@ -117,6 +117,16 @@ public class RecipientEntry { INVALID_CONTACT, INVALID_CONTACT, null, true, isValid); } + /** + * Construct a RecipientEntry from just a phone number. + */ + public static RecipientEntry constructFakePhoneEntry(final String phoneNumber, + final boolean isValid) { + return new RecipientEntry(ENTRY_TYPE_PERSON, phoneNumber, phoneNumber, + INVALID_DESTINATION_TYPE, null, + INVALID_CONTACT, INVALID_CONTACT, null, true, isValid); + } + /** * @return the display name for the entry. If the display name source is larger than * {@link DisplayNameSources#PHONE} we use the contact's display name, but if not, -- cgit v1.2.3