diff options
author | Beverly <beverlyt@google.com> | 2020-11-16 14:29:59 -0500 |
---|---|---|
committer | Beverly <beverlyt@google.com> | 2020-11-17 14:20:02 -0500 |
commit | 192b7c9eaabd746ebdedb306a5a93d8740716d22 (patch) | |
tree | 5ec685938a4d1d702c093b0ab8f17390c69f3988 /packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java | |
parent | 06f759835a1d4384b4dfc7fa20b7adb2e9d07828 (diff) |
Add support for LS Clock to use > 1 Paint object
Updated TextInterpolator and TextAnimator to support a
Paint object for each line of text. Now we can interpolate between
the colors when animating.
Clock colors are now based on the theme (for now, wallpaper text
color). ie: first line (of vertical clock) is one color, second line is
another color.
Also adjusted Keyguard clock logic to animate on doze changes instead of
animating incrementally on setDarkAmount.
Test: atest TextInterpolatorTest TextAnimatorTest
Bug: 170228350
Change-Id: Ia62f2de48534be2007afc5a95eac46b3c44ec880
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index 5b89f7f46772..775ebf417a80 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -55,7 +55,12 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final ClockManager mClockManager; private final KeyguardSliceViewController mKeyguardSliceViewController; private final NotificationIconAreaController mNotificationIconAreaController; - private FrameLayout mNewLockscreenClockFrame; + + /** + * Gradient clock for usage when mode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL. + */ + private AnimatableClockController mNewLockScreenClockViewController; + private FrameLayout mNewLockScreenClockFrame; private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; @@ -119,7 +124,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mColorExtractor.addOnColorsChangedListener(mColorsListener); mView.updateColors(getGradientColors()); updateAodIcons(); - mNewLockscreenClockFrame = mView.findViewById(R.id.new_lockscreen_clock_view); + mNewLockScreenClockFrame = mView.findViewById(R.id.new_lockscreen_clock_view); } @Override @@ -182,6 +187,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS * Refresh clock. Called in response to TIME_TICK broadcasts. */ void refresh() { + if (mNewLockScreenClockViewController != null) { + mNewLockScreenClockViewController.refreshTime(); + } + mView.refresh(); } @@ -192,8 +201,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS */ void updatePosition(int x, AnimationProperties props, boolean animate) { x = Math.abs(x); - if (mNewLockscreenClockFrame != null) { - PropertyAnimator.setProperty(mNewLockscreenClockFrame, AnimatableProperty.TRANSLATION_X, + if (mNewLockScreenClockFrame != null) { + PropertyAnimator.setProperty(mNewLockScreenClockFrame, AnimatableProperty.TRANSLATION_X, -x, props, animate); } mKeyguardSliceViewController.updatePosition(x, props, animate); @@ -205,6 +214,17 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS */ void updateLockScreenMode(int mode) { mLockScreenMode = mode; + if (mode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) { + if (mNewLockScreenClockViewController == null) { + mNewLockScreenClockViewController = + new AnimatableClockController( + mView.findViewById(R.id.animatable_clock_view), + mStatusBarStateController); + mNewLockScreenClockViewController.init(); + } + } else { + mNewLockScreenClockViewController = null; + } mView.updateLockScreenMode(mLockScreenMode); updateAodIcons(); } |