summaryrefslogtreecommitdiffstats
path: root/chips/src
diff options
context:
space:
mode:
authormindyp <mindyp@google.com>2012-09-29 12:39:15 -0700
committermindyp <mindyp@google.com>2012-10-01 08:21:38 -0700
commit0c6fe7e60e7550e56ad1982d0d5833b64eea6f97 (patch)
treef7a32ccc4a733c14e431726fddb1464051b30653 /chips/src
parent3817205ea94886f05f026b25c61e30288dd3fb8b (diff)
downloadandroid_frameworks_ex-0c6fe7e60e7550e56ad1982d0d5833b64eea6f97.tar.gz
android_frameworks_ex-0c6fe7e60e7550e56ad1982d0d5833b64eea6f97.tar.bz2
android_frameworks_ex-0c6fe7e60e7550e56ad1982d0d5833b64eea6f97.zip
cherrypick: Fix crashes associated with new logic to replace entire address with name + address
Fixes b/7257614 crash when replying to a message Change-Id: I6dcda376073f941fba4b09a647bdb00a92e4ccce
Diffstat (limited to 'chips/src')
-rw-r--r--chips/src/com/android/ex/chips/RecipientEditTextView.java8
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);
}
});
}