Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62b63a02 authored by Jason Monk's avatar Jason Monk
Browse files

Rewrite QS customizer

Instead of custom draginess, use RecyclerView with a GridLayoutManager.

Still needs a bit of work, but the overall feel is significantly better
than before.

Change-Id: I3b3927472f69721e265ef7591de2f3052862f392
parent 49d34d99
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2015 The Android Open Source Project
     Copyright (C) 2016 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.
@@ -14,18 +14,16 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.systemui.qs.customize.NonPagedTileLayout

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tiles_container"
    android:id="@android:id/title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <view
        class="com.android.systemui.qs.PagedTileLayout$TilePage"
        android:id="@+id/tile_page"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</com.android.systemui.qs.customize.NonPagedTileLayout>
    android:paddingTop="20dp"
    android:paddingStart="16dp"
    android:paddingEnd="8dp"
    android:paddingBottom="13dp"
    android:textAppearance="@android:style/TextAppearance.Material.Body2"
    android:textColor="?android:attr/colorAccent"
    android:text="@string/drag_to_add_tiles" />
+39 −71
Original line number Diff line number Diff line
@@ -22,85 +22,53 @@
    android:background="@drawable/qs_customizer_background"
    android:gravity="center_horizontal">

    <FrameLayout
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/notification_header_bg">
        android:paddingTop="28dp"
        android:paddingEnd="8dp">

        <LinearLayout
            android:id="@+id/drag_buttons"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal">
            <FrameLayout
        <ImageView
            android:id="@+id/close"
            android:layout_width="56dp"
            android:layout_height="56dp"
            android:padding="16dp"
            android:src="@drawable/ic_close_white" />

        <Space
            android:layout_width="0dp"
                android:layout_height="fill_parent"
                android:layout_weight="1">
                <com.android.systemui.qs.customize.DropButton
                    android:id="@+id/info_button"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <Button
            android:id="@+id/save"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:drawableStart="@drawable/ic_info"
                    android:drawablePadding="10dp"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textColor="@android:color/white"
                    android:text="@string/qs_customize_info" />
            </FrameLayout>
            <FrameLayout
                android:layout_width="0dp"
                android:layout_height="fill_parent"
                android:layout_weight="1">
                <com.android.systemui.qs.customize.DropButton
                    android:id="@+id/remove_button"
            android:paddingStart="12dp"
            android:paddingEnd="12dp"
            android:background="?android:attr/selectableItemBackground"
            android:textAppearance="@android:style/TextAppearance.Material.Widget.Button.Inverse"
            android:textColor="?android:attr/colorAccent"
            android:text="@string/save" />

        <Button
            android:id="@+id/reset"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:drawableStart="@drawable/ic_close_white"
                    android:drawablePadding="10dp"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textColor="@android:color/white"
                    android:text="@string/qs_customize_remove" />
            </FrameLayout>
        </LinearLayout>
            android:paddingStart="12dp"
            android:paddingEnd="12dp"
            android:background="?android:attr/selectableItemBackground"
            android:textAppearance="@android:style/TextAppearance.Material.Widget.Button.Inverse"
            android:textColor="?android:attr/colorAccent"
            android:text="@*android:string/reset" />

        <Toolbar
            android:id="@*android:id/action_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:navigationContentDescription="@*android:string/action_bar_up_description"
            android:background="@drawable/notification_header_bg"
            style="?android:attr/toolbarStyle" />
    </FrameLayout>
    </LinearLayout>

    <com.android.systemui.tuner.AutoScrollView
    <android.support.v7.widget.RecyclerView
        android:id="@android:id/list"
        android:layout_width="@dimen/notification_panel_width"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:paddingTop="12dp"
        android:paddingBottom="8dp"
        android:elevation="2dp">

        <com.android.systemui.qs.customize.CustomQSPanel
            android:id="@+id/quick_settings_panel"
            android:background="#0000"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </com.android.systemui.tuner.AutoScrollView>

    <com.android.systemui.qs.customize.FloatingActionButton
        android:id="@+id/fab"
        android:clickable="true"
        android:layout_width="@dimen/fab_size"
        android:layout_height="@dimen/fab_size"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/fab_margin"
        android:layout_marginBottom="@dimen/fab_margin"
        android:elevation="@dimen/fab_elevation"
        android:background="@drawable/fab_background" />
        android:layout_weight="1" />

    <View
        android:layout_width="match_parent"
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2015 The Android Open Source Project
     Copyright (C) 2016 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.
@@ -19,25 +19,6 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:paddingTop="20dp"
    android:paddingStart="7dp"
    android:paddingEnd="7dp">
    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="80dp"
        android:orientation="vertical">
        <ImageView
            android:id="@+id/tile_icon"
            android:layout_gravity="center"
            android:layout_width="@dimen/qs_tile_icon_size"
            android:layout_height="@dimen/qs_tile_icon_size" />
        <TextView
            android:id="@+id/tile_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center|bottom"
            android:paddingTop="10dp"
            android:gravity="center"
            android:textSize="@dimen/qs_tile_text_size" />
    </LinearLayout>
</FrameLayout>
    android:paddingStart="8dp"
    android:paddingEnd="8dp"
    android:paddingBottom="16dp" />
+3 −0
Original line number Diff line number Diff line
@@ -1400,4 +1400,7 @@
    <!-- SysUI Tuner: Label for preview area in navigation bar tuner [CHAR LIMIT=NONE] -->
    <string name="preview">Preview</string>

    <!-- Label for area where tiles can be dragged out of [CHAR LIMIT=60] -->
    <string name="drag_to_add_tiles">Drag to add tiles</string>

</resources>
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public abstract class QSTile<TState extends State> implements Listenable {

    private String mTileSpec;

    abstract protected TState newTileState();
    public abstract TState newTileState();
    abstract protected void handleClick();
    abstract protected void handleUpdateState(TState state, Object arg);

Loading