summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimi Rautamäki <timi.rautamaki@gmail.com>2021-10-09 16:11:59 +0000
committeralk3pInjection <webmaster@raspii.tech>2022-01-26 11:42:56 +0800
commitf849a93b2c07beacafc6eb1f939bd606d8e002fb (patch)
tree1c451487ed1c88d98a7e959f99d564070609fa4b
parentd2531db095330e195fdae4e7371f2d5da2528240 (diff)
Keyguard: don't use large clock on landscape
Large clock does not display properly on landscape mode. Change-Id: If803ad03568671e8aed2fe37897bd1fb9cee29ae
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index a5b25097a56e..a36a03473e0e 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -5,6 +5,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
@@ -86,6 +87,17 @@ public class KeyguardClockSwitch extends RelativeLayout {
super(context, attrs);
}
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+
+ if (mHasVisibleNotifications != null) {
+ boolean landscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
+ boolean useLargeClock = !mHasVisibleNotifications && !landscape;
+ animateClockChange(useLargeClock);
+ }
+ }
+
/**
* Apply dp changes on font/scale change
*/
@@ -272,7 +284,9 @@ public class KeyguardClockSwitch extends RelativeLayout {
&& hasVisibleNotifications == mHasVisibleNotifications) {
return false;
}
- boolean useLargeClock = !hasVisibleNotifications;
+ boolean landscape = getResources().getConfiguration().orientation
+ == Configuration.ORIENTATION_LANDSCAPE;
+ boolean useLargeClock = !hasVisibleNotifications && !landscape;
animateClockChange(useLargeClock);
mHasVisibleNotifications = hasVisibleNotifications;