diff options
author | Timi Rautamäki <timi.rautamaki@gmail.com> | 2021-10-09 16:11:59 +0000 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-01-26 11:42:56 +0800 |
commit | f849a93b2c07beacafc6eb1f939bd606d8e002fb (patch) | |
tree | 1c451487ed1c88d98a7e959f99d564070609fa4b | |
parent | d2531db095330e195fdae4e7371f2d5da2528240 (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.java | 16 |
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; |