Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.text.format.DateFormat; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.android.internal.colorextraction.ColorExtractor; import com.android.keyguard.clock.ClockManager; Loading @@ -30,6 +31,9 @@ import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.ClockPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.NotificationIconContainer; import com.android.systemui.util.ViewController; Loading @@ -51,6 +55,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final ClockManager mClockManager; private final KeyguardSliceViewController mKeyguardSliceViewController; private final NotificationIconAreaController mNotificationIconAreaController; private FrameLayout mNewLockscreenClockFrame; private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; Loading Loading @@ -114,6 +119,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mColorExtractor.addOnColorsChangedListener(mColorsListener); mView.updateColors(getGradientColors()); updateAodIcons(); mNewLockscreenClockFrame = mView.findViewById(R.id.new_lockscreen_clock_view); } @Override Loading Loading @@ -179,6 +185,21 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mView.refresh(); } /** * Update position of the view, with optional animation. Move the slice view and the clock * slightly towards the center in order to prevent burn-in. Y positioning occurs at the * view parent level. */ void updatePosition(int x, AnimationProperties props, boolean animate) { x = Math.abs(x); if (mNewLockscreenClockFrame != null) { PropertyAnimator.setProperty(mNewLockscreenClockFrame, AnimatableProperty.TRANSLATION_X, -x, props, animate); } mKeyguardSliceViewController.updatePosition(x, props, animate); mNotificationIconAreaController.updatePosition(x, props, animate); } /** * Update lockscreen mode that may change clock display. */ Loading packages/SystemUI/src/com/android/keyguard/KeyguardSliceViewController.java +10 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ import com.android.systemui.Dumpable; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardSliceProvider; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.ViewController; Loading Loading @@ -199,6 +202,13 @@ public class KeyguardSliceViewController extends ViewController<KeyguardSliceVie Trace.endSection(); } /** * Update position of the view, with optional animation */ void updatePosition(int x, AnimationProperties props, boolean animate) { PropertyAnimator.setProperty(mView, AnimatableProperty.TRANSLATION_X, x, props, animate); } void showSlice(Slice slice) { Trace.beginSection("KeyguardSliceViewController#showSlice"); if (slice == null) { Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +17 −6 Original line number Diff line number Diff line Loading @@ -186,12 +186,23 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV /** * Update position of the view with an optional animation */ public void updatePosition(int clockTranslationX, int clockTranslationY, boolean animateClock) { PropertyAnimator.setProperty(mView, AnimatableProperty.X, clockTranslationX, CLOCK_ANIMATION_PROPERTIES, animateClock); PropertyAnimator.setProperty(mView, AnimatableProperty.Y, clockTranslationY, CLOCK_ANIMATION_PROPERTIES, animateClock); public void updatePosition(int x, int y, boolean animate) { PropertyAnimator.setProperty(mView, AnimatableProperty.Y, y, CLOCK_ANIMATION_PROPERTIES, animate); if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) { // reset any prior movement PropertyAnimator.setProperty(mView, AnimatableProperty.X, 0, CLOCK_ANIMATION_PROPERTIES, animate); mKeyguardClockSwitchController.updatePosition(x, CLOCK_ANIMATION_PROPERTIES, animate); } else { // reset any prior movement mKeyguardClockSwitchController.updatePosition(0, CLOCK_ANIMATION_PROPERTIES, animate); PropertyAnimator.setProperty(mView, AnimatableProperty.X, x, CLOCK_ANIMATION_PROPERTIES, animate); } } /** Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/AnimatableProperty.java +5 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,7 @@ package com.android.systemui.statusbar.notification; import android.graphics.drawable.Drawable; import android.util.FloatProperty; import android.util.Log; import android.util.Property; import android.view.View; Loading @@ -34,9 +32,14 @@ public abstract class AnimatableProperty { public static final AnimatableProperty X = AnimatableProperty.from(View.X, R.id.x_animator_tag, R.id.x_animator_tag_start_value, R.id.x_animator_tag_end_value); public static final AnimatableProperty Y = AnimatableProperty.from(View.Y, R.id.y_animator_tag, R.id.y_animator_tag_start_value, R.id.y_animator_tag_end_value); public static final AnimatableProperty TRANSLATION_X = AnimatableProperty.from( View.TRANSLATION_X, R.id.x_animator_tag, R.id.x_animator_tag_start_value, R.id.x_animator_tag_end_value); /** * Similar to X, however this doesn't allow for any other modifications other than from this * property. When using X, it's possible that the view is laid out during the animation, Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +1 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,7 @@ public class KeyguardClockPositionAlgorithm { // TODO(b/12836565) - prototyping only adjustment if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) { // This will keep the clock at the top for AOD darkAmount = 0f; return (int) (clockY + burnInPreventionOffsetY() + mEmptyDragAmount); } return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount); Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.text.format.DateFormat; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.android.internal.colorextraction.ColorExtractor; import com.android.keyguard.clock.ClockManager; Loading @@ -30,6 +31,9 @@ import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.ClockPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.NotificationIconContainer; import com.android.systemui.util.ViewController; Loading @@ -51,6 +55,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final ClockManager mClockManager; private final KeyguardSliceViewController mKeyguardSliceViewController; private final NotificationIconAreaController mNotificationIconAreaController; private FrameLayout mNewLockscreenClockFrame; private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; Loading Loading @@ -114,6 +119,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mColorExtractor.addOnColorsChangedListener(mColorsListener); mView.updateColors(getGradientColors()); updateAodIcons(); mNewLockscreenClockFrame = mView.findViewById(R.id.new_lockscreen_clock_view); } @Override Loading Loading @@ -179,6 +185,21 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mView.refresh(); } /** * Update position of the view, with optional animation. Move the slice view and the clock * slightly towards the center in order to prevent burn-in. Y positioning occurs at the * view parent level. */ void updatePosition(int x, AnimationProperties props, boolean animate) { x = Math.abs(x); if (mNewLockscreenClockFrame != null) { PropertyAnimator.setProperty(mNewLockscreenClockFrame, AnimatableProperty.TRANSLATION_X, -x, props, animate); } mKeyguardSliceViewController.updatePosition(x, props, animate); mNotificationIconAreaController.updatePosition(x, props, animate); } /** * Update lockscreen mode that may change clock display. */ Loading
packages/SystemUI/src/com/android/keyguard/KeyguardSliceViewController.java +10 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ import com.android.systemui.Dumpable; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardSliceProvider; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.ViewController; Loading Loading @@ -199,6 +202,13 @@ public class KeyguardSliceViewController extends ViewController<KeyguardSliceVie Trace.endSection(); } /** * Update position of the view, with optional animation */ void updatePosition(int x, AnimationProperties props, boolean animate) { PropertyAnimator.setProperty(mView, AnimatableProperty.TRANSLATION_X, x, props, animate); } void showSlice(Slice slice) { Trace.beginSection("KeyguardSliceViewController#showSlice"); if (slice == null) { Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +17 −6 Original line number Diff line number Diff line Loading @@ -186,12 +186,23 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV /** * Update position of the view with an optional animation */ public void updatePosition(int clockTranslationX, int clockTranslationY, boolean animateClock) { PropertyAnimator.setProperty(mView, AnimatableProperty.X, clockTranslationX, CLOCK_ANIMATION_PROPERTIES, animateClock); PropertyAnimator.setProperty(mView, AnimatableProperty.Y, clockTranslationY, CLOCK_ANIMATION_PROPERTIES, animateClock); public void updatePosition(int x, int y, boolean animate) { PropertyAnimator.setProperty(mView, AnimatableProperty.Y, y, CLOCK_ANIMATION_PROPERTIES, animate); if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) { // reset any prior movement PropertyAnimator.setProperty(mView, AnimatableProperty.X, 0, CLOCK_ANIMATION_PROPERTIES, animate); mKeyguardClockSwitchController.updatePosition(x, CLOCK_ANIMATION_PROPERTIES, animate); } else { // reset any prior movement mKeyguardClockSwitchController.updatePosition(0, CLOCK_ANIMATION_PROPERTIES, animate); PropertyAnimator.setProperty(mView, AnimatableProperty.X, x, CLOCK_ANIMATION_PROPERTIES, animate); } } /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/AnimatableProperty.java +5 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,7 @@ package com.android.systemui.statusbar.notification; import android.graphics.drawable.Drawable; import android.util.FloatProperty; import android.util.Log; import android.util.Property; import android.view.View; Loading @@ -34,9 +32,14 @@ public abstract class AnimatableProperty { public static final AnimatableProperty X = AnimatableProperty.from(View.X, R.id.x_animator_tag, R.id.x_animator_tag_start_value, R.id.x_animator_tag_end_value); public static final AnimatableProperty Y = AnimatableProperty.from(View.Y, R.id.y_animator_tag, R.id.y_animator_tag_start_value, R.id.y_animator_tag_end_value); public static final AnimatableProperty TRANSLATION_X = AnimatableProperty.from( View.TRANSLATION_X, R.id.x_animator_tag, R.id.x_animator_tag_start_value, R.id.x_animator_tag_end_value); /** * Similar to X, however this doesn't allow for any other modifications other than from this * property. When using X, it's possible that the view is laid out during the animation, Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +1 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,7 @@ public class KeyguardClockPositionAlgorithm { // TODO(b/12836565) - prototyping only adjustment if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) { // This will keep the clock at the top for AOD darkAmount = 0f; return (int) (clockY + burnInPreventionOffsetY() + mEmptyDragAmount); } return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount); Loading