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
This commit is contained in:
Beverly
2020-11-16 14:29:59 -05:00
parent 06f759835a
commit 192b7c9eaa
11 changed files with 373 additions and 407 deletions

View File

@@ -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();
}