Consider the clock detached if the keyguard isn't visible

Update AnimatableClockController's definition of attached to include
whether the keyguard is visible or not. This way, we won't animate
if the view isn't actually visible & we'll reset the clock state when
the keyguard is newly visible.

Only create a new AnimatableClockController onInit instead of
in the onAttach method for KeyguardClockSwitchController.

Fixes: 188203771
Test: manual
Change-Id: Id02132dba8b5392046cb46766aa64fd58e04a4ad
This commit is contained in:
Beverly
2021-05-14 16:03:46 -04:00
parent 66dc0f32ed
commit f18b2894e4
2 changed files with 72 additions and 35 deletions

View File

@@ -124,16 +124,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
@Override
public void onInit() {
mKeyguardSliceViewController.init();
}
@Override
protected void onViewAttached() {
if (CUSTOM_CLOCKS_ENABLED) {
mClockManager.addOnClockChangedListener(mClockChangedListener);
}
mColorExtractor.addOnColorsChangedListener(mColorsListener);
mView.updateColors(getGradientColors());
updateAodIcons();
mClockFrame = mView.findViewById(R.id.lockscreen_clock_view);
mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large);
@@ -157,6 +147,16 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mKeyguardUpdateMonitor,
mBypassController);
mLargeClockViewController.init();
}
@Override
protected void onViewAttached() {
if (CUSTOM_CLOCKS_ENABLED) {
mClockManager.addOnClockChangedListener(mClockChangedListener);
}
mColorExtractor.addOnColorsChangedListener(mColorsListener);
mView.updateColors(getGradientColors());
updateAodIcons();
if (mSmartspaceController.isEnabled()) {
mSmartspaceView = mSmartspaceController.buildAndConnectView(mView);