summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Laird <evanlaird@google.com> 2017-07-06 16:42:43 +0000
committer android-build-merger <android-build-merger@google.com> 2017-07-06 16:42:43 +0000
commit3b0c008d32ec37c02e3960ffccd239d5613ee9c7 (patch)
treee6de3e040d8abb9d0126f9a80b148233dc762631
parente3d6b296d87bdf30e9aa12142a3053108fa62ae2 (diff)
parent4a17866abef24c6fcf653ae41ffb858685666bf6 (diff)
Merge "Merge "Don't animate grayscale if animations are off" into oc-dr1-dev am: ab7af71c64" into oc-dr1-dev-plus-aosp
am: 4a17866abe Change-Id: Ic38e272a6556d25c21b5842e66f70d9fc00d7afa
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
index cdd0ebc57d5c..6659650601a6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
@@ -144,22 +144,26 @@ public class QSIconViewImpl extends QSIconView {
}
public static void animateGrayScale(int fromColor, int toColor, ImageView iv) {
- final float fromAlpha = Color.alpha(fromColor);
- final float toAlpha = Color.alpha(toColor);
- final float fromChannel = Color.red(fromColor);
- final float toChannel = Color.red(toColor);
-
- ValueAnimator anim = ValueAnimator.ofFloat(0, 1);
- anim.setDuration(QS_ANIM_LENGTH);
-
- anim.addUpdateListener(animation -> {
- float fraction = animation.getAnimatedFraction();
- int alpha = (int) (fromAlpha + (toAlpha - fromAlpha) * fraction);
- int channel = (int) (fromChannel + (toChannel - fromChannel) * fraction);
-
- setTint(iv, Color.argb(alpha, channel, channel, channel));
- });
- anim.start();
+ if (ValueAnimator.areAnimatorsEnabled()) {
+ final float fromAlpha = Color.alpha(fromColor);
+ final float toAlpha = Color.alpha(toColor);
+ final float fromChannel = Color.red(fromColor);
+ final float toChannel = Color.red(toColor);
+
+ ValueAnimator anim = ValueAnimator.ofFloat(0, 1);
+ anim.setDuration(QS_ANIM_LENGTH);
+ anim.addUpdateListener(animation -> {
+ float fraction = animation.getAnimatedFraction();
+ int alpha = (int) (fromAlpha + (toAlpha - fromAlpha) * fraction);
+ int channel = (int) (fromChannel + (toChannel - fromChannel) * fraction);
+
+ setTint(iv, Color.argb(alpha, channel, channel, channel));
+ });
+
+ anim.start();
+ } else {
+ setTint(iv, toColor);
+ }
}
public static void setTint(ImageView iv, int color) {