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
This commit is contained in:
Evan Laird
2018-01-18 16:05:30 -05:00
parent 058c8aee39
commit 39254d469d
14 changed files with 128 additions and 45 deletions

View File

@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.87"
<item android:alpha="1"
android:color="?android:attr/colorBackgroundFloating"/>
</selector>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:startColor="#ff000000"
android:endColor="#00000000"
android:type="linear" />
</shape>

View File

@@ -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">

View File

@@ -23,7 +23,8 @@
android:clickable="true"
android:orientation="vertical"
android:paddingBottom="8dp"
android:visibility="invisible">
android:visibility="invisible"
android:elevation="4dp" >
<include
android:id="@+id/qs_detail_header"

View File

@@ -21,6 +21,7 @@
android:id="@+id/qs_footer"
android:layout_width="match_parent"
android:layout_height="48dp"
android:elevation="4dp"
android:baselineAligned="false"
android:clickable="false"
android:clipChildren="false"
@@ -105,17 +106,6 @@
android:visibility="invisible"/>
</com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
<com.android.systemui.statusbar.phone.ExpandableIndicator
android:id="@+id/expand_indicator"
android:layout_width="48dp"
android:layout_height="48dp"
android:clipToPadding="false"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/accessibility_quick_settings_expand"
android:padding="14dp" />
</LinearLayout>
</com.android.systemui.qs.QSFooterImpl>

View File

@@ -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" >
<!-- Main QS background -->
<View
android:id="@+id/quick_settings_background"
android:layout_width="match_parent"
android:layout_height="0dp"
android:elevation="4dp"
android:background="@drawable/qs_background_primary" />
<!-- Black part behind the status bar -->
<View
android:id="@+id/quick_settings_status_bar_background"
android:layout_width="match_parent"
android:layout_height="@dimen/qs_header_system_icons_area_height"
android:clipToPadding="false"
android:clipChildren="false"
android:background="#ff000000" />
<!-- Gradient view behind QS -->
<View
android:id="@+id/quick_settings_gradient_view"
android:layout_width="match_parent"
android:layout_height="126dp"
android:layout_marginTop="@dimen/qs_header_system_icons_area_height"
android:clipToPadding="false"
android:clipChildren="false"
android:background="@drawable/qs_bg_gradient" />
<com.android.systemui.qs.QSPanel
android:id="@+id/quick_settings_panel"
android:layout_marginTop="28dp"
android:layout_marginTop="@dimen/qs_header_system_icons_area_height"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="48dp" />
android:layout_marginBottom="48dp"
android:elevation="4dp"
/>
<include layout="@layout/quick_status_bar_expanded_header" />

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<View
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/quick_qs_status_icons"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginBottom="22dp"
android:layout_below="@id/quick_status_bar_system_icons"
>
</View>

View File

@@ -28,23 +28,21 @@
android:clipToPadding="false"
android:paddingTop="0dp"
android:paddingEnd="0dp"
android:paddingStart="0dp">
android:paddingStart="0dp"
android:elevation="4dp" >
<include layout="@layout/quick_status_bar_header_system_icons" />
<include layout="@layout/quick_qs_status_icons" />
<com.android.systemui.qs.QuickQSPanel
android:id="@+id/quick_qs_panel"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="31dp"
android:layout_alignParentTop="true"
android:layout_below="@id/quick_qs_status_icons"
android:accessibilityTraversalAfter="@+id/date_time_group"
android:accessibilityTraversalBefore="@id/expand_indicator"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:focusable="true"
android:importantForAccessibility="yes" />

View File

@@ -17,6 +17,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/quick_status_bar_system_icons"
android:layout_width="match_parent"
android:layout_height="@dimen/qs_header_system_icons_area_height"
android:layout_alignParentEnd="true"

View File

@@ -43,8 +43,6 @@
android:layout_width="@dimen/qs_panel_width"
android:layout_height="match_parent"
android:layout_gravity="@integer/notification_panel_layout_gravity"
android:layout_marginStart="@dimen/notification_side_paddings"
android:layout_marginEnd="@dimen/notification_side_paddings"
android:clipToPadding="false"
android:clipChildren="false"
systemui:viewType="com.android.systemui.plugins.qs.QS" />

View File

@@ -215,7 +215,7 @@
<dimen name="close_handle_underlap">32dp</dimen>
<!-- Height of the status bar header bar -->
<dimen name="status_bar_header_height">124dp</dimen>
<dimen name="status_bar_header_height">178dp</dimen>
<!-- Height of the status bar header bar in the car setting. -->
<dimen name="car_status_bar_header_height">128dp</dimen>
@@ -223,8 +223,9 @@
<!-- The bottom padding of the status bar header. -->
<dimen name="status_bar_header_padding_bottom">48dp</dimen>
<!-- The height of the container that holds the system icons in the quick settings header. -->
<dimen name="qs_header_system_icons_area_height">40dp</dimen>
<!-- The height of the container that holds the battery and time in the quick settings header.
-->
<dimen name="qs_header_system_icons_area_height">48dp</dimen>
<!-- The height of the container that holds the system icons in the quick settings header in the
car setting. -->

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -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);