From 39254d469df398d6a5eb3d31c7e574fd63182b6e Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Thu, 18 Jan 2018 16:05:30 -0500 Subject: [PATCH] QS visual updates for P - Black status bar area up top - Gradient view behind QQS area - Added stub view for system icon area - Most things are parameterized for qs_header_system_icons_area_height, so this can be moved and overlaid for devices with a notch Test: visual Bug: 70799006 Bug: 63772836 Change-Id: Iee3a975f50d572084de370d1b183a37f5e8e9e1a --- .../SystemUI/res/color/qs_background_dark.xml | 2 +- .../SystemUI/res/drawable/qs_bg_gradient.xml | 24 ++++++++++++ .../res/layout/qs_customize_panel.xml | 1 + packages/SystemUI/res/layout/qs_detail.xml | 3 +- .../SystemUI/res/layout/qs_footer_impl.xml | 12 +----- packages/SystemUI/res/layout/qs_panel.xml | 39 ++++++++++++++++--- .../res/layout/quick_qs_status_icons.xml | 25 ++++++++++++ .../quick_status_bar_expanded_header.xml | 10 ++--- .../quick_status_bar_header_system_icons.xml | 1 + .../res/layout/status_bar_expanded.xml | 2 - packages/SystemUI/res/values/dimens.xml | 7 ++-- .../android/systemui/qs/QSContainerImpl.java | 24 +++++++++++- .../com/android/systemui/qs/QSFooterImpl.java | 14 +++---- .../systemui/qs/QuickStatusBarHeader.java | 9 ++--- 14 files changed, 128 insertions(+), 45 deletions(-) create mode 100644 packages/SystemUI/res/drawable/qs_bg_gradient.xml create mode 100644 packages/SystemUI/res/layout/quick_qs_status_icons.xml diff --git a/packages/SystemUI/res/color/qs_background_dark.xml b/packages/SystemUI/res/color/qs_background_dark.xml index c19fa0803245f..24afebde046b1 100644 --- a/packages/SystemUI/res/color/qs_background_dark.xml +++ b/packages/SystemUI/res/color/qs_background_dark.xml @@ -15,6 +15,6 @@ --> - diff --git a/packages/SystemUI/res/drawable/qs_bg_gradient.xml b/packages/SystemUI/res/drawable/qs_bg_gradient.xml new file mode 100644 index 0000000000000..a1ad52841eb83 --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_bg_gradient.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/packages/SystemUI/res/layout/qs_customize_panel.xml b/packages/SystemUI/res/layout/qs_customize_panel.xml index 9ab8ac6346d3b..b3b6a0c43a988 100644 --- a/packages/SystemUI/res/layout/qs_customize_panel.xml +++ b/packages/SystemUI/res/layout/qs_customize_panel.xml @@ -20,6 +20,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="0dp" + android:elevation="4dp" android:orientation="vertical" android:background="@drawable/qs_customizer_background" android:gravity="center_horizontal"> diff --git a/packages/SystemUI/res/layout/qs_detail.xml b/packages/SystemUI/res/layout/qs_detail.xml index 1fd239b15b303..0b9a7b226105b 100644 --- a/packages/SystemUI/res/layout/qs_detail.xml +++ b/packages/SystemUI/res/layout/qs_detail.xml @@ -23,7 +23,8 @@ android:clickable="true" android:orientation="vertical" android:paddingBottom="8dp" - android:visibility="invisible"> + android:visibility="invisible" + android:elevation="4dp" > - - diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml index 5541f3de8e7c8..5bcb7fd2685ed 100644 --- a/packages/SystemUI/res/layout/qs_panel.xml +++ b/packages/SystemUI/res/layout/qs_panel.xml @@ -18,17 +18,46 @@ android:id="@+id/quick_settings_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/qs_background_primary" - android:elevation="4dp" android:clipToPadding="false" - android:clipChildren="false"> + android:clipChildren="false" > + + + + + + + + + + + android:layout_marginBottom="48dp" + android:elevation="4dp" + /> + diff --git a/packages/SystemUI/res/layout/quick_qs_status_icons.xml b/packages/SystemUI/res/layout/quick_qs_status_icons.xml new file mode 100644 index 0000000000000..e0f0ed994166c --- /dev/null +++ b/packages/SystemUI/res/layout/quick_qs_status_icons.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml index e8b418cd902b2..dacc3f96220b9 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -28,23 +28,21 @@ android:clipToPadding="false" android:paddingTop="0dp" android:paddingEnd="0dp" - android:paddingStart="0dp"> + android:paddingStart="0dp" + android:elevation="4dp" > + diff --git a/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml b/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml index 739a2554e481d..bfe1b6213c550 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml @@ -17,6 +17,7 @@ diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 7a670fd1ae5d4..b711faf396752 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -215,7 +215,7 @@ 32dp - 124dp + 178dp 128dp @@ -223,8 +223,9 @@ 48dp - - 40dp + + 48dp diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 7f0acc254a7cf..7320b861dbd50 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -45,8 +45,9 @@ public class QSContainerImpl extends FrameLayout { protected float mQsExpansion; private QSCustomizer mQSCustomizer; private View mQSFooter; - private float mFullElevation; + private View mBackground; private float mRadius; + private int mSideMargins; public QSContainerImpl(Context context, AttributeSet attrs) { super(context, attrs); @@ -60,12 +61,14 @@ public class QSContainerImpl extends FrameLayout { mHeader = findViewById(R.id.header); mQSCustomizer = findViewById(R.id.qs_customize); mQSFooter = findViewById(R.id.qs_footer); - mFullElevation = mQSPanel.getElevation(); + mBackground = findViewById(R.id.quick_settings_background); mRadius = getResources().getDimensionPixelSize( Utils.getThemeAttr(mContext, android.R.attr.dialogCornerRadius)); + mSideMargins = getResources().getDimensionPixelSize(R.dimen.notification_side_paddings); setClickable(true); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); + setMargins(); } @Override @@ -131,6 +134,8 @@ public class QSContainerImpl extends FrameLayout { mQSDetail.setBottom(getTop() + height); // Pin QS Footer to the bottom of the panel. mQSFooter.setTranslationY(height - mQSFooter.getHeight()); + mBackground.setTop(mQSPanel.getTop()); + mBackground.setBottom(height); ExpandableOutlineView.getRoundedRectPath(0, 0, getWidth(), height, mRadius, mRadius, @@ -148,4 +153,19 @@ public class QSContainerImpl extends FrameLayout { mQsExpansion = expansion; updateExpansion(); } + + private void setMargins() { + setMargins(mQSDetail); + setMargins(mBackground); + setMargins(mQSFooter); + setMargins(mQSPanel); + setMargins(mHeader); + setMargins(mQSCustomizer); + } + + private void setMargins(View view) { + FrameLayout.LayoutParams lp = (LayoutParams) view.getLayoutParams(); + lp.rightMargin = mSideMargins; + lp.leftMargin = mSideMargins; + } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java index 927a49cb60f34..92475da697bda 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java @@ -61,18 +61,16 @@ import com.android.systemui.tuner.TunerService; public class QSFooterImpl extends FrameLayout implements QSFooter, OnClickListener, OnUserInfoChangedListener, EmergencyListener, SignalCallback, CommandQueue.Callbacks { - private static final float EXPAND_INDICATOR_THRESHOLD = .93f; - private ActivityStarter mActivityStarter; private UserInfoController mUserInfoController; private SettingsButton mSettingsButton; protected View mSettingsContainer; + private View mCarrierText; private boolean mQsDisabled; private QSPanel mQsPanel; private boolean mExpanded; - protected ExpandableIndicator mExpandIndicator; private boolean mListening; @@ -100,18 +98,18 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, Dependency.get(ActivityStarter.class).postQSRunnableDismissingKeyguard(() -> mQsPanel.showEdit(view))); - mExpandIndicator = findViewById(R.id.expand_indicator); mSettingsButton = findViewById(R.id.settings_button); mSettingsContainer = findViewById(R.id.settings_button_container); mSettingsButton.setOnClickListener(this); + mCarrierText = findViewById(R.id.qs_carrier_text); + mMultiUserSwitch = findViewById(R.id.multi_user_switch); mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar); // RenderThread is doing more harm than good when touching the header (to expand quick // settings), so disable it for this view ((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true); - ((RippleDrawable) mExpandIndicator.getBackground()).setForceSoftware(true); updateResources(); @@ -162,6 +160,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, return new TouchAnimator.Builder() .addFloat(mEdit, "alpha", 0, 1) .addFloat(mMultiUserSwitch, "alpha", 0, 1) + .addFloat(mCarrierText, "alpha", 0, 1) + .addFloat(mSettingsButton, "alpha", 0, 1) .build(); } @@ -185,8 +185,6 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, if (mSettingsAlpha != null) { mSettingsAlpha.setPosition(headerExpansionFraction); } - - mExpandIndicator.setExpanded(headerExpansionFraction > EXPAND_INDICATOR_THRESHOLD); } @Override @@ -237,8 +235,6 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility( TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE); - mExpandIndicator.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE); - final boolean isDemo = UserManager.isDeviceInDemoMode(mContext); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 398592ad16997..e6fd2f4697ddc 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -38,6 +38,7 @@ import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSDetail.Callback; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.SignalClusterView; +import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue.Callbacks { @@ -69,15 +70,13 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue updateResources(); - // Set the light/dark theming on the header status UI to match the current theme. + // Set light text on the header icons because they will always be on a black background int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground); - float intensity = colorForeground == Color.WHITE ? 0 : 1; Rect tintArea = new Rect(0, 0, 0, 0); - - applyDarkness(R.id.battery, tintArea, intensity, colorForeground); - applyDarkness(R.id.clock, tintArea, intensity, colorForeground); + applyDarkness(R.id.clock, tintArea, 0, DarkIconDispatcher.DEFAULT_ICON_TINT); BatteryMeterView battery = findViewById(R.id.battery); + battery.setFillColor(Color.WHITE); battery.setForceShowPercent(true); mActivityStarter = Dependency.get(ActivityStarter.class);