summaryrefslogtreecommitdiffstats
path: root/chips/src
diff options
context:
space:
mode:
authormindyp <mindyp@google.com>2012-08-27 11:28:32 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-27 11:28:32 -0700
commitfeffe9dd89757533ade5926afc284f9369c8a9c4 (patch)
tree6827f201009d20d8e82d333b1c7295a9dc05db37 /chips/src
parent501d1bf0f0488adcfe5ce03c3d98c567b57a41fd (diff)
parent26e3f68ae8342cedd57353e399e7d0e920228a4e (diff)
downloadandroid_frameworks_ex-feffe9dd89757533ade5926afc284f9369c8a9c4.tar.gz
android_frameworks_ex-feffe9dd89757533ade5926afc284f9369c8a9c4.tar.bz2
android_frameworks_ex-feffe9dd89757533ade5926afc284f9369c8a9c4.zip
am 26e3f68a: Deal with commas within quoted text
* commit '26e3f68ae8342cedd57353e399e7d0e920228a4e': Deal with commas within quoted text
Diffstat (limited to 'chips/src')
-rw-r--r--chips/src/com/android/ex/chips/RecipientEditTextView.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java
index 8153ff7..b102bf2 100644
--- a/chips/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java
@@ -100,6 +100,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
private static final char COMMIT_CHAR_COMMA = ',';
+ private static final char NAME_WRAPPER_CHAR = '"';
+
private static final char COMMIT_CHAR_SEMICOLON = ';';
private static final char COMMIT_CHAR_SPACE = ' ';
@@ -347,9 +349,20 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
}
super.append(text, start, end);
if (!TextUtils.isEmpty(text) && TextUtils.getTrimmedLength(text) > 0) {
- final String displayString = text.toString();
- int seperatorPos = displayString.indexOf(COMMIT_CHAR_COMMA);
- if (seperatorPos != 0 && !TextUtils.isEmpty(displayString)
+ String displayString = text.toString();
+ int separatorPos = displayString.indexOf(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);
+ if (endQuotedTextPos > separatorPos) {
+ displayString = displayString.substring(endQuotedTextPos);
+ separatorPos = displayString.indexOf(COMMIT_CHAR_COMMA);
+ }
+ }
+ if (separatorPos > 0 && !TextUtils.isEmpty(displayString)
&& TextUtils.getTrimmedLength(displayString) > 0) {
mPendingChipsCount++;
mPendingChips.add(text.toString());