Loading src/com/android/settings/notification/modes/IconUtil.java +12 −3 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ class IconUtil { private static Drawable applyTint(@NonNull Context context, @NonNull Drawable icon, @AttrRes int colorAttr) { icon = icon.mutate(); icon = mutateDrawable(context.getResources(), icon); icon.setTintList(Utils.getColorAttr(context, colorAttr)); return icon; } Loading Loading @@ -218,9 +218,9 @@ class IconUtil { private static Drawable composeIcons(Resources res, Drawable outer, ColorStateList outerColor, @Px int outerSizePx, Drawable icon, ColorStateList iconColor, @Px int iconSizePx) { Drawable background = checkNotNull(outer.getConstantState()).newDrawable(res).mutate(); Drawable background = mutateDrawable(res, outer); background.setTintList(outerColor); Drawable foreground = checkNotNull(icon.getConstantState()).newDrawable(res).mutate(); Drawable foreground = mutateDrawable(res, icon); foreground.setTintList(iconColor); LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { background, foreground }); Loading @@ -232,4 +232,13 @@ class IconUtil { layerDrawable.setBounds(0, 0, outerSizePx, outerSizePx); return layerDrawable; } private static Drawable mutateDrawable(Resources res, Drawable drawable) { Drawable.ConstantState cs = drawable.getConstantState(); if (cs != null) { return cs.newDrawable(res).mutate(); } else { return drawable.mutate(); } } } Loading
src/com/android/settings/notification/modes/IconUtil.java +12 −3 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ class IconUtil { private static Drawable applyTint(@NonNull Context context, @NonNull Drawable icon, @AttrRes int colorAttr) { icon = icon.mutate(); icon = mutateDrawable(context.getResources(), icon); icon.setTintList(Utils.getColorAttr(context, colorAttr)); return icon; } Loading Loading @@ -218,9 +218,9 @@ class IconUtil { private static Drawable composeIcons(Resources res, Drawable outer, ColorStateList outerColor, @Px int outerSizePx, Drawable icon, ColorStateList iconColor, @Px int iconSizePx) { Drawable background = checkNotNull(outer.getConstantState()).newDrawable(res).mutate(); Drawable background = mutateDrawable(res, outer); background.setTintList(outerColor); Drawable foreground = checkNotNull(icon.getConstantState()).newDrawable(res).mutate(); Drawable foreground = mutateDrawable(res, icon); foreground.setTintList(iconColor); LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { background, foreground }); Loading @@ -232,4 +232,13 @@ class IconUtil { layerDrawable.setBounds(0, 0, outerSizePx, outerSizePx); return layerDrawable; } private static Drawable mutateDrawable(Resources res, Drawable drawable) { Drawable.ConstantState cs = drawable.getConstantState(); if (cs != null) { return cs.newDrawable(res).mutate(); } else { return drawable.mutate(); } } }