Loading res/layout/theme_color_option.xml +2 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginHorizontal="10dp"> android:layout_marginHorizontal="6dp" android:paddingHorizontal="4dp"> <ImageView android:id="@+id/option_tile" Loading res/layout/theme_preview_card.xml +4 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,9 @@ <FrameLayout android:id="@+id/theme_preview_card_background" android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_height="match_parent" android:focusable="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" Loading @@ -52,7 +54,7 @@ <FrameLayout android:id="@+id/theme_preview_card_body_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="0dp" android:layout_marginHorizontal="8dp" android:layout_weight="1"/> Loading src/com/android/customization/model/theme/custom/ColorOptionsProvider.java +8 −5 Original line number Diff line number Diff line Loading @@ -18,17 +18,17 @@ package com.android.customization.model.theme.custom; import static com.android.customization.model.ResourceConstants.ACCENT_COLOR_DARK_NAME; import static com.android.customization.model.ResourceConstants.ACCENT_COLOR_LIGHT_NAME; import static com.android.customization.model.ResourceConstants.ANDROID_PACKAGE; import static com.android.customization.model.ResourceConstants.ICONS_FOR_PREVIEW; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_ANDROID_THEME; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_COLOR; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_ICON_ANDROID; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_ICON_SYSUI; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SHAPE; import static com.android.customization.model.ResourceConstants.PATH_SIZE; import static com.android.customization.model.ResourceConstants.ICONS_FOR_PREVIEW; import static com.android.customization.model.ResourceConstants.SYSUI_PACKAGE; import static com.android.customization.model.theme.custom.ThemeComponentOption.ColorOption.COLOR_TILES_ICON_IDS; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; Loading @@ -44,6 +44,7 @@ import androidx.core.graphics.PathParser; import com.android.customization.model.ResourceConstants; import com.android.customization.model.theme.OverlayManagerCompat; import com.android.customization.model.theme.custom.ThemeComponentOption.ColorOption; import com.android.wallpaper.R; import java.util.ArrayList; import java.util.List; Loading Loading @@ -104,8 +105,9 @@ public class ColorOptionsProvider extends ThemeComponentOptionProvider<ColorOpti int darkColor = overlayRes.getColor( overlayRes.getIdentifier(ACCENT_COLOR_DARK_NAME, "color", overlayPackage), null); ColorOption option = new ColorOption(overlayPackage, lightColor, darkColor); PackageManager pm = mContext.getPackageManager(); String label = pm.getApplicationInfo(overlayPackage, 0).loadLabel(pm).toString(); ColorOption option = new ColorOption(overlayPackage, label, lightColor, darkColor); option.setPreviewIcons(previewIcons); option.setShapeDrawable(shape); mOptions.add(option); Loading Loading @@ -136,7 +138,8 @@ public class ColorOptionsProvider extends ThemeComponentOptionProvider<ColorOpti darkColor = system.getColor( system.getIdentifier(ACCENT_COLOR_DARK_NAME, "color", ANDROID_PACKAGE), null); } ColorOption option = new ColorOption(null, lightColor, darkColor); ColorOption option = new ColorOption(null, mContext.getString(R.string.default_theme_title), lightColor, darkColor); option.setPreviewIcons(previewIcons); option.setShapeDrawable(shape); mOptions.add(option); Loading src/com/android/customization/model/theme/custom/ShapeOptionsProvider.java +7 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY import static com.android.customization.model.ResourceConstants.PATH_SIZE; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; Loading Loading @@ -72,7 +73,10 @@ public class ShapeOptionsProvider extends ThemeComponentOptionProvider<ShapeOpti Path path = loadPath(mContext.getPackageManager() .getResourcesForApplication(overlayPackage), overlayPackage); ShapeDrawable shapeDrawable = createShapeDrawable(path); mOptions.add(new ShapeOption(overlayPackage, shapeDrawable, getShapedIcons(path))); PackageManager pm = mContext.getPackageManager(); String label = pm.getApplicationInfo(overlayPackage, 0).loadLabel(pm).toString(); mOptions.add(new ShapeOption(overlayPackage, label, shapeDrawable, getShapedIcons(path))); } catch (NameNotFoundException | NotFoundException e) { Log.w(TAG, String.format("Couldn't load shape overlay %s, will skip it", overlayPackage), e); Loading @@ -84,7 +88,8 @@ public class ShapeOptionsProvider extends ThemeComponentOptionProvider<ShapeOpti Resources system = Resources.getSystem(); Path path = loadPath(system, ANDROID_PACKAGE); ShapeDrawable shapeDrawable = createShapeDrawable(path); mOptions.add(new ShapeOption(null, shapeDrawable, getShapedIcons(path))); mOptions.add(new ShapeOption(null, mContext.getString(R.string.default_theme_title), shapeDrawable, getShapedIcons(path))); } private ShapeDrawable createShapeDrawable(Path path) { Loading src/com/android/customization/model/theme/custom/ThemeComponentOption.java +12 −2 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC public void bindThumbnailTile(View view) { ((TextView) view.findViewById(R.id.thumbnail_text)).setTypeface( mHeadlineFont); view.setContentDescription(mLabel); } @Override Loading Loading @@ -154,6 +155,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC icon.setTint(res.getColor(R.color.icon_thumbnail_color, null)); ((ImageView) view.findViewById(R.id.option_icon)).setImageDrawable( icon); view.setContentDescription(mLabel); } @Override Loading Loading @@ -245,9 +247,12 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC */ private Drawable mShapeDrawable; ColorOption(String packageName, @ColorInt int lightColor, private String mLabel; ColorOption(String packageName, String label, @ColorInt int lightColor, @ColorInt int darkColor) { addOverlayPackage(OVERLAY_CATEGORY_COLOR, packageName); mLabel = label; mColorAccentLight = lightColor; mColorAccentDark = darkColor; } Loading @@ -256,6 +261,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC public void bindThumbnailTile(View view) { int color = resolveColor(view.getResources()); ((ImageView) view.findViewById(R.id.option_tile)).getDrawable().setTint(color); view.setContentDescription(mLabel); } private int resolveColor(Resources res) { Loading Loading @@ -355,13 +361,16 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC private final LayerDrawable mShape; private final List<Drawable> mAppIcons; private final String mLabel; private int[] mShapeIconIds = { R.id.shape_preview_icon_0, R.id.shape_preview_icon_1, R.id.shape_preview_icon_2, R.id.shape_preview_icon_3, R.id.shape_preview_icon_4, R.id.shape_preview_icon_5 }; ShapeOption(String packageName, Drawable shapeDrawable, List<Drawable> appIcons) { ShapeOption(String packageName, String label, Drawable shapeDrawable, List<Drawable> appIcons) { addOverlayPackage(OVERLAY_CATEGORY_SHAPE, packageName); mLabel = label; mAppIcons = appIcons; Drawable background = shapeDrawable.getConstantState().newDrawable(); Drawable foreground = shapeDrawable.getConstantState().newDrawable(); Loading @@ -387,6 +396,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC foreground.setTint(res.getColor(R.color.shape_option_tile_foreground_color, theme)); thumb.setImageDrawable(mShape); view.setContentDescription(mLabel); } @Override Loading Loading
res/layout/theme_color_option.xml +2 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginHorizontal="10dp"> android:layout_marginHorizontal="6dp" android:paddingHorizontal="4dp"> <ImageView android:id="@+id/option_tile" Loading
res/layout/theme_preview_card.xml +4 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,9 @@ <FrameLayout android:id="@+id/theme_preview_card_background" android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_height="match_parent" android:focusable="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" Loading @@ -52,7 +54,7 @@ <FrameLayout android:id="@+id/theme_preview_card_body_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="0dp" android:layout_marginHorizontal="8dp" android:layout_weight="1"/> Loading
src/com/android/customization/model/theme/custom/ColorOptionsProvider.java +8 −5 Original line number Diff line number Diff line Loading @@ -18,17 +18,17 @@ package com.android.customization.model.theme.custom; import static com.android.customization.model.ResourceConstants.ACCENT_COLOR_DARK_NAME; import static com.android.customization.model.ResourceConstants.ACCENT_COLOR_LIGHT_NAME; import static com.android.customization.model.ResourceConstants.ANDROID_PACKAGE; import static com.android.customization.model.ResourceConstants.ICONS_FOR_PREVIEW; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_ANDROID_THEME; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_COLOR; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_ICON_ANDROID; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_ICON_SYSUI; import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SHAPE; import static com.android.customization.model.ResourceConstants.PATH_SIZE; import static com.android.customization.model.ResourceConstants.ICONS_FOR_PREVIEW; import static com.android.customization.model.ResourceConstants.SYSUI_PACKAGE; import static com.android.customization.model.theme.custom.ThemeComponentOption.ColorOption.COLOR_TILES_ICON_IDS; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; Loading @@ -44,6 +44,7 @@ import androidx.core.graphics.PathParser; import com.android.customization.model.ResourceConstants; import com.android.customization.model.theme.OverlayManagerCompat; import com.android.customization.model.theme.custom.ThemeComponentOption.ColorOption; import com.android.wallpaper.R; import java.util.ArrayList; import java.util.List; Loading Loading @@ -104,8 +105,9 @@ public class ColorOptionsProvider extends ThemeComponentOptionProvider<ColorOpti int darkColor = overlayRes.getColor( overlayRes.getIdentifier(ACCENT_COLOR_DARK_NAME, "color", overlayPackage), null); ColorOption option = new ColorOption(overlayPackage, lightColor, darkColor); PackageManager pm = mContext.getPackageManager(); String label = pm.getApplicationInfo(overlayPackage, 0).loadLabel(pm).toString(); ColorOption option = new ColorOption(overlayPackage, label, lightColor, darkColor); option.setPreviewIcons(previewIcons); option.setShapeDrawable(shape); mOptions.add(option); Loading Loading @@ -136,7 +138,8 @@ public class ColorOptionsProvider extends ThemeComponentOptionProvider<ColorOpti darkColor = system.getColor( system.getIdentifier(ACCENT_COLOR_DARK_NAME, "color", ANDROID_PACKAGE), null); } ColorOption option = new ColorOption(null, lightColor, darkColor); ColorOption option = new ColorOption(null, mContext.getString(R.string.default_theme_title), lightColor, darkColor); option.setPreviewIcons(previewIcons); option.setShapeDrawable(shape); mOptions.add(option); Loading
src/com/android/customization/model/theme/custom/ShapeOptionsProvider.java +7 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY import static com.android.customization.model.ResourceConstants.PATH_SIZE; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; Loading Loading @@ -72,7 +73,10 @@ public class ShapeOptionsProvider extends ThemeComponentOptionProvider<ShapeOpti Path path = loadPath(mContext.getPackageManager() .getResourcesForApplication(overlayPackage), overlayPackage); ShapeDrawable shapeDrawable = createShapeDrawable(path); mOptions.add(new ShapeOption(overlayPackage, shapeDrawable, getShapedIcons(path))); PackageManager pm = mContext.getPackageManager(); String label = pm.getApplicationInfo(overlayPackage, 0).loadLabel(pm).toString(); mOptions.add(new ShapeOption(overlayPackage, label, shapeDrawable, getShapedIcons(path))); } catch (NameNotFoundException | NotFoundException e) { Log.w(TAG, String.format("Couldn't load shape overlay %s, will skip it", overlayPackage), e); Loading @@ -84,7 +88,8 @@ public class ShapeOptionsProvider extends ThemeComponentOptionProvider<ShapeOpti Resources system = Resources.getSystem(); Path path = loadPath(system, ANDROID_PACKAGE); ShapeDrawable shapeDrawable = createShapeDrawable(path); mOptions.add(new ShapeOption(null, shapeDrawable, getShapedIcons(path))); mOptions.add(new ShapeOption(null, mContext.getString(R.string.default_theme_title), shapeDrawable, getShapedIcons(path))); } private ShapeDrawable createShapeDrawable(Path path) { Loading
src/com/android/customization/model/theme/custom/ThemeComponentOption.java +12 −2 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC public void bindThumbnailTile(View view) { ((TextView) view.findViewById(R.id.thumbnail_text)).setTypeface( mHeadlineFont); view.setContentDescription(mLabel); } @Override Loading Loading @@ -154,6 +155,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC icon.setTint(res.getColor(R.color.icon_thumbnail_color, null)); ((ImageView) view.findViewById(R.id.option_icon)).setImageDrawable( icon); view.setContentDescription(mLabel); } @Override Loading Loading @@ -245,9 +247,12 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC */ private Drawable mShapeDrawable; ColorOption(String packageName, @ColorInt int lightColor, private String mLabel; ColorOption(String packageName, String label, @ColorInt int lightColor, @ColorInt int darkColor) { addOverlayPackage(OVERLAY_CATEGORY_COLOR, packageName); mLabel = label; mColorAccentLight = lightColor; mColorAccentDark = darkColor; } Loading @@ -256,6 +261,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC public void bindThumbnailTile(View view) { int color = resolveColor(view.getResources()); ((ImageView) view.findViewById(R.id.option_tile)).getDrawable().setTint(color); view.setContentDescription(mLabel); } private int resolveColor(Resources res) { Loading Loading @@ -355,13 +361,16 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC private final LayerDrawable mShape; private final List<Drawable> mAppIcons; private final String mLabel; private int[] mShapeIconIds = { R.id.shape_preview_icon_0, R.id.shape_preview_icon_1, R.id.shape_preview_icon_2, R.id.shape_preview_icon_3, R.id.shape_preview_icon_4, R.id.shape_preview_icon_5 }; ShapeOption(String packageName, Drawable shapeDrawable, List<Drawable> appIcons) { ShapeOption(String packageName, String label, Drawable shapeDrawable, List<Drawable> appIcons) { addOverlayPackage(OVERLAY_CATEGORY_SHAPE, packageName); mLabel = label; mAppIcons = appIcons; Drawable background = shapeDrawable.getConstantState().newDrawable(); Drawable foreground = shapeDrawable.getConstantState().newDrawable(); Loading @@ -387,6 +396,7 @@ public abstract class ThemeComponentOption implements CustomizationOption<ThemeC foreground.setTint(res.getColor(R.color.shape_option_tile_foreground_color, theme)); thumb.setImageDrawable(mShape); view.setContentDescription(mLabel); } @Override Loading