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
This commit is contained in:
Amin Shaikh
2018-03-29 17:27:26 -04:00
parent 9f75e089ed
commit 9a6fa0868d
12 changed files with 116 additions and 27 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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