From 9a6fa0868da39f147816011118b379ec39c2664a Mon Sep 17 00:00:00 2001 From: Amin Shaikh Date: Thu, 29 Mar 2018 17:27:26 -0400 Subject: [PATCH] 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 --- .../res/drawable/qs_customizer_background.xml | 4 +- .../drawable/qs_customizer_background_primary.xml | 21 ++++++++++ .../qs_customizer_background_transition.xml | 21 ++++++++++ .../res/drawable/qs_customizer_toolbar.xml | 23 +++++++++++ .../SystemUI/res/layout/qs_customize_divider.xml | 3 +- .../SystemUI/res/layout/qs_customize_panel.xml | 1 - .../res/layout/qs_customize_panel_content.xml | 46 ++++++++++++++++------ .../res/layout/qs_customize_tile_frame.xml | 7 ++-- packages/SystemUI/res/values/dimens.xml | 2 + .../src/com/android/systemui/qs/QSFragment.java | 1 - .../src/com/android/systemui/qs/TileLayout.java | 4 +- .../systemui/qs/customize/QSCustomizer.java | 10 +++-- 12 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 packages/SystemUI/res/drawable/qs_customizer_background_primary.xml create mode 100644 packages/SystemUI/res/drawable/qs_customizer_background_transition.xml create mode 100644 packages/SystemUI/res/drawable/qs_customizer_toolbar.xml diff --git a/packages/SystemUI/res/drawable/qs_customizer_background.xml b/packages/SystemUI/res/drawable/qs_customizer_background.xml index 12d8016bf6a0..e15a734b0e05 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. --> - - + + 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 000000000000..abe1429697ac --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml @@ -0,0 +1,21 @@ + + + + + + + + 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 000000000000..ed8f61a97c2a --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_customizer_background_transition.xml @@ -0,0 +1,21 @@ + + + + + + + + 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 000000000000..557cae150303 --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/packages/SystemUI/res/layout/qs_customize_divider.xml b/packages/SystemUI/res/layout/qs_customize_divider.xml index 71ad85bf3a96..51febc78e23e 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 b3b6a0c43a98..506e6c856aff 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"> diff --git a/packages/SystemUI/res/layout/qs_customize_panel_content.xml b/packages/SystemUI/res/layout/qs_customize_panel_content.xml index 04d0e6524eac..d70a37ae15b2 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. --> - - - -> + + android:layout_height="@*android:dimen/quick_qs_offset_height" + android:background="@android:color/transparent" /> - + android:layout_marginLeft="@dimen/notification_side_paddings" + android:layout_marginRight="@dimen/notification_side_paddings" + android:orientation="vertical" + android:background="@drawable/qs_customizer_background"> + + + + diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 91c872495c9d..6873deaf11eb 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -313,8 +313,10 @@ 25dp 106dp + 9dp 18dp 24dp + 12dp 18dp 48dp diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index 29f3c43a1fa4..d97cfba6c431 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 @@ public class QSFragment extends Fragment implements QS { // 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 1cb89c472dbb..64e7a6353485 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 @@ public class TileLayout extends ViewGroup implements QSTileLayout { protected int mCellHeight; protected int mCellMarginHorizontal; protected int mCellMarginVertical; + protected int mSidePadding; protected final ArrayList mRecords = new ArrayList<>(); private int mCellMarginTop; @@ -80,6 +81,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout { 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 @@ public class TileLayout extends ViewGroup implements QSTileLayout { 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 a3d6c6cff283..4aa83d0d5f15 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.Animator.AnimatorListener; 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 android.widget.Toolbar.OnMenuItemClickListener; 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 class QSCustomizer extends LinearLayout implements OnMenuItemClickListene 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 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene 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); -- 2.11.0