Update QS edit layout.
- Update TileLayout to lay out tiles rows in a similar fashion to
LinearLayout.
- Update edit screen layout to show rounded corners, margins, and
ensure that QS tiles line up with the tiles in QS.
- Show QS status bar header above the edit screen.
Change-Id: I6c8d644787bf1875ad0d7ad056e9909dc4919ce4
Fixes: 36076720
Test: visual
diff --git a/packages/SystemUI/res/drawable/qs_customizer_background.xml b/packages/SystemUI/res/drawable/qs_customizer_background.xml
index 12d8016..e15a734 100644
--- a/packages/SystemUI/res/drawable/qs_customizer_background.xml
+++ b/packages/SystemUI/res/drawable/qs_customizer_background.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@color/qs_detail_transition" />
- <item android:drawable="?android:attr/colorPrimary" />
+ <item android:drawable="@drawable/qs_customizer_background_transition" />
+ <item android:drawable="@drawable/qs_customizer_background_primary" />
</transition>
diff --git a/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml b/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml
new file mode 100644
index 0000000..abe1429
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<inset xmlns:android="http://schemas.android.com/apk/res/android">
+ <shape>
+ <solid android:color="?android:attr/colorPrimary"/>
+ <corners android:radius="?android:attr/dialogCornerRadius" />
+ </shape>
+</inset>
diff --git a/packages/SystemUI/res/drawable/qs_customizer_background_transition.xml b/packages/SystemUI/res/drawable/qs_customizer_background_transition.xml
new file mode 100644
index 0000000..ed8f61a
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_customizer_background_transition.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<inset xmlns:android="http://schemas.android.com/apk/res/android">
+ <shape>
+ <solid android:color="@color/qs_detail_transition"/>
+ <corners android:radius="?android:attr/dialogCornerRadius" />
+ </shape>
+</inset>
diff --git a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
new file mode 100644
index 0000000..557cae1
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<inset xmlns:android="http://schemas.android.com/apk/res/android">
+ <shape>
+ <solid android:color="?android:attr/colorSecondary"/>
+ <corners
+ android:topLeftRadius="?android:attr/dialogCornerRadius"
+ android:topRightRadius="?android:attr/dialogCornerRadius" />
+ </shape>
+</inset>
diff --git a/packages/SystemUI/res/layout/qs_customize_divider.xml b/packages/SystemUI/res/layout/qs_customize_divider.xml
index 71ad85b..51febc7 100644
--- a/packages/SystemUI/res/layout/qs_customize_divider.xml
+++ b/packages/SystemUI/res/layout/qs_customize_divider.xml
@@ -20,9 +20,8 @@
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center"
android:paddingTop="20dp"
- android:paddingStart="16dp"
- android:paddingEnd="8dp"
android:paddingBottom="13dp"
android:textAppearance="@android:style/TextAppearance.Material.Body2"
android:textColor="?android:attr/colorAccent"
diff --git a/packages/SystemUI/res/layout/qs_customize_panel.xml b/packages/SystemUI/res/layout/qs_customize_panel.xml
index b3b6a0c..506e6c8 100644
--- a/packages/SystemUI/res/layout/qs_customize_panel.xml
+++ b/packages/SystemUI/res/layout/qs_customize_panel.xml
@@ -22,7 +22,6 @@
android:layout_height="0dp"
android:elevation="4dp"
android:orientation="vertical"
- android:background="@drawable/qs_customizer_background"
android:gravity="center_horizontal">
</com.android.systemui.qs.customize.QSCustomizer>
diff --git a/packages/SystemUI/res/layout/qs_customize_panel_content.xml b/packages/SystemUI/res/layout/qs_customize_panel_content.xml
index 04d0e65..d70a37a 100644
--- a/packages/SystemUI/res/layout/qs_customize_panel_content.xml
+++ b/packages/SystemUI/res/layout/qs_customize_panel_content.xml
@@ -15,24 +15,44 @@
limitations under the License.
-->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
- <Toolbar
- android:id="@*android:id/action_bar"
+<merge xmlns:android="http://schemas.android.com/apk/res/android">->
+ <View
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="28dp"
- android:navigationContentDescription="@*android:string/action_bar_up_description"
- style="?android:attr/toolbarStyle" />
+ android:layout_height="@*android:dimen/quick_qs_offset_height"
+ android:background="@android:color/transparent" />
- <android.support.v7.widget.RecyclerView
- android:id="@android:id/list"
+ <com.android.keyguard.AlphaOptimizedLinearLayout
+ android:id="@+id/customize_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:scrollIndicators="top"
- android:scrollbars="vertical"
- android:importantForAccessibility="no" />
+ android:layout_marginLeft="@dimen/notification_side_paddings"
+ android:layout_marginRight="@dimen/notification_side_paddings"
+ android:orientation="vertical"
+ android:background="@drawable/qs_customizer_background">
+ <Toolbar
+ android:id="@*android:id/action_bar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/qs_customizer_toolbar"
+ android:navigationContentDescription="@*android:string/action_bar_up_description"
+ style="?android:attr/toolbarStyle" />
+
+ <android.support.v7.widget.RecyclerView
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:paddingTop="28dp"
+ android:paddingLeft="@dimen/qs_tile_layout_margin_side"
+ android:paddingRight="@dimen/qs_tile_layout_margin_side"
+ android:paddingBottom="28dp"
+ android:clipToPadding="false"
+ android:scrollIndicators="top"
+ android:scrollbars="vertical"
+ android:scrollbarStyle="outsideOverlay"
+ android:importantForAccessibility="no" />
+ </com.android.keyguard.AlphaOptimizedLinearLayout>
<View
android:id="@+id/nav_bar_background"
diff --git a/packages/SystemUI/res/layout/qs_customize_tile_frame.xml b/packages/SystemUI/res/layout/qs_customize_tile_frame.xml
index ff55f99..a2250b1 100644
--- a/packages/SystemUI/res/layout/qs_customize_tile_frame.xml
+++ b/packages/SystemUI/res/layout/qs_customize_tile_frame.xml
@@ -17,9 +17,8 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
+ android:layout_height="@dimen/qs_tile_height"
android:layout_width="match_parent"
- android:paddingStart="8dp"
- android:paddingEnd="8dp"
- android:paddingTop="8dp"
+ android:layout_marginTop="@dimen/qs_tile_margin_top_bottom"
+ android:layout_marginBottom="@dimen/qs_tile_margin_top_bottom"
android:gravity="center" />
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 91c8724..6873dea 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -313,8 +313,10 @@
<dimen name="pull_span_min">25dp</dimen>
<dimen name="qs_tile_height">106dp</dimen>
+ <dimen name="qs_tile_layout_margin_side">9dp</dimen>
<dimen name="qs_tile_margin_horizontal">18dp</dimen>
<dimen name="qs_tile_margin_vertical">24dp</dimen>
+ <dimen name="qs_tile_margin_top_bottom">12dp</dimen>
<dimen name="qs_tile_margin_top">18dp</dimen>
<dimen name="qs_quick_tile_size">48dp</dimen>
<!-- Width for the spacer, used between QS tiles. -->
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
index 29f3c43..d97cfba 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
@@ -359,7 +359,6 @@
// The customize state changed, so our height changed.
mContainer.updateExpansion();
mQSPanel.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE);
- mHeader.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE);
mFooter.setVisibility(!mQSCustomizer.isCustomizing() ? View.VISIBLE : View.INVISIBLE);
// Let the panel know the position changed and it needs to update where notifications
// and whatnot are.
diff --git a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java
index 1cb89c4..64e7a63 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java
@@ -23,6 +23,7 @@
protected int mCellHeight;
protected int mCellMarginHorizontal;
protected int mCellMarginVertical;
+ protected int mSidePadding;
protected final ArrayList<TileRecord> mRecords = new ArrayList<>();
private int mCellMarginTop;
@@ -80,6 +81,7 @@
mCellMarginHorizontal = res.getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal);
mCellMarginVertical= res.getDimensionPixelSize(R.dimen.qs_tile_margin_vertical);
mCellMarginTop = res.getDimensionPixelSize(R.dimen.qs_tile_margin_top);
+ mSidePadding = res.getDimensionPixelOffset(R.dimen.qs_tile_layout_margin_side);
if (mColumns != columns) {
mColumns = columns;
requestLayout();
@@ -93,7 +95,7 @@
final int numTiles = mRecords.size();
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int numRows = (numTiles + mColumns - 1) / mColumns;
- mCellWidth = (width - (mCellMarginHorizontal * (mColumns + 1))) / mColumns;
+ mCellWidth = (width - mSidePadding * 2 - (mCellMarginHorizontal * mColumns)) / mColumns;
// Measure each QS tile.
View previousView = this;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
index a3d6c6c..4aa83d0 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
@@ -20,6 +20,7 @@
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.res.Configuration;
+import android.graphics.Point;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
@@ -37,6 +38,7 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.QS;
@@ -81,10 +83,9 @@
public QSCustomizer(Context context, AttributeSet attrs) {
super(new ContextThemeWrapper(context, R.style.edit_theme), attrs);
- mClipper = new QSDetailClipper(this);
LayoutInflater.from(getContext()).inflate(R.layout.qs_customize_panel_content, this);
-
+ mClipper = new QSDetailClipper(findViewById(R.id.customize_container));
mToolbar = findViewById(com.android.internal.R.id.action_bar);
TypedValue value = new TypedValue();
mContext.getTheme().resolveAttribute(android.R.attr.homeAsUpIndicator, value, true);
@@ -100,7 +101,10 @@
mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0,
mContext.getString(com.android.internal.R.string.reset));
mToolbar.setTitle(R.string.qs_edit);
-
+ int accentColor = Utils.getColorAttr(context, android.R.attr.colorAccent);
+ mToolbar.setTitleTextColor(accentColor);
+ mToolbar.getNavigationIcon().setTint(accentColor);
+ mToolbar.getOverflowIcon().setTint(accentColor);
mRecyclerView = findViewById(android.R.id.list);
mTileAdapter = new TileAdapter(getContext());
mTileQueryHelper = new TileQueryHelper(context, mTileAdapter);