diff options
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index a3f14ba28dcb..24148c9700d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -39,6 +39,11 @@ public class KeyguardClockPositionAlgorithm { private static float CLOCK_HEIGHT_WEIGHT = 0.7f; /** + * Allow using the default clock Y calculations + */ + public static int CLOCK_USE_DEFAULT_Y = -1; + + /** * Margin between the bottom of the clock and the notification shade. */ private int mClockNotificationsMargin; @@ -180,12 +185,17 @@ public class KeyguardClockPositionAlgorithm { return mHeight / 2 - mKeyguardStatusHeight - mClockNotificationsMargin; } - private int getPreferredClockY() { - return mClockPreferredY; + private int getPreferredAlternativeClockY(int alternative) { + if (mClockPreferredY != CLOCK_USE_DEFAULT_Y) { + return mClockPreferredY; + } else { + return alternative; + } } private int getExpandedPreferredClockY() { - return (mHasCustomClock && (!mHasVisibleNotifs || mBypassEnabled)) ? getPreferredClockY() + return (mHasCustomClock && (!mHasVisibleNotifs || mBypassEnabled)) + ? getPreferredAlternativeClockY(getExpandedClockPosition()) : getExpandedClockPosition(); } @@ -215,8 +225,8 @@ public class KeyguardClockPositionAlgorithm { private int getClockY(float panelExpansion) { // Dark: Align the bottom edge of the clock at about half of the screen: - float clockYDark = (mHasCustomClock ? getPreferredClockY() : getMaxClockY()) - + burnInPreventionOffsetY(); + float clockYDark = (mHasCustomClock ? getPreferredAlternativeClockY(getMaxClockY()) + : getMaxClockY()) + burnInPreventionOffsetY(); clockYDark = MathUtils.max(0, clockYDark); float clockYRegular = getExpandedPreferredClockY(); |