diff options
author | mindyp <mindyp@google.com> | 2012-09-10 13:06:06 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-09-10 13:06:06 -0700 |
commit | 168c284055805f84a054f8a52c60ef2cb37a6dae (patch) | |
tree | 523f24f26f10bc84fa0cdb74c2fa5e10145d27f0 /chips/src | |
parent | 45faaf4dfd9d59fd148ad898310571637ed64839 (diff) | |
parent | 3aa118e72c877b4c176d025c56bfad2e518bf1ce (diff) | |
download | android_frameworks_ex-168c284055805f84a054f8a52c60ef2cb37a6dae.tar.gz android_frameworks_ex-168c284055805f84a054f8a52c60ef2cb37a6dae.tar.bz2 android_frameworks_ex-168c284055805f84a054f8a52c60ef2cb37a6dae.zip |
am 3aa118e7: Be extra careful with commas in recipient chips
* commit '3aa118e72c877b4c176d025c56bfad2e518bf1ce':
Be extra careful with commas in recipient chips
Diffstat (limited to 'chips/src')
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 16 |
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 b102bf2..e2e6306 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -350,16 +350,19 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements super.append(text, start, end); if (!TextUtils.isEmpty(text) && TextUtils.getTrimmedLength(text) > 0) { String displayString = text.toString(); - int separatorPos = displayString.indexOf(COMMIT_CHAR_COMMA); + int separatorPos = displayString.lastIndexOf(COMMIT_CHAR_COMMA); // Verify that the separator pos is not within ""; if it is, look // past the closing quote. If there is no comma past ", this string // will resolve to an error chip. if (separatorPos > -1) { - displayString = displayString.substring(separatorPos); - int endQuotedTextPos = displayString.indexOf(NAME_WRAPPER_CHAR); + String parseDisplayString = displayString.substring(separatorPos); + int endQuotedTextPos = parseDisplayString.indexOf(NAME_WRAPPER_CHAR); if (endQuotedTextPos > separatorPos) { - displayString = displayString.substring(endQuotedTextPos); - separatorPos = displayString.indexOf(COMMIT_CHAR_COMMA); + separatorPos = parseDisplayString.lastIndexOf(COMMIT_CHAR_COMMA, + endQuotedTextPos); + } + if (separatorPos == -1) { + separatorPos = displayString.length(); } } if (separatorPos > 0 && !TextUtils.isEmpty(displayString) @@ -368,7 +371,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements mPendingChips.add(text.toString()); } } - // Put a message on the queue to make sure we ALWAYS handle pending chips. + // Put a message on the queue to make sure we ALWAYS handle pending + // chips. if (mPendingChipsCount > 0) { postHandlePendingChips(); } |