From 5f7750d75c83b13facf57988e1f042ce8af9abd6 Mon Sep 17 00:00:00 2001 From: Andrew Sapperstein Date: Mon, 20 Jun 2016 12:48:22 -0700 Subject: [PATCH] Use colorSecondary for darker bg color. Used for widget headers and a few other places. In order to support pre-API 25, an app-local version of colorSecondary is created and used throughout the app. A new WidgetContainerTheme sets colorSecondary to a canned value. On API 25+, colorSecondary is set to the platform value. Change-Id: Ie0dd66333052b7346eea5d82d1c88417c6a2cd00 Fixes: 28625102 --- res/drawable/quantum_panel_shape_dark.xml | 4 ++-- res/drawable/widgets_row_divider.xml | 2 +- res/layout/widgets_list_row_view.xml | 2 +- res/layout/widgets_view.xml | 2 +- res/values-v25/styles.xml | 24 +++++++++++++++++++++++ res/values/attrs.xml | 3 +++ res/values/colors.xml | 4 +++- res/values/styles.xml | 9 ++++++++- src/com/android/launcher3/IconCache.java | 5 ++++- 9 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 res/values-v25/styles.xml diff --git a/res/drawable/quantum_panel_shape_dark.xml b/res/drawable/quantum_panel_shape_dark.xml index c3821c416c..b299eb8047 100644 --- a/res/drawable/quantum_panel_shape_dark.xml +++ b/res/drawable/quantum_panel_shape_dark.xml @@ -16,7 +16,7 @@ --> - + - \ No newline at end of file + diff --git a/res/drawable/widgets_row_divider.xml b/res/drawable/widgets_row_divider.xml index bb5b6b55bf..2c3c7a2553 100644 --- a/res/drawable/widgets_row_divider.xml +++ b/res/drawable/widgets_row_divider.xml @@ -15,5 +15,5 @@ --> - + diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml index c0219b96fb..4687b38912 100644 --- a/res/layout/widgets_list_row_view.xml +++ b/res/layout/widgets_list_row_view.xml @@ -30,7 +30,7 @@ android:id="@+id/section" android:layout_width="match_parent" android:layout_height="@dimen/widget_section_height" - android:background="@color/quantum_panel_bg_color_dark" + android:background="?attr/colorSecondary" android:drawablePadding="@dimen/widget_section_horizontal_padding" android:ellipsize="end" android:focusable="true" diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml index e9bbd37da7..74f7ca10bc 100644 --- a/res/layout/widgets_view.xml +++ b/res/layout/widgets_view.xml @@ -26,7 +26,7 @@ android:paddingBottom="@dimen/container_bounds_inset" android:descendantFocusability="afterDescendants" launcher:revealBackground="@drawable/quantum_panel_shape_dark" - android:theme="@android:style/Theme.DeviceDefault.Settings"> + android:theme="@style/WidgetContainerTheme"> + + + + + diff --git a/res/values/attrs.xml b/res/values/attrs.xml index ca28ad35fb..21a05c0652 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -82,4 +82,7 @@ + + + diff --git a/res/values/colors.xml b/res/values/colors.xml index 44e77e22b2..1af449c031 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -34,7 +34,6 @@ #FF666666 #FFF5F5F5 - #FF374248 #FFFFFFFF @@ -44,4 +43,7 @@ #FFFFFF #C4C4C4 + + + #FF37474F diff --git a/res/values/styles.xml b/res/values/styles.xml index 0bfd0a041b..8ea772b9f7 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -30,12 +30,19 @@ + + + + - diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java index ac9a8aae5f..1fea6b4dcd 100644 --- a/src/com/android/launcher3/IconCache.java +++ b/src/com/android/launcher3/IconCache.java @@ -26,6 +26,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; +import android.content.res.TypedArray; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; @@ -126,7 +127,9 @@ public class IconCache { mWorkerHandler = new Handler(LauncherModel.getWorkerLooper()); mActivityBgColor = context.getResources().getColor(R.color.quantum_panel_bg_color); - mPackageBgColor = context.getResources().getColor(R.color.quantum_panel_bg_color_dark); + TypedArray ta = context.obtainStyledAttributes(new int[]{R.attr.colorSecondary}); + mPackageBgColor = ta.getColor(0, 0); + ta.recycle(); mLowResOptions = new BitmapFactory.Options(); // Always prefer RGB_565 config for low res. If the bitmap has transparency, it will // automatically be loaded as ALPHA_8888.