Merge "Remove hard-coded colors in Wallpaper Picker" into sc-dev
diff --git a/res/color/bottom_nav_item_color.xml b/res/color/bottom_nav_item_color.xml
index bf94de9..d22a759 100644
--- a/res/color/bottom_nav_item_color.xml
+++ b/res/color/bottom_nav_item_color.xml
@@ -20,5 +20,5 @@
android:color="?android:colorAccent" />
<item
android:state_checked="false"
- android:color="@color/bottom_bar_icon_unchecked_color" />
+ android:color="?android:textColorTertiary" />
</selector>
\ No newline at end of file
diff --git a/res/color/edittext_background_color.xml b/res/color/edittext_background_color.xml
index 9191154..5801878 100644
--- a/res/color/edittext_background_color.xml
+++ b/res/color/edittext_background_color.xml
@@ -15,7 +15,11 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:alpha="0.16" android:color="@color/edit_background_base" android:state_hovered="true"/>
- <item android:alpha="0.04" android:color="@color/edit_background_base" android:state_enabled="false"/>
- <item android:alpha="0.05" android:color="@color/edit_background_base"/>
+ <item android:alpha="0.16"
+ android:color="?android:textColorTertiary"
+ android:state_hovered="true"/>
+ <item android:alpha="0.04"
+ android:color="?android:textColorTertiary"
+ android:state_enabled="false"/>
+ <item android:alpha="0.05" android:color="?android:textColorTertiary"/>
</selector>
\ No newline at end of file
diff --git a/res/color/toolbar_icon_color.xml b/res/color/toolbar_icon_color.xml
new file mode 100644
index 0000000..91e56c1
--- /dev/null
+++ b/res/color/toolbar_icon_color.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?android:textColorPrimary"/>
+</selector>
diff --git a/res/drawable/check_circle_grey_large.xml b/res/drawable/check_circle_grey_large.xml
index 16c5d94..cf42bf3 100644
--- a/res/drawable/check_circle_grey_large.xml
+++ b/res/drawable/check_circle_grey_large.xml
@@ -13,12 +13,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<item>
<shape android:shape="oval">
<size android:width="@dimen/center_check_size"
android:height="@dimen/center_check_size" />
- <solid android:color="@color/center_check_color" />
+ <solid android:color="?androidprv:attr/colorAccentPrimaryVariant" />
</shape>
</item>
<item>
diff --git a/res/drawable/ic_home.xml b/res/drawable/ic_home.xml
index c1c8e56..be8f1fe 100644
--- a/res/drawable/ic_home.xml
+++ b/res/drawable/ic_home.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@color/icon_background" />
+ <background android:drawable="?android:colorAccent" />
<foreground>
<inset android:inset="16.6%" android:drawable="@drawable/icon_foreground" />
</foreground>
diff --git a/res/drawable/theme_cover_scrim.xml b/res/drawable/theme_cover_scrim.xml
deleted file mode 100644
index c75213c..0000000
--- a/res/drawable/theme_cover_scrim.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
- Copyright (C) 2019 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">
- <gradient
- android:angle="90"
- android:centerY="25%"
- android:startColor="@color/black_38_alpha"
- android:centerColor="@android:color/transparent"
- android:endColor="@android:color/transparent"
- android:type="linear" />
-</shape>
\ No newline at end of file
diff --git a/res/drawable/tip_dot.xml b/res/drawable/tip_dot.xml
index 3c0f912..aafb9e6 100644
--- a/res/drawable/tip_dot.xml
+++ b/res/drawable/tip_dot.xml
@@ -20,8 +20,8 @@
<size
android:width="@dimen/tip_dot_size"
android:height="@dimen/tip_dot_size" />
- <solid android:color="@color/tip_dot_color" />
+ <solid android:color="?android:colorAccent" />
<stroke
- android:color="@color/tip_dot_line_color"
+ android:color="?android:colorPrimary"
android:width="@dimen/tip_dot_line_width" />
</shape>
diff --git a/res/layout-land/fragment_clock_picker.xml b/res/layout-land/fragment_clock_picker.xml
index e2c5d34..7638e7f 100644
--- a/res/layout-land/fragment_clock_picker.xml
+++ b/res/layout-land/fragment_clock_picker.xml
@@ -38,7 +38,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
- android:background="@color/secondary_color"
+ android:background="?android:colorSecondary"
app:card_style="screen_aspect_ratio"/>
<LinearLayout
diff --git a/res/layout-land/fragment_custom_theme_component.xml b/res/layout-land/fragment_custom_theme_component.xml
index 6883d63..2679bdf 100644
--- a/res/layout-land/fragment_custom_theme_component.xml
+++ b/res/layout-land/fragment_custom_theme_component.xml
@@ -45,7 +45,7 @@
<View
android:layout_width="1dp"
android:layout_height="match_parent"
- android:background="@color/divider_color"/>
+ android:background="?android:colorForeground"/>
<LinearLayout
android:id="@+id/options_section"
android:layout_width="0dp"
diff --git a/res/layout-land/fragment_custom_theme_name.xml b/res/layout-land/fragment_custom_theme_name.xml
index 53cf513..a60b9c2 100644
--- a/res/layout-land/fragment_custom_theme_name.xml
+++ b/res/layout-land/fragment_custom_theme_name.xml
@@ -34,7 +34,7 @@
android:paddingTop="@dimen/preview_content_padding_top"
android:paddingBottom="@dimen/preview_content_padding_bottom"
android:clipToPadding="false"
- android:background="@color/fullscreen_preview_background">
+ android:background="?android:colorSecondary">
<include layout="@layout/theme_preview_card"/>
</FrameLayout>
<LinearLayout
diff --git a/res/layout-land/fragment_grid_picker.xml b/res/layout-land/fragment_grid_picker.xml
index dab9308..2861e7d 100644
--- a/res/layout-land/fragment_grid_picker.xml
+++ b/res/layout-land/fragment_grid_picker.xml
@@ -38,7 +38,7 @@
android:clipToPadding="false"
android:paddingTop="@dimen/preview_content_padding_top"
android:paddingBottom="@dimen/preview_content_padding_bottom"
- android:background="@color/fullscreen_preview_background">
+ android:background="?android:colorSecondary">
<include layout="@layout/grid_preview_card"/>
</FrameLayout>
diff --git a/res/layout-land/fragment_theme_picker.xml b/res/layout-land/fragment_theme_picker.xml
index fe660cf..d358037 100644
--- a/res/layout-land/fragment_theme_picker.xml
+++ b/res/layout-land/fragment_theme_picker.xml
@@ -42,7 +42,7 @@
android:paddingTop="@dimen/preview_content_padding_top"
android:paddingBottom="@dimen/preview_content_padding_bottom"
android:clipToPadding="false"
- android:background="@color/fullscreen_preview_background">
+ android:background="?android:colorSecondary">
<include layout="@layout/theme_preview_card"/>
</FrameLayout>
</FrameLayout>
diff --git a/res/layout/clock_preview_card.xml b/res/layout/clock_preview_card.xml
index 5128dda..46987c7 100644
--- a/res/layout/clock_preview_card.xml
+++ b/res/layout/clock_preview_card.xml
@@ -25,6 +25,6 @@
android:id="@+id/clock_preview_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/clockface_preview_background"/>
+ android:background="@android:color/black"/>
</androidx.cardview.widget.CardView>
\ No newline at end of file
diff --git a/res/layout/fragment_clock_picker.xml b/res/layout/fragment_clock_picker.xml
index 6b9f94c..8ca4863 100644
--- a/res/layout/fragment_clock_picker.xml
+++ b/res/layout/fragment_clock_picker.xml
@@ -36,7 +36,7 @@
android:id="@+id/clock_preview_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/preview_pager_background"
+ android:background="?android:colorSecondary"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toTopOf="@id/options_container"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/res/layout/fragment_custom_theme_component.xml b/res/layout/fragment_custom_theme_component.xml
index 039f781..7bae84b 100644
--- a/res/layout/fragment_custom_theme_component.xml
+++ b/res/layout/fragment_custom_theme_component.xml
@@ -52,7 +52,7 @@
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
- android:background="@color/divider_color"
+ android:background="?android:colorForeground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/component_preview_container"
diff --git a/res/layout/grid_preview_card.xml b/res/layout/grid_preview_card.xml
index 62da6b4..e333ca7 100644
--- a/res/layout/grid_preview_card.xml
+++ b/res/layout/grid_preview_card.xml
@@ -38,4 +38,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="noHideDescendants" />
-</androidx.cardview.widget.CardView>
\ No newline at end of file
+</androidx.cardview.widget.CardView>
diff --git a/res/layout/theme_info_view.xml b/res/layout/theme_info_view.xml
index bae126c..83422ed 100644
--- a/res/layout/theme_info_view.xml
+++ b/res/layout/theme_info_view.xml
@@ -31,7 +31,7 @@
android:gravity="center"
android:lineHeight="24dp"
android:textAppearance="@style/SubtitleTextAppearance"
- android:textColor="@color/action_bar_bottom_sheet_text_color"
+ android:textColor="?android:textColorPrimary"
android:textSize="16sp"
android:text="@string/style_info_description"/>
@@ -57,7 +57,7 @@
android:layout_width="@dimen/theme_info_icon_size"
android:layout_height="@dimen/theme_info_icon_size"
android:layout_marginHorizontal="@dimen/theme_info_margin"
- android:tint="@color/theme_preview_icon_color"/>
+ android:tint="?android:textColorPrimary"/>
<ImageView
android:id="@+id/app_preview_icon"
diff --git a/res/layout/theme_preview_card.xml b/res/layout/theme_preview_card.xml
index e1e3491..4fc8995 100644
--- a/res/layout/theme_preview_card.xml
+++ b/res/layout/theme_preview_card.xml
@@ -27,7 +27,7 @@
android:id="@+id/wallpaper_preview_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/primary_color" />
+ android:background="?android:colorPrimary" />
<SurfaceView
android:id="@+id/wallpaper_preview_surface"
diff --git a/res/layout/theme_preview_color_icons.xml b/res/layout/theme_preview_color_icons.xml
index c8afb99..e87a7a1 100644
--- a/res/layout/theme_preview_color_icons.xml
+++ b/res/layout/theme_preview_color_icons.xml
@@ -28,7 +28,7 @@
android:paddingTop="@dimen/preview_theme_color_icons_padding_top"
android:paddingBottom="@dimen/preview_theme_color_icons_padding_bottom"
android:orientation="vertical"
- android:background="@color/theme_preview_color_icons_background">
+ android:background="?android:colorBackground">
<!-- Title -->
<TextView
@@ -37,7 +37,7 @@
android:layout_height="wrap_content"
android:text="@string/theme_preview_icons_section_title"
android:textSize="@dimen/preview_theme_color_icons_title_text_size"
- android:textColor="@color/theme_preview_color_icons_title_color"
+ android:textColor="?android:textColorSecondary"
android:lineHeight="16dp"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
@@ -68,7 +68,7 @@
android:id="@+id/preview_color_qs_0_icon"
android:layout_width="@dimen/preview_theme_color_icons_tile_size"
android:layout_height="@dimen/preview_theme_color_icons_tile_size"
- android:tint="@color/tile_enabled_icon_color"
+ android:tint="?android:textColorPrimary"
android:layout_gravity="center"/>
</FrameLayout>
<Space
@@ -87,7 +87,7 @@
android:id="@+id/preview_color_qs_1_icon"
android:layout_width="@dimen/preview_theme_color_icons_tile_size"
android:layout_height="@dimen/preview_theme_color_icons_tile_size"
- android:tint="@color/tile_enabled_icon_color"
+ android:tint="?android:textColorPrimary"
android:layout_gravity="center"/>
</FrameLayout>
<Space
@@ -105,7 +105,7 @@
android:id="@+id/preview_color_qs_2_icon"
android:layout_width="@dimen/preview_theme_color_icons_tile_size"
android:layout_height="@dimen/preview_theme_color_icons_tile_size"
- android:tint="@color/tile_enabled_icon_color"
+ android:tint="?android:textColorPrimary"
android:layout_gravity="center"/>
</FrameLayout>
<Space
@@ -123,7 +123,7 @@
android:id="@+id/preview_color_qs_3_icon"
android:layout_width="@dimen/preview_theme_color_icons_tile_size"
android:layout_height="@dimen/preview_theme_color_icons_tile_size"
- android:tint="@color/tile_enabled_icon_color"
+ android:tint="?android:textColorPrimary"
android:layout_gravity="center"/>
</FrameLayout>
</LinearLayout>
diff --git a/res/layout/theme_preview_topbar.xml b/res/layout/theme_preview_topbar.xml
index 15b665d..af69de9 100644
--- a/res/layout/theme_preview_topbar.xml
+++ b/res/layout/theme_preview_topbar.xml
@@ -27,7 +27,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
- android:textColor="@color/icon_thumbnail_color"
+ android:textColor="?android:textColorSecondary"
android:textSize="@dimen/preview_theme_cover_topbar_clock_size"
tools:text="8:10"/>
<LinearLayout
@@ -40,17 +40,17 @@
android:id="@+id/preview_icon_0"
android:layout_width="@dimen/preview_theme_cover_topbar_icon_size"
android:layout_height="@dimen/preview_theme_cover_topbar_icon_size"
- android:tint="@color/icon_thumbnail_color"/>
+ android:tint="?android:textColorSecondary"/>
<ImageView
android:id="@+id/preview_icon_1"
android:layout_width="@dimen/preview_theme_cover_topbar_icon_size"
android:layout_height="@dimen/preview_theme_cover_topbar_icon_size"
android:layout_marginHorizontal="8dp"
- android:tint="@color/icon_thumbnail_color"/>
+ android:tint="?android:textColorSecondary"/>
<ImageView
android:id="@+id/preview_icon_2"
android:layout_width="@dimen/preview_theme_cover_topbar_icon_size"
android:layout_height="@dimen/preview_theme_cover_topbar_icon_size"
- android:tint="@color/icon_thumbnail_color"/>
+ android:tint="?android:textColorSecondary"/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 4f369a7..1c53517 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -36,8 +36,6 @@
<color name="tip_dot_color">#81C995</color>
<color name="tip_dot_line_color">#000000</color>
- <color name="toolbar_icon_color">@color/text_color_light</color>
-
<color name="divider_color">@color/white_14_alpha</color>
<color name="cover_title_color">@color/white_88_alpha</color>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 1f1ee30..df7b65c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -47,8 +47,6 @@
<color name="tip_dot_color">#34A853</color>
<color name="tip_dot_line_color">#FFFFFF</color>
- <color name="toolbar_icon_color">@color/text_color_dark</color>
-
<color name="divider_color">@color/black_14_alpha</color>
<color name="cover_title_color">@color/black_87_alpha</color>
diff --git a/src/com/android/customization/model/grid/GridOption.java b/src/com/android/customization/model/grid/GridOption.java
index 13c2b68..6a61274 100644
--- a/src/com/android/customization/model/grid/GridOption.java
+++ b/src/com/android/customization/model/grid/GridOption.java
@@ -28,9 +28,9 @@
import com.android.customization.model.CustomizationManager;
import com.android.customization.model.CustomizationOption;
-import com.android.customization.util.ResourceUtils;
import com.android.customization.widget.GridTileDrawable;
import com.android.wallpaper.R;
+import com.android.wallpaper.util.ResourceUtils;
/**
* Represents a grid layout option available in the current launcher.
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java
index 4ede59e..3a32f25 100644
--- a/src/com/android/customization/model/theme/ThemeBundle.java
+++ b/src/com/android/customization/model/theme/ThemeBundle.java
@@ -50,6 +50,7 @@
import com.android.wallpaper.asset.Asset;
import com.android.wallpaper.asset.BitmapCachingAsset;
import com.android.wallpaper.model.WallpaperInfo;
+import com.android.wallpaper.util.ResourceUtils;
import org.json.JSONException;
import org.json.JSONObject;
@@ -110,7 +111,8 @@
}
if (!mPreviewInfo.icons.isEmpty()) {
Drawable icon = mPreviewInfo.icons.get(0).getConstantState().newDrawable().mutate();
- icon.setTint(res.getColor(R.color.icon_thumbnail_color, null));
+ icon.setTint(ResourceUtils.getColorAttr(
+ view.getContext(), android.R.attr.textColorSecondary));
((ImageView) view.findViewById(R.id.theme_option_icon)).setImageDrawable(
icon);
}
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index 3db4bad..78be0fc 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -63,6 +63,7 @@
import com.android.customization.model.theme.ThemeBundle.PreviewInfo.ShapeAppIcon;
import com.android.customization.model.theme.custom.CustomTheme.Builder;
import com.android.wallpaper.R;
+import com.android.wallpaper.util.ResourceUtils;
import java.util.ArrayList;
import java.util.HashMap;
@@ -211,7 +212,8 @@
Resources res = view.getContext().getResources();
Drawable icon = mIcons.get(THUMBNAIL_ICON_POSITION)
.getConstantState().newDrawable().mutate();
- icon.setTint(res.getColor(R.color.icon_thumbnail_color, null));
+ icon.setTint(ResourceUtils.getColorAttr(
+ view.getContext(), android.R.attr.textColorSecondary));
((ImageView) view.findViewById(R.id.option_icon)).setImageDrawable(
icon);
view.setContentDescription(mLabel);
@@ -391,7 +393,9 @@
}
Resources res = container.getResources();
@ColorInt int accentColor = resolveColor(res);
- @ColorInt int controlGreyColor = res.getColor(R.color.control_grey);
+ @ColorInt int controlGreyColor = ResourceUtils.getColorAttr(
+ container.getContext(),
+ android.R.attr.textColorTertiary);
ColorStateList tintList = new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_selected},
@@ -422,7 +426,8 @@
// Disable seekbar
seekbar.setOnTouchListener((view, motionEvent) -> true);
- int iconFgColor = res.getColor(R.color.tile_enabled_icon_color, null);
+ int iconFgColor = ResourceUtils.getColorAttr(container.getContext(),
+ android.R.attr.colorBackground);
if (!mIcons.isEmpty() && mShapeDrawable != null) {
for (int i = 0; i < COLOR_TILE_IDS.length; i++) {
Drawable icon = mIcons.get(COLOR_TILES_ICON_IDS[i][1]).getConstantState()
@@ -500,7 +505,8 @@
new int[]{android.R.attr.colorPrimary});
int primaryColor = ta.getColor(0, 0);
ta.recycle();
- int foregroundColor = res.getColor(R.color.shape_option_tile_foreground_color, theme);
+ int foregroundColor =
+ ResourceUtils.getColorAttr(view.getContext(), android.R.attr.textColorPrimary);
foreground.setTint(ColorUtils.blendARGB(primaryColor, foregroundColor, .05f));
diff --git a/src/com/android/customization/picker/WallpaperPreviewer.java b/src/com/android/customization/picker/WallpaperPreviewer.java
index 415ca5b..fa7dd81 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -33,9 +33,9 @@
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
-import com.android.wallpaper.R;
import com.android.wallpaper.model.LiveWallpaperInfo;
import com.android.wallpaper.model.WallpaperInfo;
+import com.android.wallpaper.util.ResourceUtils;
import com.android.wallpaper.util.ScreenSizeCalculator;
import com.android.wallpaper.util.SizeCalculator;
import com.android.wallpaper.util.WallpaperConnection;
@@ -153,13 +153,15 @@
mWallpaper.getThumbAsset(mActivity.getApplicationContext())
.loadPreviewImage(mActivity,
renderInImageWallpaperSurface ? homeImageWallpaper : mHomePreview,
- mActivity.getResources().getColor(R.color.secondary_color));
+ ResourceUtils.getColorAttr(
+ mActivity, android.R.attr.colorSecondary));
if (mWallpaper instanceof LiveWallpaperInfo) {
mWallpaper.getThumbAsset(mActivity.getApplicationContext())
.loadPreviewImage(
mActivity,
homeImageWallpaper,
- mActivity.getColor(R.color.secondary_color));
+ ResourceUtils.getColorAttr(
+ mActivity, android.R.attr.colorSecondary));
setUpLiveWallpaperPreview(mWallpaper);
} else {
// Ensure live wallpaper connection is disconnected.
diff --git a/src/com/android/customization/picker/theme/CustomThemeStepFragment.java b/src/com/android/customization/picker/theme/CustomThemeStepFragment.java
index 50f391d..3f07431 100644
--- a/src/com/android/customization/picker/theme/CustomThemeStepFragment.java
+++ b/src/com/android/customization/picker/theme/CustomThemeStepFragment.java
@@ -68,10 +68,10 @@
} else {
setUpToolbar(view, R.menu.custom_theme_editor_menu);
mToolbar.getMenu().getItem(0).setIconTintList(
- getContext().getColorStateList(R.color.toolbar_icon_color));
+ getContext().getColorStateList(R.color.toolbar_icon_tint));
}
Drawable closeIcon = getResources().getDrawable(R.drawable.ic_close_24px, null).mutate();
- closeIcon.setTintList(getResources().getColorStateList(R.color.toolbar_icon_color, null));
+ closeIcon.setTintList(getResources().getColorStateList(R.color.toolbar_icon_tint, null));
mToolbar.setNavigationIcon(closeIcon);
mToolbar.setNavigationContentDescription(R.string.cancel);
diff --git a/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java b/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java
index 5c775dd..850edf9 100644
--- a/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java
+++ b/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java
@@ -49,6 +49,7 @@
import com.android.customization.model.theme.ThemeBundle.PreviewInfo;
import com.android.customization.model.theme.ThemeBundle.PreviewInfo.ShapeAppIcon;
import com.android.wallpaper.R;
+import com.android.wallpaper.util.ResourceUtils;
import com.android.wallpaper.util.ScreenSizeCalculator;
import com.android.wallpaper.util.TimeUtils;
import com.android.wallpaper.util.TimeUtils.TimeTicker;
@@ -184,11 +185,11 @@
boolean useLightTextColor = colors == null
|| (colors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT) == 0;
int textColor = mContext.getColor(useLightTextColor
- ? R.color.text_color_light
- : R.color.text_color_dark);
+ ? android.R.color.white
+ : android.R.color.black);
int textShadowColor = mContext.getColor(useLightTextColor
- ? R.color.smartspace_preview_shadow_color_dark
- : R.color.smartspace_preview_shadow_color_transparent);
+ ? android.R.color.tertiary_text_dark
+ : android.R.color.transparent);
// Update the top status bar clock text color.
mStatusBarClock.setTextColor(textColor);
// Update the top status bar icon color.
@@ -358,7 +359,8 @@
}
private ColorStateList getColorStateList(int accentColor) {
- int controlGreyColor = mContext.getColor(R.color.control_grey);
+ int controlGreyColor =
+ ResourceUtils.getColorAttr(mContext, android.R.attr.textColorTertiary);
return new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_selected},
diff --git a/src/com/android/customization/util/ResourceUtils.java b/src/com/android/customization/util/ResourceUtils.java
deleted file mode 100644
index d42dca9..0000000
--- a/src/com/android/customization/util/ResourceUtils.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2021 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.customization.util;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
-
-/**
- * A set of common resource utilities.
- */
-public class ResourceUtils {
- /**
- * Returns the default color for a given attribute.
- */
- public static int getColorAttr(Context context, int attr) {
- TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
- ColorStateList stateList = null;
- try {
- stateList = ta.getColorStateList(0);
- } finally {
- ta.recycle();
- }
- return stateList.getDefaultColor();
- }
-}
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 4cbb977..2df3eea 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -29,7 +29,6 @@
import android.view.accessibility.AccessibilityEvent;
import android.widget.TextView;
-import androidx.annotation.ColorInt;
import androidx.annotation.Dimension;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
@@ -226,14 +225,14 @@
mContainer.getContext().getTheme()),
Gravity.BOTTOM | Gravity.RIGHT,
res.getDimensionPixelSize(R.dimen.check_size),
- res.getDimensionPixelOffset(R.dimen.check_offset), 0);
+ res.getDimensionPixelOffset(R.dimen.check_offset));
} else if (mCheckmarkStyle == CheckmarkStyle.CENTER
&& option.equals(mAppliedOption)) {
drawCheckmark(option, holder,
res.getDrawable(R.drawable.check_circle_grey_large,
mContainer.getContext().getTheme()),
Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
- 0, res.getColor(android.R.color.black));
+ 0);
} else if (option.equals(mAppliedOption)) {
// Initialize with "previewed" description if we don't show checkmark
holder.setContentDescription(mContainer.getContext(), option,
@@ -250,10 +249,7 @@
private void drawCheckmark(CustomizationOption<?> option, TileViewHolder holder,
Drawable checkmark, int gravity, @Dimension int checkSize,
- @Dimension int checkOffset, @ColorInt int checkColor) {
- if (checkColor != 0 && checkmark instanceof LayerDrawable) {
- ((LayerDrawable) checkmark).getDrawable(1).setTint(checkColor);
- }
+ @Dimension int checkOffset) {
Drawable frame = holder.tileView.getForeground();
Drawable[] layers = {frame, checkmark};
if (frame == null) {