diff options
| author | Victoria Lease <violets@google.com> | 2013-11-04 08:25:54 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-04 08:25:54 -0800 |
| commit | 79007026935acf84baba183aad0ef654d9ed91aa (patch) | |
| tree | a705ef5013aebe2734c2a95ef12d6e23a0b63299 /core/java/android/widget/TextView.java | |
| parent | 459f844eeadf1e364aea68f20887ccdb1c1d631a (diff) | |
| parent | 3dbea35f7eaa6d5f94601a48ebb3be18223d4604 (diff) | |
am 3dbea35f: Merge "use SpannedStringBuilder to build a SpannedString" into klp-dev
* commit '3dbea35f7eaa6d5f94601a48ebb3be18223d4604':
use SpannedStringBuilder to build a SpannedString
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index cb930d6fbcb2..7a9809fda605 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -56,6 +56,7 @@ import android.text.Selection; import android.text.SpanWatcher; import android.text.Spannable; import android.text.SpannableString; +import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.SpannedString; import android.text.StaticLayout; @@ -3494,19 +3495,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener ss.selEnd = end; if (mText instanceof Spanned) { - /* - * Calling setText() strips off any ChangeWatchers; - * strip them now to avoid leaking references. - * But do it to a copy so that if there are any - * further changes to the text of this view, it - * won't get into an inconsistent state. - */ - - Spannable sp = new SpannableString(mText); - - for (ChangeWatcher cw : sp.getSpans(0, sp.length(), ChangeWatcher.class)) { - sp.removeSpan(cw); - } + Spannable sp = new SpannableStringBuilder(mText); if (mEditor != null) { removeMisspelledSpans(sp); |
