summaryrefslogtreecommitdiffstats
path: root/chips/src/com/android
diff options
context:
space:
mode:
authorScott Kennedy <skennedy@google.com>2013-03-06 22:23:59 -0800
committerScott Kennedy <skennedy@google.com>2013-03-06 23:14:59 -0800
commit563bbd3883a226dd1529170a6df937c8f9c8bd43 (patch)
treee0b627a86c4f8d91b96f6dd3a889cc3580ff1d6e /chips/src/com/android
parentb48368b1a1b15fd52c66ff9432429c744c411932 (diff)
downloadandroid_frameworks_ex-563bbd3883a226dd1529170a6df937c8f9c8bd43.tar.gz
android_frameworks_ex-563bbd3883a226dd1529170a6df937c8f9c8bd43.tar.bz2
android_frameworks_ex-563bbd3883a226dd1529170a6df937c8f9c8bd43.zip
Add a test case for b/8321211
Emails like: "Ex Ample" <example@example.com> were displaying improperly. Change-Id: Idd43814352e0c4455733adc13b89eb6fc1aca1bb
Diffstat (limited to 'chips/src/com/android')
-rw-r--r--chips/src/com/android/ex/chips/RecipientEditTextView.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java
index f53ae25..d5ee73a 100644
--- a/chips/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java
@@ -157,7 +157,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
private TextView mMoreItem;
- private final ArrayList<String> mPendingChips = new ArrayList<String>();
+ // VisibleForTesting
+ final ArrayList<String> mPendingChips = new ArrayList<String>();
private Handler mHandler;
@@ -169,7 +170,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
private ListPopupWindow mAddressPopup;
- private ArrayList<RecipientChip> mTemporaryRecipients;
+ // VisibleForTesting
+ ArrayList<RecipientChip> mTemporaryRecipients;
private ArrayList<RecipientChip> mRemovedSpans;
@@ -903,7 +905,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
* Create a chip that represents just the email address of a recipient. At some later
* point, this chip will be attached to a real contact entry, if one exists.
*/
- private void createReplacementChip(int tokenStart, int tokenEnd, Editable editable,
+ // VisibleForTesting
+ void createReplacementChip(int tokenStart, int tokenEnd, Editable editable,
boolean visible) {
if (alreadyHasChip(tokenStart, tokenEnd)) {
// There is already a chip present at this location.
@@ -911,9 +914,10 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
return;
}
String token = editable.toString().substring(tokenStart, tokenEnd);
- int commitCharIndex = token.trim().lastIndexOf(COMMIT_CHAR_COMMA);
- if (commitCharIndex == token.length() - 1) {
- token = token.substring(0, token.length() - 1);
+ final String trimmedToken = token.trim();
+ int commitCharIndex = trimmedToken.lastIndexOf(COMMIT_CHAR_COMMA);
+ if (commitCharIndex == trimmedToken.length() - 1) {
+ token = trimmedToken.substring(0, trimmedToken.length() - 1);
}
RecipientEntry entry = createTokenizedEntry(token);
if (entry != null) {