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
This commit is contained in:
Doris Liu
2016-05-24 14:56:08 -07:00
parent 2a86e67c41
commit bbeafd1199

View File

@@ -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() {