summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-17 21:05:24 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-17 21:05:24 +0000
commit88c2867016d1ded7f27fc34ec4d0ed6f9782e8dd (patch)
tree8f61f28994029a4d1c22abebb56ca5bfd1b781ed /packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
parent06ca133bd9f0e275e6ec652d6b00ef471b9a80c8 (diff)
parentd98c705d72ecad9992ed742179bb7766830fe77f (diff)
Snap for 8589293 from d98c705d72ecad9992ed742179bb7766830fe77f to sc-v2-platform-release
Change-Id: I7480354c425fd8808badfd0bc760bdeb05232ad0
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java40
1 files changed, 32 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
index 099dd5d82a10..87e853cf64d7 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
@@ -18,6 +18,7 @@ package com.android.keyguard;
import android.content.Context;
import android.content.res.ColorStateList;
+import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Handler;
@@ -30,6 +31,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.annotation.Nullable;
+
import com.android.internal.policy.SystemBarUtils;
import com.android.settingslib.Utils;
import com.android.systemui.R;
@@ -57,8 +60,14 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
private boolean mBouncerVisible;
private boolean mAltBouncerShowing;
+ /**
+ * Container that wraps the KeyguardMessageArea - may be null if current view hierarchy doesn't
+ * contain {@link R.id.keyguard_message_area_container}.
+ */
+ @Nullable
private ViewGroup mContainer;
- private int mTopMargin;
+ private int mContainerTopMargin;
+ private int mLastOrientation = -1;
public KeyguardMessageArea(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -74,16 +83,31 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
mContainer = getRootView().findViewById(R.id.keyguard_message_area_container);
}
- void onConfigChanged() {
- final int newTopMargin = SystemBarUtils.getStatusBarHeight(getContext());
- if (mTopMargin == newTopMargin) {
+ void onConfigChanged(Configuration newConfig) {
+ if (mContainer == null) {
return;
}
- mTopMargin = newTopMargin;
- ViewGroup.MarginLayoutParams lp =
+ final int newTopMargin = SystemBarUtils.getStatusBarHeight(getContext());
+ if (mContainerTopMargin != newTopMargin) {
+ mContainerTopMargin = newTopMargin;
+ ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) mContainer.getLayoutParams();
- lp.topMargin = mTopMargin;
- mContainer.setLayoutParams(lp);
+ lp.topMargin = mContainerTopMargin;
+ mContainer.setLayoutParams(lp);
+ }
+
+ if (mLastOrientation != newConfig.orientation) {
+ mLastOrientation = newConfig.orientation;
+ int messageAreaTopMargin = 0;
+ if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
+ messageAreaTopMargin = mContext.getResources().getDimensionPixelSize(
+ R.dimen.keyguard_lock_padding);
+ }
+
+ ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) getLayoutParams();
+ lp.topMargin = messageAreaTopMargin;
+ setLayoutParams(lp);
+ }
}
@Override