summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Oder <myself5@carbonrom.org>2020-01-06 14:48:35 +0100
committeralk3pInjection <webmaster@raspii.tech>2021-09-27 21:17:05 +0800
commit17bdae386bcf757d61c59d59281b30527fc95b6c (patch)
tree4c1c887ec86db2f384f85d964f1aa0c10a74562e
parentdeaad8c59c4e9a6cd8d88c8d294b4f79be44e7dd (diff)
[crdroid][11.0] KeyguardClockPositionAlgorithm: Allow forcing default clockY positioning
set clocks preferred Y coordinates to -1 to use default Y handling on custom clocks Change-Id: I4ce8106987e7aa1a5bb3da1865aa86ce99343e09
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java20
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();