From c11df2521eaf1c4f9ba0a202df53fa7b4fef3dba Mon Sep 17 00:00:00 2001 From: Andrew Sapperstein Date: Sun, 19 Jun 2016 19:12:11 -0700 Subject: [PATCH] Add colorSecondary theme attribute. Value is defined only for .Settings themes. Uses new attribute in SystemUI to set the switch bar background in System UI Tuner and the edit UI background in Quick Settings. BUG: 28625050 Change-Id: I840597670fb8826c7e2172c933ff618e52fc9ac1 FIXES: 28625105 FIXES: 29003223 --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + core/res/res/values/attrs.xml | 3 + core/res/res/values/public.xml | 1 + core/res/res/values/themes.xml | 1 + .../res/res/values/themes_device_defaults.xml | 14 +++++ core/res/res/values/themes_material.xml | 9 +++ .../res/drawable/notification_header_bg.xml | 21 ------- .../res/drawable/switchbar_background.xml | 2 +- packages/SystemUI/res/layout/tile_listing.xml | 55 ------------------- packages/SystemUI/res/layout/tuner_qs.xml | 47 ---------------- packages/SystemUI/res/values/colors.xml | 8 --- packages/SystemUI/res/values/styles.xml | 4 +- .../systemui/qs/customize/TileAdapter.java | 16 +++++- 15 files changed, 47 insertions(+), 137 deletions(-) delete mode 100644 packages/SystemUI/res/drawable/notification_header_bg.xml delete mode 100644 packages/SystemUI/res/layout/tile_listing.xml delete mode 100644 packages/SystemUI/res/layout/tuner_qs.xml diff --git a/api/current.txt b/api/current.txt index 1414fab1e464a..0fc8b9b04c41f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -397,6 +397,7 @@ package android { field public static final int colorPressedHighlight = 16843661; // 0x101038d field public static final int colorPrimary = 16843827; // 0x1010433 field public static final int colorPrimaryDark = 16843828; // 0x1010434 + field public static final int colorSecondary = 16844080; // 0x1010530 field public static final int columnCount = 16843639; // 0x1010377 field public static final int columnDelay = 16843215; // 0x10101cf field public static final int columnOrderPreserved = 16843640; // 0x1010378 diff --git a/api/system-current.txt b/api/system-current.txt index cb6ae795f9324..6b895b92f4f8e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -504,6 +504,7 @@ package android { field public static final int colorPressedHighlight = 16843661; // 0x101038d field public static final int colorPrimary = 16843827; // 0x1010433 field public static final int colorPrimaryDark = 16843828; // 0x1010434 + field public static final int colorSecondary = 16844080; // 0x1010530 field public static final int columnCount = 16843639; // 0x1010377 field public static final int columnDelay = 16843215; // 0x10101cf field public static final int columnOrderPreserved = 16843640; // 0x1010378 diff --git a/api/test-current.txt b/api/test-current.txt index 970ec19b1b13b..802480ec41b8c 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -397,6 +397,7 @@ package android { field public static final int colorPressedHighlight = 16843661; // 0x101038d field public static final int colorPrimary = 16843827; // 0x1010433 field public static final int colorPrimaryDark = 16843828; // 0x1010434 + field public static final int colorSecondary = 16844080; // 0x1010530 field public static final int columnCount = 16843639; // 0x1010377 field public static final int columnDelay = 16843215; // 0x10101cf field public static final int columnOrderPreserved = 16843640; // 0x1010378 diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 13e1d00458b2d..77fb4615ab123 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1048,6 +1048,9 @@ i the status bar (via statusBarColor) and navigation bar (via navigationBarColor). --> + + + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index c187d2ca7d880..9ccd39fa893e4 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2741,5 +2741,6 @@ + diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 998eea5ac9ab7..92f049d6e16ce 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -57,6 +57,7 @@ please see themes_device_defaults.xml. @color/legacy_primary_dark @color/legacy_primary + ?attr/colorPrimary @color/legacy_control_activated @color/legacy_control_normal @color/legacy_button_pressed diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml index 9369456bc5c26..5c9402fd1267c 100644 --- a/core/res/res/values/themes_device_defaults.xml +++ b/core/res/res/values/themes_device_defaults.xml @@ -730,13 +730,26 @@ easier. @color/primary_device_default_settings @color/primary_dark_device_default_settings + @color/secondary_device_default_settings @color/accent_device_default_light + + + @@ -744,6 +757,7 @@ easier. @color/primary_device_default_settings @color/primary_dark_device_default_settings + @color/secondary_device_default_settings @color/accent_device_default_light diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index d437032b0405f..35ce9b0498547 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -1305,6 +1305,7 @@ please see themes_device_defaults.xml. diff --git a/packages/SystemUI/res/drawable/notification_header_bg.xml b/packages/SystemUI/res/drawable/notification_header_bg.xml deleted file mode 100644 index 1f46502591ce1..0000000000000 --- a/packages/SystemUI/res/drawable/notification_header_bg.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/switchbar_background.xml b/packages/SystemUI/res/drawable/switchbar_background.xml index fdb6c770bd260..fb59633f3ec3a 100644 --- a/packages/SystemUI/res/drawable/switchbar_background.xml +++ b/packages/SystemUI/res/drawable/switchbar_background.xml @@ -16,6 +16,6 @@ - + diff --git a/packages/SystemUI/res/layout/tile_listing.xml b/packages/SystemUI/res/layout/tile_listing.xml deleted file mode 100644 index 9ab62cafe40b2..0000000000000 --- a/packages/SystemUI/res/layout/tile_listing.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/SystemUI/res/layout/tuner_qs.xml b/packages/SystemUI/res/layout/tuner_qs.xml deleted file mode 100644 index 9a51e0cbfd32b..0000000000000 --- a/packages/SystemUI/res/layout/tuner_qs.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index f7fd368dcb626..d12ef42590dcc 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -30,10 +30,6 @@ #FFFFFFFF #FFFFFFFF #FF404040 - - - #ff37474F - #fff4511e #FFFFFFFF #29ffffff @@ -156,14 +152,10 @@ #4dffffff #ffffffff - #ff37474f - #fff44336 #d9000000 @color/material_grey_600 @color/material_grey_100 - - #455A64 diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index caada1baacd77..e5681ce517f96 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -355,8 +355,8 @@ ?android:attr/colorAccent - diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index f0605020c7d48..5844714143d51 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -19,6 +19,7 @@ import android.app.AlertDialog.Builder; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; +import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.ColorDrawable; import android.os.Handler; @@ -71,6 +72,7 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta private final Handler mHandler = new Handler(); private final List mTiles = new ArrayList<>(); private final ItemTouchHelper mItemTouchHelper; + private final ItemDecoration mDecoration; private final AccessibilityManager mAccessibilityManager; private int mEditIndex; private int mTileDividerIndex; @@ -88,6 +90,7 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta mContext = context; mAccessibilityManager = context.getSystemService(AccessibilityManager.class); mItemTouchHelper = new ItemTouchHelper(mCallbacks); + mDecoration = new TileItemDecoration(context); } public void setHost(QSTileHost host) { @@ -485,9 +488,16 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta } }; - private final ItemDecoration mDecoration = new ItemDecoration() { - // TODO: Move this to resource. - private final ColorDrawable mDrawable = new ColorDrawable(0xff384248); + private class TileItemDecoration extends ItemDecoration { + private final ColorDrawable mDrawable; + + private TileItemDecoration(Context context) { + TypedArray ta = + context.obtainStyledAttributes(new int[]{android.R.attr.colorSecondary}); + mDrawable = new ColorDrawable(ta.getColor(0, 0)); + ta.recycle(); + } + @Override public void onDraw(Canvas c, RecyclerView parent, State state) {