diff options
author | Adrian Roos <roosa@google.com> | 2015-06-04 18:11:14 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2015-06-10 01:29:12 +0000 |
commit | 2f2bd9a8f845535b6ecbf1b28aecdbd0ff3bbc63 (patch) | |
tree | 5576275499093cbe9cbc96925a6e852e61476db7 /packages/SystemUI/src | |
parent | 9b9947de5dd06e7ae21a30d95b243af043e71b96 (diff) | |
download | frameworks_base-2f2bd9a8f845535b6ecbf1b28aecdbd0ff3bbc63.zip frameworks_base-2f2bd9a8f845535b6ecbf1b28aecdbd0ff3bbc63.tar.gz frameworks_base-2f2bd9a8f845535b6ecbf1b28aecdbd0ff3bbc63.tar.bz2 |
Expand scrim all the way to the right
Fixes a bug where the scrim would not cover
the area occupied by the nav bar which looks weird
when the nav bar is hidden.
Bug: 19582019
Change-Id: I7d96ca46a41ec764984be5fe42d225cb94f53497
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java | 59 |
2 files changed, 56 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 569b918..aa5aba0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -232,6 +232,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, /** Allow some time inbetween the long press for back and recents. */ private static final int LOCK_TO_APP_GESTURE_TOLERENCE = 200; + /** If true, the system is in the half-boot-to-decryption-screen state. + * Prudently disable QS and notifications. */ private static final boolean ONLY_CORE_APPS; static { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 6a8f8ee..7f1fea1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone; import android.app.StatusBarManager; import android.content.Context; +import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff; @@ -50,6 +51,8 @@ public class StatusBarWindowView extends FrameLayout { private NotificationPanelView mNotificationPanel; private View mBrightnessMirror; + private int mRightInset = 0; + PhoneStatusBar mService; private final Paint mTransparentSrcPaint = new Paint(); @@ -63,14 +66,18 @@ public class StatusBarWindowView extends FrameLayout { @Override protected boolean fitSystemWindows(Rect insets) { if (getFitsSystemWindows()) { - boolean changed = insets.left != getPaddingLeft() + boolean paddingChanged = insets.left != getPaddingLeft() || insets.top != getPaddingTop() - || insets.right != getPaddingRight() || insets.bottom != getPaddingBottom(); - // Drop top inset, apply right and left inset and pass through bottom inset. - if (changed) { - setPadding(insets.left, 0, insets.right, 0); + // Super-special right inset handling, because scrims and backdrop need to ignore it. + if (insets.right != mRightInset) { + mRightInset = insets.right; + applyMargins(); + } + // Drop top inset, apply left inset and pass through bottom inset. + if (paddingChanged) { + setPadding(insets.left, 0, 0, 0); } insets.left = 0; insets.top = 0; @@ -88,6 +95,30 @@ public class StatusBarWindowView extends FrameLayout { return false; } + private void applyMargins() { + final int N = getChildCount(); + for (int i = 0; i < N; i++) { + View child = getChildAt(i); + if (child.getLayoutParams() instanceof LayoutParams) { + LayoutParams lp = (LayoutParams) child.getLayoutParams(); + if (!lp.ignoreRightInset && lp.rightMargin != mRightInset) { + lp.rightMargin = mRightInset; + child.requestLayout(); + } + } + } + } + + @Override + public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) { + return new LayoutParams(getContext(), attrs); + } + + @Override + protected FrameLayout.LayoutParams generateDefaultLayoutParams() { + return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); + } + @Override protected void onAttachedToWindow () { super.onAttachedToWindow(); @@ -244,5 +275,23 @@ public class StatusBarWindowView extends FrameLayout { mStackScrollLayout.cancelExpandHelper(); } } + + public class LayoutParams extends FrameLayout.LayoutParams { + + public boolean ignoreRightInset; + + public LayoutParams(int width, int height) { + super(width, height); + } + + public LayoutParams(Context c, AttributeSet attrs) { + super(c, attrs); + + TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout); + ignoreRightInset = a.getBoolean( + R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false); + a.recycle(); + } + } } |