From bbeafd1199fc12b57b32b2e86820e227b3efd149 Mon Sep 17 00:00:00 2001 From: Doris Liu Date: Tue, 24 May 2016 14:56:08 -0700 Subject: [PATCH] Fix blue channel gets updated incorrectly in ChangeText transition Also fixed text's alpha channel gets incorrectly reset to fully opaque. Bug: 28919053 Bug: 28932357 Change-Id: Ib0ae6fe56ba4e09dea69534868e764e65e888e62 --- core/java/android/transition/ChangeText.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/java/android/transition/ChangeText.java b/core/java/android/transition/ChangeText.java index 8677a564c01e1..fcf8bb047e0f4 100644 --- a/core/java/android/transition/ChangeText.java +++ b/core/java/android/transition/ChangeText.java @@ -210,13 +210,12 @@ public class ChangeText extends Transition { ValueAnimator outAnim = null, inAnim = null; if (mChangeBehavior == CHANGE_BEHAVIOR_OUT_IN || mChangeBehavior == CHANGE_BEHAVIOR_OUT) { - outAnim = ValueAnimator.ofInt(255, 0); + outAnim = ValueAnimator.ofInt(Color.alpha(startColor), 0); outAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int currAlpha = (Integer) animation.getAnimatedValue(); - view.setTextColor(currAlpha << 24 | startColor & 0xff0000 | - startColor & 0xff00 | startColor & 0xff); + view.setTextColor(currAlpha << 24 | startColor & 0xffffff); } }); outAnim.addListener(new AnimatorListenerAdapter() { @@ -237,13 +236,12 @@ public class ChangeText extends Transition { } if (mChangeBehavior == CHANGE_BEHAVIOR_OUT_IN || mChangeBehavior == CHANGE_BEHAVIOR_IN) { - inAnim = ValueAnimator.ofInt(0, 255); + inAnim = ValueAnimator.ofInt(0, Color.alpha(endColor)); inAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int currAlpha = (Integer) animation.getAnimatedValue(); - view.setTextColor(currAlpha << 24 | Color.red(endColor) << 16 | - Color.green(endColor) << 8 | Color.red(endColor)); + view.setTextColor(currAlpha << 24 | endColor & 0xffffff); } }); inAnim.addListener(new AnimatorListenerAdapter() {