summaryrefslogtreecommitdiff
path: root/src/com/android/customization/model/theme
diff options
context:
space:
mode:
authorchihhangchuang <chihhangchuang@google.com>2020-07-08 01:12:48 +0800
committerchihhangchuang <chihhangchuang@google.com>2020-07-08 01:58:38 +0800
commitfca3d58db047f3b1d0fd54aaaf33175d5a63758e (patch)
treeb14ebf773c70a7bd98966e87012a7823c98e9156 /src/com/android/customization/model/theme
parent031d8dd5ca55f9db6024e98d32157dcc4dd6afe9 (diff)
downloadThemePicker-fca3d58db047f3b1d0fd54aaaf33175d5a63758e.tar.gz
New drawable of shaped app icon for using
Because there are two different size ImageViews using the same drawable instance, the bound size was updated to break one of the ImageView displaying. Video: https://drive.google.com/file/d/1eVzxyn1ojbWanUg47yHXA9AoKZTjXWzp/view?usp=sharing Test: Manually Fixes: 160695343 Change-Id: I27f843d21f268e5c82e9682f6af7e0aa907e00eb
Diffstat (limited to 'src/com/android/customization/model/theme')
-rw-r--r--src/com/android/customization/model/theme/ThemeBundle.java8
-rw-r--r--src/com/android/customization/model/theme/custom/ThemeComponentOption.java2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java
index 43b07ff5..4ede59ec 100644
--- a/src/com/android/customization/model/theme/ThemeBundle.java
+++ b/src/com/android/customization/model/theme/ThemeBundle.java
@@ -272,9 +272,9 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> {
mAppName = appName;
}
- /** Returns the app icon drawable. */
- public Drawable getDrawable() {
- return mIconDrawable;
+ /** Returns a copy of app icon drawable. */
+ public Drawable getDrawableCopy() {
+ return mIconDrawable.getConstantState().newDrawable().mutate();
}
/** Returns the app name. */
@@ -340,7 +340,7 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> {
shapeDrawable.setIntrinsicHeight((int) PATH_SIZE);
shapeDrawable.setIntrinsicWidth((int) PATH_SIZE);
for (ShapeAppIcon icon : mAppIcons) {
- Drawable drawable = icon.getDrawable();
+ Drawable drawable = icon.mIconDrawable;
if (drawable instanceof AdaptiveIconDrawable) {
AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) drawable;
shapeIcons.add(new ShapeAppIcon(
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index 178098c2..f93be44d 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -504,7 +504,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC
}
for (int i = 0; i < mShapeIconIds.length && i < mAppIcons.size(); i++) {
ImageView iconView = cardBody.findViewById(mShapeIconIds[i]);
- iconView.setBackground(mAppIcons.get(i).getDrawable());
+ iconView.setBackground(mAppIcons.get(i).getDrawableCopy());
}
}