diff options
author | mindyp <mindyp@google.com> | 2012-10-01 10:23:51 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-01 10:23:51 -0700 |
commit | b2d148b8624df5f56e976cad38e1812f5fa674be (patch) | |
tree | f7a32ccc4a733c14e431726fddb1464051b30653 | |
parent | c930ef0a3ed04ef8eed499e4146a1cb09c2443a4 (diff) | |
parent | 0c6fe7e60e7550e56ad1982d0d5833b64eea6f97 (diff) | |
download | android_frameworks_ex-b2d148b8624df5f56e976cad38e1812f5fa674be.tar.gz android_frameworks_ex-b2d148b8624df5f56e976cad38e1812f5fa674be.tar.bz2 android_frameworks_ex-b2d148b8624df5f56e976cad38e1812f5fa674be.zip |
am 0c6fe7e6: cherrypick: Fix crashes associated with new logic to replace entire address with name + address
* commit '0c6fe7e60e7550e56ad1982d0d5833b64eea6f97':
cherrypick: Fix crashes associated with new logic to replace entire address with name + address
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index 013a238..a604807 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -2361,12 +2361,11 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements mHandler.post(new Runnable() { @Override public void run() { - SpannableStringBuilder text = new SpannableStringBuilder(getText() - .toString()); Editable oldText = getText(); int start, end; int i = 0; for (RecipientChip chip : originalRecipients) { + // Find the location of the chip in the text currently shown. start = oldText.getSpanStart(chip); if (start != -1) { end = oldText.getSpanEnd(chip); @@ -2378,13 +2377,14 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements createAddressText(replacement.getEntry()).trim()); displayText.setSpan(replacement, 0, displayText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - text.replace(start, end, displayText); + // Replace the old text we found with with the new display text, + // which now may also contain the display name of the recipient. + oldText.replace(start, end, displayText); replacement.setOriginalText(displayText.toString()); } i++; } originalRecipients.clear(); - setText(text); } }); } |