summaryrefslogtreecommitdiff
path: root/src/com/android/customization/model/theme
diff options
context:
space:
mode:
authorWesley.CW Wang <wesleycwwang@google.com>2020-06-10 18:50:14 +0800
committerWesley.CW Wang <wesleycwwang@google.com>2020-06-10 19:57:35 +0800
commit41ffb72c57fe650a6f6934003080a6313a10886a (patch)
treefbd9227e7e4ef2a2c9de87548e7d5b1f8a5bf8c0 /src/com/android/customization/model/theme
parent3e5a805a12f201724b46e3e18c4a3b50547ed96c (diff)
downloadThemePicker-41ffb72c57fe650a6f6934003080a6313a10886a.tar.gz
Change color rings color to system accent
- Create state drawable programmatically and fill options center part only with accent color video: https://drive.google.com/file/d/1swM0i_vfUg1CQj8m7F9h28Cr45020SHr/view?usp=sharing Fixes: 158625350 Test: manually Change-Id: Ica0f4a30b15e8195544a9619bc1af21c9f11ecc1
Diffstat (limited to 'src/com/android/customization/model/theme')
-rw-r--r--src/com/android/customization/model/theme/custom/ThemeComponentOption.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index b3d9d157..178098c2 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -35,6 +35,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.StateListDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -315,8 +316,21 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC
@Override
public void bindThumbnailTile(View view) {
@ColorInt int color = resolveColor(view.getResources());
- ((ImageView) view.findViewById(R.id.option_tile)).setImageTintList(
+ LayerDrawable selectedOption = (LayerDrawable) view.getResources().getDrawable(
+ R.drawable.color_chip_hollow, view.getContext().getTheme());
+ Drawable unselectedOption = view.getResources().getDrawable(
+ R.drawable.color_chip_filled, view.getContext().getTheme());
+
+ selectedOption.findDrawableByLayerId(R.id.center_fill).setTintList(
ColorStateList.valueOf(color));
+ unselectedOption.setTintList(ColorStateList.valueOf(color));
+
+ StateListDrawable stateListDrawable = new StateListDrawable();
+ stateListDrawable.addState(new int[] {android.R.attr.state_activated}, selectedOption);
+ stateListDrawable.addState(
+ new int[] {-android.R.attr.state_activated}, unselectedOption);
+
+ ((ImageView) view.findViewById(R.id.option_tile)).setImageDrawable(stateListDrawable);
view.setContentDescription(mLabel);
}