From 2a83181bd1a025eb8a1763b11ae9ba33925625b3 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Fri, 6 Sep 2013 17:26:43 -0700 Subject: [PATCH] TextChange transition now uses CharSequence instead of String TextChange made a bad assumption that target text views contained String objects as their text, which is not always the case. For example, Gmail ActionBar text views may contain SpannableString objects, which caused a crash due to a bad cast operation. Fix is to simply use CharSequence instead of String as the value that is being stored and set on the text view. Issue #10651858 TextChange transition casts CharSequence to String when not necessarily safe Change-Id: I3f67f5d5e39201dc0fd2edcd3e4243033cf9ae08 --- core/java/android/transition/TextChange.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/transition/TextChange.java b/core/java/android/transition/TextChange.java index 1b26942fe152..4f14d462675d 100644 --- a/core/java/android/transition/TextChange.java +++ b/core/java/android/transition/TextChange.java @@ -143,8 +143,8 @@ public class TextChange extends Transition { final TextView view = (TextView) endValues.view; Map startVals = startValues.values; Map endVals = endValues.values; - final String startText = (String) startVals.get(PROPNAME_TEXT); - final String endText = (String) endVals.get(PROPNAME_TEXT); + final CharSequence startText = (CharSequence) startVals.get(PROPNAME_TEXT); + final CharSequence endText = (CharSequence) endVals.get(PROPNAME_TEXT); if (!startText.equals(endText)) { view.setText(startText); Animator anim; -- 2.11.0