diff options
author | Adrian Roos <roosa@google.com> | 2015-06-10 01:29:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-10 01:29:56 +0000 |
commit | 5b7793cacf3910a386182a9b78460934d00dfdae (patch) | |
tree | cdced7fe9351ec34a795eb17aee8892839eca34d | |
parent | a1e60f1f45dce19f9dc15b97cbb0821ffeb54d9d (diff) | |
parent | 2f2bd9a8f845535b6ecbf1b28aecdbd0ff3bbc63 (diff) | |
download | frameworks_base-5b7793cacf3910a386182a9b78460934d00dfdae.zip frameworks_base-5b7793cacf3910a386182a9b78460934d00dfdae.tar.gz frameworks_base-5b7793cacf3910a386182a9b78460934d00dfdae.tar.bz2 |
Merge "Expand scrim all the way to the right" into mnc-dev
4 files changed, 68 insertions, 7 deletions
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml index 03b6dca..e42ce66 100644 --- a/packages/SystemUI/res/layout/super_status_bar.xml +++ b/packages/SystemUI/res/layout/super_status_bar.xml @@ -20,6 +20,7 @@ <!-- This is the combined status bar / notification panel window. --> <com.android.systemui.statusbar.phone.StatusBarWindowView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:sysui="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> @@ -29,6 +30,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" + sysui:ignoreRightInset="true" > <ImageView android:id="@+id/backdrop_back" android:layout_width="match_parent" @@ -44,7 +46,9 @@ <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_behind" android:layout_width="match_parent" android:layout_height="match_parent" - android:importantForAccessibility="no" /> + android:importantForAccessibility="no" + sysui:ignoreRightInset="true" + /> <com.android.systemui.statusbar.AlphaOptimizedView android:id="@+id/heads_up_scrim" @@ -89,6 +93,8 @@ <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_in_front" android:layout_width="match_parent" android:layout_height="match_parent" - android:importantForAccessibility="no" /> + android:importantForAccessibility="no" + sysui:ignoreRightInset="true" + /> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index 24f92ef..354b70b 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -82,5 +82,9 @@ <attr name="fillColor" format="integer" /> <attr name="singleToneColor" format="integer" /> </declare-styleable> + + <declare-styleable name="StatusBarWindowView_Layout"> + <attr name="ignoreRightInset" format="boolean" /> + </declare-styleable> </resources> 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 122e78c..a5b18f9 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(); + } + } } |