diff options
| author | 2017-05-03 16:15:22 -0700 | |
|---|---|---|
| committer | 2017-05-03 16:15:22 -0700 | |
| commit | c41f8fdf8b51cbd1f7260367285875b01607f5fe (patch) | |
| tree | c9ea7ffaf31d338e9450f564578f08b43afdeb50 | |
| parent | 13e82946387070816b03be4d01e14205dc9992d8 (diff) | |
Animate scrim colors when unlocking
Test: Set different wallpapers on home and lock screen, unlock the phone
Change-Id: Ifba44be747f0ad7b6ed4aec75197746edbbecfd2
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java | 16 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java index d9ac4d58778c..85886683c6e1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java @@ -167,6 +167,10 @@ public class ScrimView extends View implements ConfigurationController.Configura } public void setColors(@NonNull ColorExtractor.GradientColors colors) { + setColors(colors, false); + } + + public void setColors(@NonNull ColorExtractor.GradientColors colors, boolean animated) { if (colors == null) { throw new IllegalArgumentException("Colors cannot be null"); } @@ -174,7 +178,7 @@ public class ScrimView extends View implements ConfigurationController.Configura return; } mColors.set(colors); - updateColorWithTint(); + updateColorWithTint(animated); } @VisibleForTesting @@ -183,14 +187,18 @@ public class ScrimView extends View implements ConfigurationController.Configura } public void setTint(int color) { + setTint(color, false); + } + + public void setTint(int color, boolean animated) { if (mTintColor == color) { return; } mTintColor = color; - updateColorWithTint(); + updateColorWithTint(animated); } - private void updateColorWithTint() { + private void updateColorWithTint(boolean animated) { if (mDrawable instanceof GradientDrawable) { // Optimization to blend colors and avoid a color filter GradientDrawable drawable = (GradientDrawable) mDrawable; @@ -199,7 +207,7 @@ public class ScrimView extends View implements ConfigurationController.Configura tintAmount); int secondaryTinted = ColorUtils.blendARGB(mColors.getSecondaryColor(), mTintColor, tintAmount); - drawable.setColors(mainTinted, secondaryTinted, false); + drawable.setColors(mainTinted, secondaryTinted, animated); } else { if (mColorFilter == null) { mColorFilter = new PorterDuffColorFilter(mTintColor, PorterDuff.Mode.SRC_OVER); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 2be5b8375a38..d29b356dee46 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -277,8 +277,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mScrimInFront.setColors(mLockColors); mScrimBehind.setColors(mLockColors); } else { - mScrimInFront.setColors(mSystemColors); - mScrimBehind.setColors(mSystemColors); + mScrimInFront.setColors(mSystemColors, true); + mScrimBehind.setColors(mSystemColors, true); } } |