summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Sapperstein <asapperstein@google.com>2016-06-20 12:48:22 -0700
committerAndrew Sapperstein <asapperstein@google.com>2016-06-30 14:17:19 -0700
commit5f7750d75c83b13facf57988e1f042ce8af9abd6 (patch)
treeb5ae3fe17a2ce8de81bf56ff33ffeb4d0af17573
parent26def23702881867208bfc465af27a4f9afc26f6 (diff)
downloadandroid_packages_apps_Trebuchet-5f7750d75c83b13facf57988e1f042ce8af9abd6.tar.gz
android_packages_apps_Trebuchet-5f7750d75c83b13facf57988e1f042ce8af9abd6.tar.bz2
android_packages_apps_Trebuchet-5f7750d75c83b13facf57988e1f042ce8af9abd6.zip
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
-rw-r--r--res/drawable/quantum_panel_shape_dark.xml4
-rw-r--r--res/drawable/widgets_row_divider.xml2
-rw-r--r--res/layout/widgets_list_row_view.xml2
-rw-r--r--res/layout/widgets_view.xml2
-rw-r--r--res/values-v25/styles.xml24
-rw-r--r--res/values/attrs.xml3
-rw-r--r--res/values/colors.xml4
-rw-r--r--res/values/styles.xml9
-rw-r--r--src/com/android/launcher3/IconCache.java5
9 files changed, 47 insertions, 8 deletions
diff --git a/res/drawable/quantum_panel_shape_dark.xml b/res/drawable/quantum_panel_shape_dark.xml
index c3821c416..b299eb804 100644
--- a/res/drawable/quantum_panel_shape_dark.xml
+++ b/res/drawable/quantum_panel_shape_dark.xml
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="@color/quantum_panel_bg_color_dark" />
+ <solid android:color="?attr/colorSecondary" />
<corners
android:radius="2dp" />
-</shape> \ No newline at end of file
+</shape>
diff --git a/res/drawable/widgets_row_divider.xml b/res/drawable/widgets_row_divider.xml
index bb5b6b55b..2c3c7a255 100644
--- a/res/drawable/widgets_row_divider.xml
+++ b/res/drawable/widgets_row_divider.xml
@@ -15,5 +15,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="@dimen/widget_row_divider" />
- <solid android:color="@color/quantum_panel_bg_color_dark" />
+ <solid android:color="?attr/colorSecondary" />
</shape>
diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml
index c0219b96f..4687b3891 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 e9bbd37da..74f7ca10b 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">
<View
android:id="@+id/reveal_view"
diff --git a/res/values-v25/styles.xml b/res/values-v25/styles.xml
new file mode 100644
index 000000000..ed670a9d3
--- /dev/null
+++ b/res/values-v25/styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* 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.
+* 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.
+*/
+-->
+<resources>
+ <!-- Theme for the widget container. -->
+ <style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
+ <item name="colorSecondary">?android:attr/colorSecondary</item>
+ </style>
+</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index ca28ad35f..21a05c065 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -82,4 +82,7 @@
<declare-styleable name="ButtonDropTarget">
<attr name="hideParentOnDisable" format="boolean" />
</declare-styleable>
+
+ <!-- Fallback attr for pre-API 25 support -->
+ <attr name="colorSecondary" format="reference|color" />
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 44e77e22b..1af449c03 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -34,7 +34,6 @@
<color name="quantum_panel_text_color">#FF666666</color>
<color name="quantum_panel_bg_color">#FFF5F5F5</color>
- <color name="quantum_panel_bg_color_dark">#FF374248</color>
<color name="outline_color">#FFFFFFFF</color>
@@ -44,4 +43,7 @@
<!-- Widgets view -->
<color name="widgets_view_section_text_color">#FFFFFF</color>
<color name="widgets_view_item_text_color">#C4C4C4</color>
+
+ <!-- Used as a fallback since colorSecondary doesn't exist pre-API 25 -->
+ <color name="fallback_secondary_color">#FF37474F</color>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0bfd0a041..8ea772b9f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -30,12 +30,19 @@
<style name="Theme" parent="@style/LauncherTheme"></style>
+ <!-- Theme for the widget container. Overridden on API 25. -->
+ <style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
+ <item name="colorSecondary">@color/fallback_secondary_color</item>
+ </style>
+
<!-- Overscroll effect -->
+ <style name="CustomOverscroll" />
+
<style name="CustomOverscroll.Light" parent="@android:style/Theme.DeviceDefault.Light">
<item name="android:colorEdgeEffect">@color/folder_edge_effect_color</item>
</style>
- <style name="CustomOverscroll.Dark" parent="@android:style/Theme.DeviceDefault">
+ <style name="CustomOverscroll.Dark">
<item name="android:colorEdgeEffect">@color/workspace_edge_effect_color</item>
</style>
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index ac9a8aae5..1fea6b4dc 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.