summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-02-10 16:52:16 -0800
committerSunny Goyal <sunnygoyal@google.com>2017-02-16 15:24:37 -0800
commit1f3f07d47c29cba3b70bcd15ebb65a077f55a558 (patch)
treed34ba158bcab7f2974d7d7121d14ae914171f0e1
parent9e76f682f3e52afa1f11172564b883c7dfda5063 (diff)
downloadandroid_packages_apps_Trebuchet-1f3f07d47c29cba3b70bcd15ebb65a077f55a558.tar.gz
android_packages_apps_Trebuchet-1f3f07d47c29cba3b70bcd15ebb65a077f55a558.tar.bz2
android_packages_apps_Trebuchet-1f3f07d47c29cba3b70bcd15ebb65a077f55a558.zip
Simplifying some launcher themes
> Replacing some colors with theme attributes > Simplifying styles definition by removing unnecessary inheritance and inlining some definitions Change-Id: Ifa167515cae6a7fd3720f1a52ff9ce11abb4495f
-rw-r--r--AndroidManifest.xml3
-rw-r--r--res/drawable/all_apps_divider.xml2
-rw-r--r--res/drawable/all_apps_search_hint.xml2
-rw-r--r--res/drawable/bg_pill_focused.xml5
-rw-r--r--res/drawable/deep_shortcuts_drag_handle.xml5
-rw-r--r--res/drawable/ic_setting.xml2
-rw-r--r--res/drawable/ic_wallpaper.xml2
-rw-r--r--res/drawable/ic_widget.xml2
-rw-r--r--res/drawable/quantum_panel.xml22
-rw-r--r--res/drawable/quantum_panel_shape.xml22
-rw-r--r--res/layout/all_apps.xml9
-rw-r--r--res/layout/all_apps_button.xml4
-rw-r--r--res/layout/all_apps_empty_search.xml3
-rw-r--r--res/layout/all_apps_icon.xml9
-rw-r--r--res/layout/app_icon.xml4
-rw-r--r--res/layout/deep_shortcut.xml24
-rw-r--r--res/layout/folder_application.xml9
-rw-r--r--res/layout/folder_icon.xml3
-rw-r--r--res/layout/notification_main.xml12
-rw-r--r--res/layout/qsb_default_view.xml6
-rw-r--r--res/layout/user_folder.xml10
-rw-r--r--res/layout/user_folder_icon_normalized.xml10
-rw-r--r--res/values-sw720dp/styles.xml1
-rw-r--r--res/values-v26/styles.xml7
-rw-r--r--res/values/colors.xml12
-rw-r--r--res/values/dimens.xml3
-rw-r--r--res/values/styles.xml95
-rw-r--r--src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java3
-rw-r--r--src/com/android/launcher3/BubbleTextView.java4
-rw-r--r--src/com/android/launcher3/Hotseat.java4
-rw-r--r--src/com/android/launcher3/IconCache.java10
-rw-r--r--src/com/android/launcher3/InfoDropTarget.java3
-rw-r--r--src/com/android/launcher3/PendingAppWidgetHostView.java3
-rw-r--r--src/com/android/launcher3/Utilities.java12
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java4
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java4
-rw-r--r--src/com/android/launcher3/folder/FolderPagedView.java3
-rw-r--r--src/com/android/launcher3/graphics/DrawableFactory.java2
-rw-r--r--src/com/android/launcher3/graphics/IconPalette.java7
-rw-r--r--src/com/android/launcher3/graphics/PreloadIconDrawable.java8
-rw-r--r--src/com/android/launcher3/pageindicators/CaretDrawable.java6
-rw-r--r--src/com/android/launcher3/pageindicators/PageIndicatorDots.java5
-rw-r--r--src/com/android/launcher3/util/Themes.java52
43 files changed, 192 insertions, 226 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6c5990d1b..418b3a373 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -56,6 +56,7 @@
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher_home"
android:label="@string/derived_app_name"
+ android:theme="@style/LauncherTheme"
android:largeHeap="@bool/config_largeHeap"
android:restoreAnyVersion="true"
android:supportsRtl="true" >
@@ -69,7 +70,6 @@
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
- android:theme="@style/LauncherTheme"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="nosensor"
android:configChanges="keyboard|keyboardHidden|navigation"
@@ -90,6 +90,7 @@
<activity
android:name="com.android.launcher3.SettingsActivity"
android:label="@string/settings_button_text"
+ android:theme="@android:style/Theme.DeviceDefault.Settings"
android:autoRemoveFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
diff --git a/res/drawable/all_apps_divider.xml b/res/drawable/all_apps_divider.xml
index 3fe529556..4bd274dd4 100644
--- a/res/drawable/all_apps_divider.xml
+++ b/res/drawable/all_apps_divider.xml
@@ -15,6 +15,6 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="@color/all_apps_divider_color" />
+ <solid android:color="?android:attr/colorControlHighlight" />
<size android:height="1dp" />
</shape> \ No newline at end of file
diff --git a/res/drawable/all_apps_search_hint.xml b/res/drawable/all_apps_search_hint.xml
index 36a0f0373..b2ff7a428 100644
--- a/res/drawable/all_apps_search_hint.xml
+++ b/res/drawable/all_apps_search_hint.xml
@@ -15,6 +15,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="#00FFFFFF" android:state_focused="true" />
+ <item android:color="@android:color/transparent" android:state_focused="true" />
<item android:color="?android:attr/colorAccent"/>
</selector> \ No newline at end of file
diff --git a/res/drawable/bg_pill_focused.xml b/res/drawable/bg_pill_focused.xml
index 37afad037..54075d92c 100644
--- a/res/drawable/bg_pill_focused.xml
+++ b/res/drawable/bg_pill_focused.xml
@@ -16,9 +16,8 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
- <shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <stroke android:color="#616161" android:width="2dp"/>
+ <shape android:shape="rectangle">
+ <stroke android:color="?android:attr/colorControlActivated" android:width="2dp" />
<corners android:radius="@dimen/bg_pill_radius" />
</shape>
</item>
diff --git a/res/drawable/deep_shortcuts_drag_handle.xml b/res/drawable/deep_shortcuts_drag_handle.xml
index 99d2b07a5..82e844d2d 100644
--- a/res/drawable/deep_shortcuts_drag_handle.xml
+++ b/res/drawable/deep_shortcuts_drag_handle.xml
@@ -18,9 +18,10 @@
android:width="@dimen/deep_shortcut_drag_handle_size"
android:height="@dimen/deep_shortcut_drag_handle_size"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/textColorHint" >
<path
android:pathData="M20 9H4v2h16V9zM4 15h16v-2H4v2z"
- android:fillColor="#4D000000"/>
+ android:fillColor="@android:color/white" />
</vector> \ No newline at end of file
diff --git a/res/drawable/ic_setting.xml b/res/drawable/ic_setting.xml
index 8a50c0c78..e89c158c8 100644
--- a/res/drawable/ic_setting.xml
+++ b/res/drawable/ic_setting.xml
@@ -19,6 +19,6 @@ Copyright (C) 2016 The Android Open Source Project
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@color/workspace_icon_text_color"
android:pathData="M38.86 25.95c.08-.64 .14-1.29 .14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3 .49-.84 .24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91 .37-.99 .84l-.75 5.3c-1.22 .51-2.35 1.17-3.38 1.97L9.9 10.1c-.45-.17-.97 0-1.22 .43l-4 6.93c-.25 .43-.14 .97 .24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31 .14 1.95l-4.22 3.31c-.38 .3-.49 .84-.24 1.28l4 6.93c.25 .43 .77 .61 1.22 .43l4.98-2.01c1.03 .79 2.16 1.46 3.38 1.97l.75 5.3c.08 .47 .49 .84 .99 .84h8c.5 0 .91-.37 .99-.84l.75-5.3c1.22-.51 2.35-1.17 3.38-1.97l4.98 2.01c.45 .17 .97 0 1.22-.43l4-6.93c.25-.43 .14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/>
</vector>
diff --git a/res/drawable/ic_wallpaper.xml b/res/drawable/ic_wallpaper.xml
index 7af4b2afc..b7fcfbf55 100644
--- a/res/drawable/ic_wallpaper.xml
+++ b/res/drawable/ic_wallpaper.xml
@@ -19,6 +19,6 @@ Copyright (C) 2016 The Android Open Source Project
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@color/workspace_icon_text_color"
android:pathData="M8 8h14V4H8C5.79 4 4 5.79 4 8v14h4V8zm12 18l-8 10h24l-6-8-4.06 5.42L20 26zm14-9c0-1.66-1.34-3-3-3s-3 1.34-3 3 1.34 3 3 3 3-1.34 3-3zm6-13H26v4h14v14h4V8c0-2.21-1.79-4-4-4zm0 36H26v4h14c2.21 0 4-1.79 4-4V26h-4v14zM8 26H4v14c0 2.21 1.79 4 4 4h14v-4H8V26z"/>
</vector>
diff --git a/res/drawable/ic_widget.xml b/res/drawable/ic_widget.xml
index 3e7bd7b51..97706e36d 100644
--- a/res/drawable/ic_widget.xml
+++ b/res/drawable/ic_widget.xml
@@ -19,6 +19,6 @@ Copyright (C) 2016 The Android Open Source Project
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@color/workspace_icon_text_color"
android:pathData="M26 26v16h16V26H26zM6 42h16V26H6v16zM6 6v16h16V6H6zm27.31-2.63L22 14.69 33.31 26l11.31-11.31L33.31 3.37z"/>
</vector>
diff --git a/res/drawable/quantum_panel.xml b/res/drawable/quantum_panel.xml
deleted file mode 100644
index fda100370..000000000
--- a/res/drawable/quantum_panel.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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"
- android:drawable="@drawable/quantum_panel_shape"
- android:insetBottom="@dimen/quantum_panel_outer_padding"
- android:insetLeft="@dimen/quantum_panel_outer_padding"
- android:insetRight="@dimen/quantum_panel_outer_padding"
- android:insetTop="@dimen/quantum_panel_outer_padding" />
diff --git a/res/drawable/quantum_panel_shape.xml b/res/drawable/quantum_panel_shape.xml
deleted file mode 100644
index 108361576..000000000
--- a/res/drawable/quantum_panel_shape.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <solid android:color="@color/quantum_panel_bg_color" />
- <corners
- android:radius="2dp" />
-</shape> \ No newline at end of file
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml
index 5f5b38b46..d6bdac2f0 100644
--- a/res/layout/all_apps.xml
+++ b/res/layout/all_apps.xml
@@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- launcher:revealBackground="@drawable/quantum_panel_shape">
+ launcher:revealBackground="@drawable/round_rect_primary">
<View
android:id="@+id/reveal_view"
@@ -54,8 +54,7 @@
android:descendantFocusability="afterDescendants"
android:focusable="true"
android:paddingStart="@dimen/container_fastscroll_thumb_max_width"
- android:paddingEnd="@dimen/container_fastscroll_thumb_max_width"
- android:theme="@style/AllAppsOverscroll" />
+ android:paddingEnd="@dimen/container_fastscroll_thumb_max_width" />
<!-- Fast scroller popup -->
<TextView
@@ -87,7 +86,7 @@
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true"
- android:textColor="#4c4c4c"
+ android:textColor="?android:attr/textColorSecondary"
android:hint="@string/all_apps_search_bar_hint"
android:textColorHint="@drawable/all_apps_search_hint"
android:textSize="16sp" />
@@ -95,11 +94,11 @@
</com.android.launcher3.allapps.AllAppsRecyclerViewContainerView>
<View
+ style="@style/AllAppsNavBarProtection"
android:id="@+id/nav_bar_bg"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
- android:background="@color/all_apps_navbar_color"
android:focusable="false"
android:visibility="invisible" />
</com.android.launcher3.allapps.AllAppsContainerView> \ No newline at end of file
diff --git a/res/layout/all_apps_button.xml b/res/layout/all_apps_button.xml
index 68cc10932..4bc780a70 100644
--- a/res/layout/all_apps_button.xml
+++ b/res/layout/all_apps_button.xml
@@ -14,6 +14,4 @@
limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/Icon"
- android:focusable="true" />
+<TextView style="@style/BaseIcon" />
diff --git a/res/layout/all_apps_empty_search.xml b/res/layout/all_apps_empty_search.xml
index e1635d638..463adac0c 100644
--- a/res/layout/all_apps_empty_search.xml
+++ b/res/layout/all_apps_empty_search.xml
@@ -25,7 +25,6 @@
android:paddingRight="16dp"
android:fontFamily="sans-serif-medium"
android:textSize="14sp"
- android:textColor="#212121"
- android:alpha="0.56"
+ android:textColor="?android:attr/textColorTertiary"
android:focusable="false" />
diff --git a/res/layout/all_apps_icon.xml b/res/layout/all_apps_icon.xml
index 3d4bef70c..1e83041d5 100644
--- a/res/layout/all_apps_icon.xml
+++ b/res/layout/all_apps_icon.xml
@@ -16,12 +16,13 @@
<com.android.launcher3.BubbleTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
- style="@style/Icon.AllApps"
+ style="@style/BaseIcon"
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:focusable="true"
launcher:iconDisplay="all_apps"
- launcher:centerVertically="true" />
+ launcher:centerVertically="true"
+ android:paddingLeft="4dp"
+ android:paddingRight="4dp"
+ android:drawablePadding="@dimen/dynamic_grid_icon_drawable_padding" />
diff --git a/res/layout/app_icon.xml b/res/layout/app_icon.xml
index 831cee5b0..fa6eb8910 100644
--- a/res/layout/app_icon.xml
+++ b/res/layout/app_icon.xml
@@ -14,6 +14,4 @@
limitations under the License.
-->
-<com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/Icon"
- android:focusable="true" />
+<com.android.launcher3.BubbleTextView style="@style/BaseIcon.Workspace" />
diff --git a/res/layout/deep_shortcut.xml b/res/layout/deep_shortcut.xml
index 1f67682b8..6c1d4da91 100644
--- a/res/layout/deep_shortcut.xml
+++ b/res/layout/deep_shortcut.xml
@@ -16,18 +16,28 @@
<com.android.launcher3.shortcuts.DeepShortcutView
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/bg_pill_width"
android:layout_height="@dimen/bg_pill_height"
android:elevation="@dimen/deep_shortcuts_elevation"
- android:background="@drawable/bg_white_pill">
+ android:background="@drawable/bg_white_pill" >
-<com.android.launcher3.shortcuts.DeepShortcutTextView
+ <com.android.launcher3.shortcuts.DeepShortcutTextView
+ style="@style/BaseIcon"
android:id="@+id/deep_shortcut"
- style="@style/Icon.DeepShortcut"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:focusable="true"
- android:background="@drawable/bg_pill_focused" />
+ android:background="@drawable/bg_pill_focused"
+ android:gravity="start|center_vertical"
+ android:textAlignment="viewStart"
+ android:paddingStart="@dimen/bg_pill_height"
+ android:paddingEnd="@dimen/deep_shortcut_padding_end"
+ android:drawableEnd="@drawable/deep_shortcuts_drag_handle"
+ android:drawablePadding="@dimen/deep_shortcut_drawable_padding"
+ android:textSize="14sp"
+ android:fontFamily="sans-serif"
+ launcher:layoutHorizontal="true"
+ launcher:iconDisplay="shortcut_popup"
+ launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size"
+ android:elevation="@dimen/deep_shortcuts_elevation" />
<View
android:id="@+id/popup_item_icon"
diff --git a/res/layout/folder_application.xml b/res/layout/folder_application.xml
index 4d003313e..de861a0ad 100644
--- a/res/layout/folder_application.xml
+++ b/res/layout/folder_application.xml
@@ -14,6 +14,9 @@
limitations under the License.
-->
-<com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/Icon.Folder"
- android:focusable="true" />
+<com.android.launcher3.BubbleTextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
+ style="@style/BaseIcon"
+ android:includeFontPadding="false"
+ launcher:iconDisplay="folder" />
diff --git a/res/layout/folder_icon.xml b/res/layout/folder_icon.xml
index 9eb8c9a67..ccc6b01ea 100644
--- a/res/layout/folder_icon.xml
+++ b/res/layout/folder_icon.xml
@@ -21,8 +21,9 @@
android:orientation="vertical"
android:focusable="true" >
<com.android.launcher3.BubbleTextView
- style="@style/Icon"
+ style="@style/BaseIcon.Workspace"
android:id="@+id/folder_icon_name"
+ android:focusable="false"
android:layout_gravity="top"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/res/layout/notification_main.xml b/res/layout/notification_main.xml
index efb74b0f7..84827f114 100644
--- a/res/layout/notification_main.xml
+++ b/res/layout/notification_main.xml
@@ -21,7 +21,6 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:focusable="true"
- android:background="@drawable/bg_pill_focused"
android:elevation="@dimen/notification_elevation" >
<View
@@ -39,13 +38,20 @@
android:gravity="center_vertical">
<TextView
android:id="@+id/title"
- style="@style/Icon.DeepNotification"
+ android:textAlignment="viewStart"
+ android:fontFamily="sans-serif"
+ android:textSize="14sp"
+ android:textColor="?android:attr/textColorSecondary"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/text"
- style="@style/Icon.DeepNotification.SubText"
+ android:paddingEnd="4dp"
+ android:textSize="12sp"
+ android:textAlignment="viewStart"
+ android:fontFamily="sans-serif"
+ android:textColor="?android:attr/textColorTertiary"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
diff --git a/res/layout/qsb_default_view.xml b/res/layout/qsb_default_view.xml
index 82bdea5e8..3075f803f 100644
--- a/res/layout/qsb_default_view.xml
+++ b/res/layout/qsb_default_view.xml
@@ -23,7 +23,7 @@
android:layout_height="48dp"
android:layout_margin="16dp"
android:layout_gravity="center_vertical"
- android:background="@drawable/quantum_panel_shape"
+ android:background="@drawable/round_rect_primary"
android:elevation="2dp"
android:orientation="horizontal">
@@ -35,7 +35,7 @@
android:gravity="center_vertical"
android:paddingStart="16dp"
android:text="@string/abandoned_search"
- android:textColor="@color/quantum_panel_text_color"
+ android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:textAppearanceMedium"
android:clickable="true"
android:background="?android:attr/selectableItemBackground" />
@@ -46,7 +46,7 @@
android:visibility="gone"
android:layout_height="match_parent"
android:src="@drawable/ic_setting"
- android:tint="@color/quantum_panel_text_color"
+ android:tint="?android:attr/textColorSecondary"
android:contentDescription="@string/gadget_setup_text"
android:padding="8dp"
android:background="?android:attr/selectableItemBackground" />
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index da2a861d8..cde654096 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -18,7 +18,7 @@
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/quantum_panel"
+ android:background="@drawable/round_rect_primary"
android:elevation="5dp"
android:orientation="vertical" >
@@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
- android:background="#00000000"
+ android:background="@android:color/transparent"
android:fontFamily="sans-serif-condensed"
android:gravity="center_horizontal"
android:hint="@string/folder_hint_text"
@@ -54,10 +54,10 @@
android:paddingBottom="@dimen/folder_label_padding_bottom"
android:paddingTop="@dimen/folder_label_padding_top"
android:singleLine="true"
- android:textColor="#ff777777"
+ android:textColor="?android:attr/textColorTertiary"
android:includeFontPadding="false"
- android:textColorHighlight="#ffCCCCCC"
- android:textColorHint="#ff808080"
+ android:textColorHighlight="?android:attr/colorControlHighlight"
+ android:textColorHint="?android:attr/textColorHint"
android:textSize="@dimen/folder_label_text_size" />
<com.android.launcher3.pageindicators.PageIndicatorDots
diff --git a/res/layout/user_folder_icon_normalized.xml b/res/layout/user_folder_icon_normalized.xml
index a8af20149..2063f3216 100644
--- a/res/layout/user_folder_icon_normalized.xml
+++ b/res/layout/user_folder_icon_normalized.xml
@@ -18,7 +18,7 @@
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/quantum_panel"
+ android:background="@drawable/round_rect_primary"
android:elevation="5dp"
android:orientation="vertical" >
@@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
- android:background="#00000000"
+ android:background="@android:color/transparent"
android:fontFamily="sans-serif-condensed"
android:textStyle="bold"
android:gravity="center_horizontal"
@@ -55,9 +55,9 @@
android:paddingBottom="@dimen/folder_label_padding_bottom"
android:paddingTop="@dimen/folder_label_padding_top"
android:singleLine="true"
- android:textColor="#EE777777"
- android:textColorHighlight="#ffCCCCCC"
- android:textColorHint="#ff808080"
+ android:textColor="?android:attr/textColorTertiary"
+ android:textColorHighlight="?android:attr/colorControlHighlight"
+ android:textColorHint="?android:attr/textColorHint"
android:textSize="@dimen/folder_label_text_size" />
<com.android.launcher3.pageindicators.PageIndicatorDots
diff --git a/res/values-sw720dp/styles.xml b/res/values-sw720dp/styles.xml
index 674edaabc..de809b105 100644
--- a/res/values-sw720dp/styles.xml
+++ b/res/values-sw720dp/styles.xml
@@ -25,6 +25,7 @@
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionModeOverlay">true</item>
+ <item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
</style>
<!-- Workspace -->
diff --git a/res/values-v26/styles.xml b/res/values-v26/styles.xml
index 6877623d6..cb184094d 100644
--- a/res/values-v26/styles.xml
+++ b/res/values-v26/styles.xml
@@ -21,4 +21,11 @@
<style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
</style>
+
+ <!-- From O and above, we show a dark nav bar in all-apps -->
+ <style name="AllAppsNavBarProtection">
+ <item name="android:alpha">0.6</item>
+ <item name="android:background">?android:attr/colorPrimary</item>
+ </style>
+
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index d166a7925..a02df16e1 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -26,21 +26,11 @@
<color name="focused_background">#80c6c5c5</color>
<color name="workspace_icon_text_color">#FFF</color>
-
<color name="workspace_edge_effect_color">#FFFFFFFF</color>
- <color name="folder_edge_effect_color">#FF757575</color>
- <color name="page_indicator_dot_color">#FFDDDDDD</color>
- <color name="quantum_panel_text_color">#FF666666</color>
- <color name="quantum_panel_bg_color">#FFF5F5F5</color>
+ <color name="default_shadow_color_no_alpha">#FF000000</color>
<color name="outline_color">#FFFFFFFF</color>
- <color name="all_apps_divider_color">#1E000000</color>
- <color name="all_apps_caret_color">#FFFFFFFF</color>
- <color name="all_apps_caret_shadow_color">#22000000</color>
- <color name="all_apps_container_color">#FFF2F2F2</color>
- <color name="all_apps_navbar_color">#28000000</color>
- <color name="all_apps_light_navbar_color">#AAF2F2F2</color>
<color name="spring_loaded_panel_color">#40FFFFFF</color>
<color name="spring_loaded_highlighted_panel_border_color">#FFF</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 70f5b32c7..f5bede909 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -120,9 +120,6 @@
<dimen name="spring_loaded_panel_border">1dp</dimen>
-<!-- Theme -->
- <dimen name="quantum_panel_outer_padding">4dp</dimen>
-
<!-- Folders -->
<!-- The size of the padding on the preview background drawable -->
<dimen name="folder_preview_padding">6dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 879c7d8d6..8a46e839f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -24,11 +24,17 @@
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
+ <item name="android:colorEdgeEffect">#FF757575</item>
</style>
<style name="LauncherTheme" parent="@style/BaseLauncherTheme"></style>
- <style name="Theme" parent="@style/LauncherTheme"></style>
+ <!-- Theme for the widget container. Overridden on API 26. -->
+ <style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
+ <item name="android:colorEdgeEffect">?android:attr/textColorSecondaryInverse</item>
+ <item name="android:textColorPrimary">?android:attr/textColorPrimaryInverse</item>
+ <item name="android:textColorSecondary">?android:attr/textColorSecondaryInverse</item>
+ </style>
<style name="FastScrollerPopup" >
<item name="android:background">@drawable/container_fastscroll_popup_bg</item>
@@ -44,88 +50,35 @@
<item name="android:includeFontPadding">false</item>
</style>
- <!-- Theme for the widget container. Overridden on API 25. -->
- <style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
- <item name="android:colorEdgeEffect">@color/workspace_edge_effect_color</item>
- <item name="android:textColorPrimary">?android:attr/textColorPrimaryInverse</item>
- <item name="android:textColorSecondary">?android:attr/textColorSecondaryInverse</item>
- </style>
-
- <!-- Overscroll effect -->
- <style name="AllAppsOverscroll" parent="@android:style/Theme.DeviceDefault.Light">
- <item name="android:colorEdgeEffect">@color/folder_edge_effect_color</item>
+ <!-- Style for nav bar background in all-apps screen -->
+ <style name="AllAppsNavBarProtection">
+ <item name="android:alpha">?android:attr/spotShadowAlpha</item>
+ <item name="android:background">@color/default_shadow_color_no_alpha</item>
</style>
- <!-- Different icons -->
- <style name="Icon">
+ <!-- Base theme for BubbleTextView and sub classes -->
+ <style name="BaseIcon">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center</item>
+ <item name="android:focusable">true</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">marquee</item>
- <item name="android:textColor">@color/workspace_icon_text_color</item>
- <item name="android:shadowRadius">2.0</item>
- <item name="android:shadowColor">#B0000000</item>
+ <item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:fontFamily">sans-serif-condensed</item>
- </style>
- <style name="Icon.AllApps">
- <item name="android:background">@null</item>
- <item name="android:textColor">@color/quantum_panel_text_color</item>
- <item name="android:drawablePadding">@dimen/dynamic_grid_icon_drawable_padding</item>
+ <!-- No shadows in the base theme -->
<item name="android:shadowRadius">0</item>
- <item name="android:paddingLeft">4dp</item>
- <item name="android:paddingRight">4dp</item>
<item name="customShadows">false</item>
</style>
- <style name="Icon.Folder">
- <item name="android:background">@null</item>
- <item name="android:textColor">@color/quantum_panel_text_color</item>
- <item name="android:shadowRadius">0</item>
- <item name="android:gravity">center_horizontal</item>
- <item name="android:includeFontPadding">false</item>
- <item name="customShadows">false</item>
- <item name="iconDisplay">folder</item>
- </style>
-
- <style name="Icon.DeepShortcut">
- <item name="android:gravity">start|center_vertical</item>
- <item name="android:textAlignment">viewStart</item>
- <item name="android:elevation">@dimen/deep_shortcuts_elevation</item>
- <item name="android:paddingStart">@dimen/bg_pill_height</item>
- <item name="android:paddingEnd">@dimen/deep_shortcut_padding_end</item>
- <item name="android:drawableEnd">@drawable/deep_shortcuts_drag_handle</item>
- <item name="android:drawablePadding">@dimen/deep_shortcut_drawable_padding</item>
- <item name="android:textColor">#FF212121</item>
- <item name="android:textSize">14sp</item>
- <item name="android:fontFamily">sans-serif</item>
- <item name="android:shadowRadius">0</item>
- <item name="customShadows">false</item>
- <item name="layoutHorizontal">true</item>
- <item name="iconDisplay">shortcut_popup</item>
- <item name="iconSizeOverride">@dimen/deep_shortcut_icon_size</item>
- </style>
-
- <style name="Icon.DeepNotification">
- <item name="android:gravity">start</item>
- <item name="android:textAlignment">viewStart</item>
- <item name="android:elevation">@dimen/deep_shortcuts_elevation</item>
- <item name="android:textColor">#FF212121</item>
- <item name="android:textSize">14sp</item>
- <item name="android:fontFamily">sans-serif</item>
- <item name="android:shadowRadius">0</item>
- <item name="customShadows">false</item>
- <item name="layoutHorizontal">true</item>
- <item name="iconDisplay">shortcut_popup</item>
- <item name="iconSizeOverride">@dimen/deep_shortcut_icon_size</item>
- </style>
-
- <style name="Icon.DeepNotification.SubText">
- <item name="android:textColor">#FF757575</item>
- <item name="android:textSize">12sp</item>
- <item name="android:paddingEnd">4dp</item>
+ <!-- Icon displayed on the worksapce -->
+ <style name="BaseIcon.Workspace">
+ <item name="customShadows">true</item>
+ <item name="android:textColor">@color/workspace_icon_text_color</item>
+ <item name="android:shadowRadius">2.0</item>
+ <item name="android:shadowColor">#B0000000</item>
</style>
<!-- Drop targets -->
@@ -133,11 +86,11 @@
<item name="android:drawablePadding">7.5dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
- <item name="android:textColor">#FFFFFFFF</item>
+ <item name="android:textColor">@color/workspace_icon_text_color</item>
<item name="android:textSize">@dimen/drop_target_text_size</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>
- <item name="android:shadowColor">#FF000000</item>
+ <item name="android:shadowColor">@color/default_shadow_color_no_alpha</item>
<item name="android:shadowDx">0.0</item>
<item name="android:shadowDy">1.0</item>
<item name="android:shadowRadius">4.0</item>
diff --git a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
index 4fecc3da5..ba7c3f809 100644
--- a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
+++ b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
@@ -29,6 +29,7 @@ import android.view.ViewConfiguration;
import android.widget.TextView;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.util.Themes;
/**
* The track and scrollbar that shows when you scroll the list.
@@ -102,7 +103,7 @@ public class BaseRecyclerViewFastScrollBar {
mThumbPaint = new Paint();
mThumbPaint.setAntiAlias(true);
- mThumbPaint.setColor(Utilities.getColorAccent(rv.getContext()));
+ mThumbPaint.setColor(Themes.getColorAccent(rv.getContext()));
mThumbPaint.setStyle(Paint.Style.FILL);
mWidth = mMinWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_min_width);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index bbf2cb8d7..1a41e08db 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -113,7 +113,7 @@ public class BubbleTextView extends TextView
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.BubbleTextView, defStyle, 0);
- mCustomShadowsEnabled = a.getBoolean(R.styleable.BubbleTextView_customShadows, true);
+ mCustomShadowsEnabled = a.getBoolean(R.styleable.BubbleTextView_customShadows, false);
mLayoutHorizontal = a.getBoolean(R.styleable.BubbleTextView_layoutHorizontal, false);
mDeferShadowGenerationOnTouch =
a.getBoolean(R.styleable.BubbleTextView_deferShadowGeneration, false);
@@ -395,7 +395,7 @@ public class BubbleTextView extends TextView
}
// If text is transparent, don't draw any shadow
- if (getCurrentTextColor() == getResources().getColor(android.R.color.transparent)) {
+ if ((getCurrentTextColor() >> 24) == 0) {
getPaint().clearShadowLayer();
super.draw(canvas);
return;
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 4a8a27278..47052a77e 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -25,7 +25,6 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -40,6 +39,7 @@ import com.android.launcher3.dynamicui.ExtractedColors;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
+import com.android.launcher3.util.Themes;
public class Hotseat extends FrameLayout
implements UserEventDispatcher.LogContainerProvider {
@@ -70,7 +70,7 @@ public class Hotseat extends FrameLayout
mLauncher = Launcher.getLauncher(context);
mHasVerticalHotseat = mLauncher.getDeviceProfile().isVerticalBarLayout();
mBackgroundColor = ColorUtils.setAlphaComponent(
- ContextCompat.getColor(context, R.color.all_apps_container_color), 0);
+ Themes.getAttrColor(context, android.R.attr.colorPrimary), 0);
mBackground = new ColorDrawable(mBackgroundColor);
setBackground(mBackground);
}
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index 6e9820cf4..1f473a26f 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -27,7 +27,6 @@ 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;
@@ -45,7 +44,6 @@ import android.os.UserHandle;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
-import android.view.ContextThemeWrapper;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.UserManagerCompat;
@@ -56,6 +54,7 @@ import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.Provider;
import com.android.launcher3.util.SQLiteCacheHelper;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Thunk;
import java.util.Collections;
@@ -132,10 +131,9 @@ public class IconCache {
IconProvider.class, context, R.string.icon_provider_class);
mWorkerHandler = new Handler(LauncherModel.getWorkerLooper());
- mActivityBgColor = context.getResources().getColor(R.color.quantum_panel_bg_color);
- mPackageBgColor = Utilities.getAttrColor(
- new ContextThemeWrapper(context, R.style.WidgetContainerTheme),
- android.R.attr.colorPrimary);
+ mActivityBgColor = Themes.getColorPrimary(context, R.style.LauncherTheme);
+ mPackageBgColor = Themes.getColorPrimary(context, R.style.WidgetContainerTheme);
+
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.
diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java
index d831a3a03..34adf47a1 100644
--- a/src/com/android/launcher3/InfoDropTarget.java
+++ b/src/com/android/launcher3/InfoDropTarget.java
@@ -25,6 +25,7 @@ import android.util.Log;
import android.widget.Toast;
import com.android.launcher3.compat.LauncherAppsCompat;
+import com.android.launcher3.util.Themes;
public class InfoDropTarget extends UninstallDropTarget {
@@ -42,7 +43,7 @@ public class InfoDropTarget extends UninstallDropTarget {
protected void onFinishInflate() {
super.onFinishInflate();
// Get the hover color
- mHoverColor = Utilities.getColorAccent(getContext());
+ mHoverColor = Themes.getColorAccent(getContext());
setDrawable(R.drawable.ic_info_launcher);
}
diff --git a/src/com/android/launcher3/PendingAppWidgetHostView.java b/src/com/android/launcher3/PendingAppWidgetHostView.java
index 815fd101b..43fa4aaf5 100644
--- a/src/com/android/launcher3/PendingAppWidgetHostView.java
+++ b/src/com/android/launcher3/PendingAppWidgetHostView.java
@@ -35,6 +35,7 @@ import android.view.View.OnClickListener;
import com.android.launcher3.IconCache.ItemInfoUpdateReceiver;
import com.android.launcher3.graphics.DrawableFactory;
import com.android.launcher3.model.PackageItemInfo;
+import com.android.launcher3.util.Themes;
public class PendingAppWidgetHostView extends LauncherAppWidgetHostView
implements OnClickListener, ItemInfoUpdateReceiver {
@@ -69,7 +70,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView
mDisabledForSafeMode = disabledForSafeMode;
mPaint = new TextPaint();
- mPaint.setColor(Utilities.getAttrColor(getContext(), android.R.attr.textColorPrimary));
+ mPaint.setColor(Themes.getAttrColor(getContext(), android.R.attr.textColorPrimary));
mPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX,
mLauncher.getDeviceProfile().iconTextSizePx, getResources().getDisplayMetrics()));
setBackgroundResource(R.drawable.round_rect_primary);
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 78774f3b8..abc53673b 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -27,7 +27,6 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
@@ -608,17 +607,6 @@ public final class Utilities {
return c == null || c.isEmpty();
}
- public static int getColorAccent(Context context) {
- return getAttrColor(context, android.R.attr.colorAccent);
- }
-
- public static int getAttrColor(Context context, int attr) {
- TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
- int colorAccent = ta.getColor(0, 0);
- ta.recycle();
- return colorAccent;
- }
-
public static void sendCustomAccessibilityEvent(View target, int type, String text) {
AccessibilityManager accessibilityManager = (AccessibilityManager)
target.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 54d0bbe50..0732004d4 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -464,10 +464,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
setLayoutParams(mlp);
} else {
View navBarBg = findViewById(R.id.nav_bar_bg);
- if (Utilities.isAtLeastO()) {
- navBarBg.setBackgroundColor(getResources().getColor(
- R.color.all_apps_light_navbar_color));
- }
ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams();
navBarBgLp.height = insets.bottom;
navBarBg.setLayoutParams(navBarBgLp);
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 547ab2b34..b436fa263 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -7,7 +7,6 @@ import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.graphics.Color;
-import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.ColorUtils;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.util.Log;
@@ -26,6 +25,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TouchController;
/**
@@ -102,7 +102,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
mProgress = 1f;
mEvaluator = new ArgbEvaluator();
- mAllAppsBackgroundColor = ContextCompat.getColor(l, R.color.all_apps_container_color);
+ mAllAppsBackgroundColor = Themes.getAttrColor(l, android.R.attr.colorPrimary);
}
@Override
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index 4a2a7350b..e5a801c20 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -45,6 +45,7 @@ import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.pageindicators.PageIndicator;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Thunk;
import java.util.ArrayList;
@@ -107,7 +108,7 @@ public class FolderPagedView extends PagedView {
mIsRtl = Utilities.isRtl(getResources());
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
- setEdgeGlowColor(getResources().getColor(R.color.folder_edge_effect_color));
+ setEdgeGlowColor(Themes.getAttrColor(context, android.R.attr.colorEdgeEffect));
mFocusIndicatorHelper = new ViewGroupFocusHelper(this);
}
diff --git a/src/com/android/launcher3/graphics/DrawableFactory.java b/src/com/android/launcher3/graphics/DrawableFactory.java
index 249344792..8b207bb0c 100644
--- a/src/com/android/launcher3/graphics/DrawableFactory.java
+++ b/src/com/android/launcher3/graphics/DrawableFactory.java
@@ -77,7 +77,7 @@ public class DrawableFactory {
if (mPreloadProgressPath == null) {
mPreloadProgressPath = getPreloadProgressPath(context);
}
- return new PreloadIconDrawable(icon, mPreloadProgressPath);
+ return new PreloadIconDrawable(icon, mPreloadProgressPath, context);
}
diff --git a/src/com/android/launcher3/graphics/IconPalette.java b/src/com/android/launcher3/graphics/IconPalette.java
index 7cb69b316..23c6a1230 100644
--- a/src/com/android/launcher3/graphics/IconPalette.java
+++ b/src/com/android/launcher3/graphics/IconPalette.java
@@ -23,6 +23,8 @@ import android.support.v4.graphics.ColorUtils;
import android.util.Log;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.util.Themes;
/**
* Contains colors based on the dominant color of an icon.
@@ -36,7 +38,6 @@ public class IconPalette {
private static final float MIN_PRELOAD_COLOR_SATURATION = 0.2f;
private static final float MIN_PRELOAD_COLOR_LIGHTNESS = 0.6f;
- private static final int DEFAULT_PRELOAD_COLOR = 0xFF009688;
public final int dominantColor;
public final int backgroundColor;
@@ -53,14 +54,14 @@ public class IconPalette {
/**
* Returns a color suitable for the progress bar color of preload icon.
*/
- public int getPreloadProgressColor() {
+ public int getPreloadProgressColor(Context context) {
int result = dominantColor;
// Make sure that the dominant color has enough saturation to be visible properly.
float[] hsv = new float[3];
Color.colorToHSV(result, hsv);
if (hsv[1] < MIN_PRELOAD_COLOR_SATURATION) {
- result = DEFAULT_PRELOAD_COLOR;
+ result = Themes.getColorAccent(context);
} else {
hsv[2] = Math.max(MIN_PRELOAD_COLOR_LIGHTNESS, hsv[2]);
result = Color.HSVToColor(hsv);
diff --git a/src/com/android/launcher3/graphics/PreloadIconDrawable.java b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
index bc07ce1a5..3514a37c4 100644
--- a/src/com/android/launcher3/graphics/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
@@ -20,6 +20,7 @@ package com.android.launcher3.graphics;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
+import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
@@ -75,6 +76,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
private final Matrix mTmpMatrix = new Matrix();
private final PathMeasure mPathMeasure = new PathMeasure();
+ private final Context mContext;
+
// Path in [0, 100] bounds.
private final Path mProgressPath;
@@ -100,8 +103,9 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
/**
* @param progressPath fixed path in the bounds [0, 0, 100, 100] representing a progress bar.
*/
- public PreloadIconDrawable(Bitmap b, Path progressPath) {
+ public PreloadIconDrawable(Bitmap b, Path progressPath, Context context) {
super(b);
+ mContext = context;
mProgressPath = progressPath;
mScaledTrackPath = new Path();
mScaledProgressPath = new Path();
@@ -262,7 +266,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
setIsDisabled(true);
} else if (mIndicatorColor == 0) {
// Update the indicator color
- mIndicatorColor = getIconPalette().getPreloadProgressColor();
+ mIndicatorColor = getIconPalette().getPreloadProgressColor(mContext);
}
if (progress < 1 && progress > 0) {
diff --git a/src/com/android/launcher3/pageindicators/CaretDrawable.java b/src/com/android/launcher3/pageindicators/CaretDrawable.java
index 4789f69f5..0a00e24e9 100644
--- a/src/com/android/launcher3/pageindicators/CaretDrawable.java
+++ b/src/com/android/launcher3/pageindicators/CaretDrawable.java
@@ -24,6 +24,7 @@ import android.graphics.Path;
import android.graphics.PixelFormat;
import com.android.launcher3.R;
+import com.android.launcher3.util.Themes;
import android.graphics.drawable.Drawable;
@@ -45,14 +46,15 @@ public class CaretDrawable extends Drawable {
final int strokeWidth = res.getDimensionPixelSize(R.dimen.all_apps_caret_stroke_width);
final int shadowSpread = res.getDimensionPixelSize(R.dimen.all_apps_caret_shadow_spread);
- mCaretPaint.setColor(res.getColor(R.color.all_apps_caret_color));
+ mCaretPaint.setColor(res.getColor(R.color.workspace_icon_text_color));
mCaretPaint.setAntiAlias(true);
mCaretPaint.setStrokeWidth(strokeWidth);
mCaretPaint.setStyle(Paint.Style.STROKE);
mCaretPaint.setStrokeCap(Paint.Cap.SQUARE);
mCaretPaint.setStrokeJoin(Paint.Join.MITER);
- mShadowPaint.setColor(res.getColor(R.color.all_apps_caret_shadow_color));
+ mShadowPaint.setColor(res.getColor(R.color.default_shadow_color_no_alpha));
+ mShadowPaint.setAlpha(Themes.getAlpha(context, android.R.attr.spotShadowAlpha));
mShadowPaint.setAntiAlias(true);
mShadowPaint.setStrokeWidth(strokeWidth + (shadowSpread * 2));
mShadowPaint.setStyle(Paint.Style.STROKE);
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index 4f5edc94f..6276c80c3 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -37,6 +37,7 @@ import android.view.animation.OvershootInterpolator;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.util.Themes;
/**
* {@link PageIndicator} which shows dots per page. The active page is shown with the current
@@ -111,8 +112,8 @@ public class PageIndicatorDots extends PageIndicator {
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
setOutlineProvider(new MyOutlineProver());
- mActiveColor = Utilities.getColorAccent(context);
- mInActiveColor = getResources().getColor(R.color.page_indicator_dot_color);
+ mActiveColor = Themes.getColorAccent(context);
+ mInActiveColor = Themes.getAttrColor(context, android.R.attr.colorControlHighlight);
mIsRtl = Utilities.isRtl(getResources());
}
diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java
new file mode 100644
index 000000000..acd589e20
--- /dev/null
+++ b/src/com/android/launcher3/util/Themes.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package com.android.launcher3.util;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.view.ContextThemeWrapper;
+
+/**
+ * Various utility methods associated with theming.
+ */
+public class Themes {
+
+ public static int getColorAccent(Context context) {
+ return getAttrColor(context, android.R.attr.colorAccent);
+ }
+
+ public static int getColorPrimary(Context context, int theme) {
+ return getAttrColor(new ContextThemeWrapper(context, theme), android.R.attr.colorPrimary);
+ }
+
+ public static int getAttrColor(Context context, int attr) {
+ TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
+ int colorAccent = ta.getColor(0, 0);
+ ta.recycle();
+ return colorAccent;
+ }
+
+ /**
+ * Returns the alpha corresponding to the theme attribute {@param attr}, in the range [0, 255].
+ */
+ public static int getAlpha(Context context, int attr) {
+ TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
+ float alpha = ta.getFloat(0, 0);
+ ta.recycle();
+ return (int) (255 * alpha + 0.5f);
+ }
+}