diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-03-30 21:00:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-03-30 21:00:06 +0000 |
commit | 6a8ea4fe24dc0116de74a19b3d2a5fe89d0d1736 (patch) | |
tree | c07b1e184690baab4e78daf92613a3b4b0447e2a | |
parent | ea16812ad230d52e81198bc4e278b8fce6561eb4 (diff) | |
parent | 9a6fa0868da39f147816011118b379ec39c2664a (diff) |
Merge "Update QS edit layout." into pi-dev
12 files changed, 116 insertions, 27 deletions
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. --> <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 000000000000..abe1429697ac --- /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 000000000000..ed8f61a97c2a --- /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 000000000000..557cae150303 --- /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 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"> </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 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. --> -<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 ff55f990857a..a2250b1975a3 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 0f07ca45bc7f..84ca657f3da5 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -317,8 +317,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 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<TileRecord> 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); |