Merge "Merge "Don't animate grayscale if animations are off" into oc-dr1-dev am: ab7af71c64" into oc-dr1-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2017-07-06 16:16:38 +00:00
committed by Android (Google) Code Review

View File

@@ -144,6 +144,7 @@ public class QSIconViewImpl extends QSIconView {
} }
public static void animateGrayScale(int fromColor, int toColor, ImageView iv) { public static void animateGrayScale(int fromColor, int toColor, ImageView iv) {
if (ValueAnimator.areAnimatorsEnabled()) {
final float fromAlpha = Color.alpha(fromColor); final float fromAlpha = Color.alpha(fromColor);
final float toAlpha = Color.alpha(toColor); final float toAlpha = Color.alpha(toColor);
final float fromChannel = Color.red(fromColor); final float fromChannel = Color.red(fromColor);
@@ -151,7 +152,6 @@ public class QSIconViewImpl extends QSIconView {
ValueAnimator anim = ValueAnimator.ofFloat(0, 1); ValueAnimator anim = ValueAnimator.ofFloat(0, 1);
anim.setDuration(QS_ANIM_LENGTH); anim.setDuration(QS_ANIM_LENGTH);
anim.addUpdateListener(animation -> { anim.addUpdateListener(animation -> {
float fraction = animation.getAnimatedFraction(); float fraction = animation.getAnimatedFraction();
int alpha = (int) (fromAlpha + (toAlpha - fromAlpha) * fraction); int alpha = (int) (fromAlpha + (toAlpha - fromAlpha) * fraction);
@@ -159,7 +159,11 @@ public class QSIconViewImpl extends QSIconView {
setTint(iv, Color.argb(alpha, channel, channel, channel)); setTint(iv, Color.argb(alpha, channel, channel, channel));
}); });
anim.start(); anim.start();
} else {
setTint(iv, toColor);
}
} }
public static void setTint(ImageView iv, int color) { public static void setTint(ImageView iv, int color) {