diff options
author | Tianguang Zhang <tianguang@google.com> | 2021-04-20 18:38:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-20 18:38:54 +0000 |
commit | ebf296c1c98f01d5119ba81f54c07d54b6bbec5a (patch) | |
tree | a0a3f460abb3525a335bf77fba7a36960310376a | |
parent | e655711f820cc199a07ca9e4dcf497e5c05c9e94 (diff) | |
parent | 12827ffc49bae9828e3642de414deb8e24054495 (diff) | |
download | ThemePicker-ebf296c1c98f01d5119ba81f54c07d54b6bbec5a.tar.gz |
Merge "Remove hard-coded colors in Wallpaper Picker" into sc-dev
29 files changed, 71 insertions, 109 deletions
diff --git a/res/color/bottom_nav_item_color.xml b/res/color/bottom_nav_item_color.xml index bf94de98..d22a7599 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 9191154f..58018788 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/drawable/theme_cover_scrim.xml b/res/color/toolbar_icon_color.xml index c75213c5..91e56c1c 100644 --- a/res/drawable/theme_cover_scrim.xml +++ b/res/color/toolbar_icon_color.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - - Copyright (C) 2019 The Android Open Source Project + 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. @@ -15,13 +14,6 @@ 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 +<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 16c5d94d..cf42bf32 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 c1c8e56a..be8f1fe8 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/tip_dot.xml b/res/drawable/tip_dot.xml index 3c0f912f..aafb9e6f 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 e2c5d347..7638e7f6 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 6883d635..2679bdf2 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 53cf5131..a60b9c23 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 dab93085..2861e7da 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 fe660cfd..d3580379 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 5128dda8..46987c75 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 6b9f94c3..8ca48631 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 039f7815..7bae84bd 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 62da6b42..e333ca7b 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 bae126c2..83422ed9 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 e1e3491c..4fc8995c 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 c8afb99d..e87a7a1d 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 15b665d5..af69de96 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 4f369a7a..1c53517e 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 1f1ee300..df7b65c8 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 13c2b681..6a61274a 100644 --- a/src/com/android/customization/model/grid/GridOption.java +++ b/src/com/android/customization/model/grid/GridOption.java @@ -28,9 +28,9 @@ import androidx.annotation.Nullable; 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 4ede59ec..3a32f257 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.R; 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 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> { } 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 3db4bad5..78be0fc0 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.ResourceConstants; 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 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC 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 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC } 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 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC // 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 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC 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 415ca5b9..fa7dd815 100644 --- a/src/com/android/customization/picker/WallpaperPreviewer.java +++ b/src/com/android/customization/picker/WallpaperPreviewer.java @@ -33,9 +33,9 @@ import androidx.lifecycle.Lifecycle; 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 @@ public class WallpaperPreviewer implements LifecycleObserver { 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 50f391df..3f07431d 100644 --- a/src/com/android/customization/picker/theme/CustomThemeStepFragment.java +++ b/src/com/android/customization/picker/theme/CustomThemeStepFragment.java @@ -68,10 +68,10 @@ abstract class CustomThemeStepFragment extends AppbarFragment { } 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 5c775ddf..850edf9c 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; 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 @@ class ThemeOptionPreviewer implements LifecycleObserver { 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 @@ class ThemeOptionPreviewer implements LifecycleObserver { } 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 d42dca9d..00000000 --- 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 4cbb977e..2df3eea1 100644 --- a/src/com/android/customization/widget/OptionSelectorController.java +++ b/src/com/android/customization/widget/OptionSelectorController.java @@ -29,7 +29,6 @@ import android.view.WindowManager; 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 @@ public class OptionSelectorController<T extends CustomizationOption<T>> { 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 @@ public class OptionSelectorController<T extends CustomizationOption<T>> { 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) { |