diff options
| author | mindyp <mindyp@google.com> | 2012-12-18 11:48:07 -0800 |
|---|---|---|
| committer | mindyp <mindyp@google.com> | 2012-12-18 11:48:07 -0800 |
| commit | bbac6435112320972b60a74d0e39273520740a39 (patch) | |
| tree | c0fb45ebc3f3f206993508e962779e47f9974fb7 | |
| parent | 8371daf249e72d33cf1652a8d52570fb56dd064b (diff) | |
| download | android_frameworks_ex-bbac6435112320972b60a74d0e39273520740a39.tar.gz android_frameworks_ex-bbac6435112320972b60a74d0e39273520740a39.tar.bz2 android_frameworks_ex-bbac6435112320972b60a74d0e39273520740a39.zip | |
Make sure we correctly handle the " " at the end of a chip
Fixes b/7727633 After reply focusing on To field puts cursor right next to chip
Change-Id: I13e7ede4385cf96e6eb0588adaccf0f67424b0ce
| -rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index a8df49d..f1c87f4 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -814,7 +814,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements for (int i = 0; i < mPendingChips.size(); i++) { String current = mPendingChips.get(i); int tokenStart = editable.toString().indexOf(current); - int tokenEnd = tokenStart + current.length(); + // Always leave a space at the end between tokens. + int tokenEnd = tokenStart + current.length() - 1; if (tokenStart >= 0) { // When we have a valid token, include it with the token // to the left. @@ -2477,7 +2478,12 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements if (start != -1) { RecipientChip replacement = replacements.get(i); if (replacement != null) { - end = oldText.getSpanEnd(chip); + // Replacing the entirety of + // what the chip + // represented, including + // the extra space dividing + // it from other chips. + end = oldText.getSpanEnd(chip) + 1; oldText.removeSpan(chip); // Make sure we always have just 1 space at the // end to separate this chip from the next chip. |
