Remove color and shape preview assets
These previews are now rendered dynamically.
Bug: 124453141
Bug: 124454263
Change-Id: I51645a8391614157343df9b2b8cfe6d62ffef5f5
diff --git a/src/com/android/customization/model/theme/DefaultThemeProvider.java b/src/com/android/customization/model/theme/DefaultThemeProvider.java
index 51718da..549f04f 100644
--- a/src/com/android/customization/model/theme/DefaultThemeProvider.java
+++ b/src/com/android/customization/model/theme/DefaultThemeProvider.java
@@ -80,8 +80,6 @@
private static final String ICON_LAUNCHER_PREFIX = "theme_overlay_icon_launcher_";
private static final String ICON_SETTINGS_PREFIX = "theme_overlay_icon_settings_";
private static final String ICON_SYSUI_PREFIX = "theme_overlay_icon_sysui_";
- private static final String PREVIEW_COLOR_PREFIX = "theme_preview_color_";
- private static final String PREVIEW_SHAPE_PREFIX = "theme_preview_shape_";
private static final String WALLPAPER_PREFIX = "theme_wallpaper_";
private static final String WALLPAPER_TITLE_PREFIX = "theme_wallpaper_title_";
private static final String WALLPAPER_ATTRIBUTION_PREFIX = "theme_wallpaper_attribution_";
@@ -146,9 +144,7 @@
if (!TextUtils.isEmpty(shapeOverlayPackage)) {
builder.addOverlayPackage(getOverlayCategory(shapeOverlayPackage),
shapeOverlayPackage)
- .setShapePath(loadString(CONFIG_ICON_MASK, shapeOverlayPackage))
- .setShapePreview(getDrawableResourceAsset(
- PREVIEW_SHAPE_PREFIX, themeName));
+ .setShapePath(loadString(CONFIG_ICON_MASK, shapeOverlayPackage));
} else {
builder.setShapePath(mContext.getResources().getString(
Resources.getSystem().getIdentifier(CONFIG_ICON_MASK, "string",
@@ -174,9 +170,7 @@
.setColorAccentLight(loadColor(ACCENT_COLOR_LIGHT_NAME,
colorOverlayPackage))
.setColorAccentDark(loadColor(ACCENT_COLOR_DARK_NAME,
- colorOverlayPackage))
- .setColorPreview(getDrawableResourceAsset(
- PREVIEW_COLOR_PREFIX, themeName));
+ colorOverlayPackage));
}
String iconAndroidOverlayPackage = getOverlayPackage(ICON_ANDROID_PREFIX,
@@ -300,9 +294,7 @@
try {
builder.addOverlayPackage(getOverlayCategory(colorOverlayPackage), colorOverlayPackage)
.setColorAccentLight(loadColor(ACCENT_COLOR_LIGHT_NAME, colorOverlayPackage))
- .setColorAccentDark(loadColor(ACCENT_COLOR_DARK_NAME, colorOverlayPackage))
- .setColorPreview(getDrawableResourceAsset(PREVIEW_COLOR_PREFIX,
- DEFAULT_THEME_NAME));
+ .setColorAccentDark(loadColor(ACCENT_COLOR_DARK_NAME, colorOverlayPackage));
} catch (NameNotFoundException | NotFoundException e) {
Log.d(TAG, "Didn't find color overlay for default theme, will use system default", e);
int colorAccentLight = system.getColor(
@@ -311,9 +303,7 @@
int colorAccentDark = system.getColor(
system.getIdentifier(ACCENT_COLOR_DARK_NAME, "color", ANDROID_PACKAGE), null);
- builder.setColorAccentDark(colorAccentDark)
- .setColorPreview(getDrawableResourceAsset(PREVIEW_COLOR_PREFIX,
- DEFAULT_THEME_NAME));
+ builder.setColorAccentDark(colorAccentDark);
}
String fontOverlayPackage = getOverlayPackage(FONT_PREFIX, DEFAULT_THEME_NAME);
@@ -339,16 +329,12 @@
try {
String shapeOverlayPackage = getOverlayPackage(SHAPE_PREFIX, DEFAULT_THEME_NAME);
builder.addOverlayPackage(getOverlayCategory(shapeOverlayPackage), shapeOverlayPackage)
- .setShapePath(loadString(ICON_PREVIEW_DRAWABLE_NAME, colorOverlayPackage))
- .setShapePreview(getDrawableResourceAsset(PREVIEW_SHAPE_PREFIX,
- DEFAULT_THEME_NAME));
+ .setShapePath(loadString(ICON_PREVIEW_DRAWABLE_NAME, colorOverlayPackage));
} catch (NameNotFoundException | NotFoundException e) {
Log.d(TAG, "Didn't find shape overlay for default theme, will use system default", e);
String iconMaskPath = system.getString(system.getIdentifier(CONFIG_ICON_MASK,
"string", ANDROID_PACKAGE));
- builder.setShapePath(iconMaskPath)
- .setShapePreview(getDrawableResourceAsset(PREVIEW_SHAPE_PREFIX,
- DEFAULT_THEME_NAME));
+ builder.setShapePath(iconMaskPath);
}
for (String packageName : mShapePreviewIconPackages) {
try {
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java
index 9e39006..8c78239 100644
--- a/src/com/android/customization/model/theme/ThemeBundle.java
+++ b/src/com/android/customization/model/theme/ThemeBundle.java
@@ -166,15 +166,11 @@
public final List<Drawable> icons;
public final Drawable shapeDrawable;
@Nullable public final ResourceAsset wallpaperAsset;
- @Nullable public final ResourceAsset colorPreviewAsset;
- @Nullable public final ResourceAsset shapePreviewAsset;
public final List<Drawable> shapeAppIcons;
private PreviewInfo(Typeface bodyFontFamily, Typeface headlineFontFamily,
int colorAccentLight, int colorAccentDark, List<Drawable> icons,
Drawable shapeDrawable, @Nullable ResourceAsset wallpaperAsset,
- @Nullable ResourceAsset colorPreviewAsset,
- @Nullable ResourceAsset shapePreviewAsset,
List<Drawable> shapeAppIcons) {
this.bodyFontFamily = bodyFontFamily;
this.headlineFontFamily = headlineFontFamily;
@@ -183,8 +179,6 @@
this.icons = icons;
this.shapeDrawable = shapeDrawable;
this.wallpaperAsset = wallpaperAsset;
- this.colorPreviewAsset = colorPreviewAsset;
- this.shapePreviewAsset = shapePreviewAsset;
this.shapeAppIcons = shapeAppIcons;
}
@@ -205,14 +199,12 @@
protected String mTitle;
private Typeface mBodyFontFamily;
private Typeface mHeadlineFontFamily;
- @ColorInt private int mColorAccentLight;
- @ColorInt private int mColorAccentDark;
+ @ColorInt private int mColorAccentLight = -1;
+ @ColorInt private int mColorAccentDark = -1;
private List<Drawable> mIcons = new ArrayList<>();
private String mShapePath;
private boolean mIsDefault;
private ResourceAsset mWallpaperAsset;
- private ResourceAsset mColorPreview;
- private ResourceAsset mShapePreview;
private WallpaperInfo mWallpaperInfo;
protected Map<String, String> mPackages = new HashMap<>();
private List<Drawable> mAppIcons = new ArrayList<>();
@@ -243,8 +235,7 @@
}
}
return new PreviewInfo(mBodyFontFamily, mHeadlineFontFamily, mColorAccentLight,
- mColorAccentDark, mIcons, shapeDrawable, mWallpaperAsset,
- mColorPreview, mShapePreview, shapeIcons);
+ mColorAccentDark, mIcons, shapeDrawable, mWallpaperAsset, shapeIcons);
}
public Builder setTitle(String title) {
@@ -287,16 +278,6 @@
return this;
}
- public Builder setColorPreview(ResourceAsset colorPreview) {
- mColorPreview = colorPreview;
- return this;
- }
-
- public Builder setShapePreview(ResourceAsset shapePreview) {
- mShapePreview = shapePreview;
- return this;
- }
-
public Builder setWallpaperInfo(String wallpaperPackageName, String wallpaperResName,
String themeId, @DrawableRes int wallpaperResId, @StringRes int titleResId,
@StringRes int attributionResId, @StringRes int actionUrlResId) {
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index d556e63..e60e17b 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -340,7 +340,7 @@
}
});
}
- if (previewInfo.colorPreviewAsset != null) {
+ if (previewInfo.colorAccentDark != -1 && previewInfo.colorAccentLight != -1) {
addPage(new ThemePreviewPage(activity, R.string.preview_name_color,
R.drawable.ic_colorize_24px, R.layout.preview_card_color_content,
previewInfo.resolveAccentColor(res), editClickListener) {