Loading iconloaderlib/src/com/android/launcher3/icons/BitmapInfo.java +1 −2 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ public class BitmapInfo { public static final String TAG = "BitmapInfo"; @NonNull public final Bitmap icon; public final int color; Loading @@ -73,7 +72,7 @@ public class BitmapInfo { private BitmapInfo badgeInfo; public BitmapInfo(@NonNull Bitmap icon, int color) { public BitmapInfo(Bitmap icon, int color) { this.icon = icon; this.color = color; } Loading iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java +5 −5 Original line number Diff line number Diff line Loading @@ -306,7 +306,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap return super.newIcon(context, creationFlags); } ClockIconDrawable.ClockConstantState cs = new ClockIconDrawable.ClockConstantState( this, themedFgColor, boundsOffset, info, bg, bgFilter); icon, color, themedFgColor, boundsOffset, info, bg, bgFilter); FastBitmapDrawable d = cs.newDrawable(); applyFlags(context, d, creationFlags); return d; Loading Loading @@ -341,7 +341,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap private final float mCanvasScale; ClockIconDrawable(ClockConstantState cs) { super(cs.mBitmapInfo); super(cs.mBitmap, cs.mIconColor); mBoundsOffset = cs.mBoundsOffset; mAnimInfo = cs.mAnimInfo; Loading Loading @@ -447,7 +447,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap @Override public FastBitmapConstantState newConstantState() { return new ClockConstantState(mBitmapInfo, mThemedFgColor, mBoundsOffset, return new ClockConstantState(mBitmap, mIconColor, mThemedFgColor, mBoundsOffset, mAnimInfo, mBG, mBgPaint.getColorFilter()); } Loading @@ -459,9 +459,9 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap private final ColorFilter mBgFilter; private final int mThemedFgColor; ClockConstantState(BitmapInfo info, int themedFgColor, ClockConstantState(Bitmap bitmap, int color, int themedFgColor, float boundsOffset, AnimationInfo animInfo, Bitmap bg, ColorFilter bgFilter) { super(info); super(bitmap, color); mBoundsOffset = boundsOffset; mAnimInfo = animInfo; mBG = bg; Loading iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java +18 −25 Original line number Diff line number Diff line Loading @@ -65,7 +65,8 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { private static boolean sFlagHoverEnabled = false; protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); public final BitmapInfo mBitmapInfo; protected final Bitmap mBitmap; protected final int mIconColor; @Nullable private ColorFilter mColorFilter; Loading Loading @@ -98,24 +99,18 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { private boolean mHoverScaleEnabledForDisplay = true; protected FastBitmapDrawable(Bitmap b, int iconColor) { this(BitmapInfo.of(b, iconColor)); } public FastBitmapDrawable(Bitmap b) { this(BitmapInfo.fromBitmap(b)); this(b, Color.TRANSPARENT); } public FastBitmapDrawable(BitmapInfo info) { mBitmapInfo = info; setFilterBitmap(true); this(info.icon, info.color); } /** * Returns true if the drawable points to the same bitmap icon object */ public boolean isSameInfo(BitmapInfo info) { return mBitmapInfo == info; protected FastBitmapDrawable(Bitmap b, int iconColor) { mBitmap = b; mIconColor = iconColor; setFilterBitmap(true); } @Override Loading Loading @@ -150,7 +145,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { } protected void drawInternal(Canvas canvas, Rect bounds) { canvas.drawBitmap(mBitmapInfo.icon, null, bounds, mPaint); canvas.drawBitmap(mBitmap, null, bounds, mPaint); } /** Loading @@ -158,7 +153,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { */ public int getIconColor() { int whiteScrim = setColorAlphaBound(Color.WHITE, WHITE_SCRIM_ALPHA); return ColorUtils.compositeColors(whiteScrim, mBitmapInfo.color); return ColorUtils.compositeColors(whiteScrim, mIconColor); } /** Loading Loading @@ -225,12 +220,12 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { @Override public int getIntrinsicWidth() { return mBitmapInfo.icon.getWidth(); return mBitmap.getWidth(); } @Override public int getIntrinsicHeight() { return mBitmapInfo.icon.getHeight(); return mBitmap.getHeight(); } @Override Loading Loading @@ -338,7 +333,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { } protected FastBitmapConstantState newConstantState() { return new FastBitmapConstantState(mBitmapInfo); return new FastBitmapConstantState(mBitmap, mIconColor); } @Override Loading Loading @@ -428,7 +423,8 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { } public static class FastBitmapConstantState extends ConstantState { protected final BitmapInfo mBitmapInfo; protected final Bitmap mBitmap; protected final int mIconColor; // These are initialized later so that subclasses don't need to // pass everything in constructor Loading @@ -438,15 +434,12 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { @DrawableCreationFlags int mCreationFlags = 0; public FastBitmapConstantState(Bitmap bitmap, int color) { this(BitmapInfo.of(bitmap, color)); } public FastBitmapConstantState(BitmapInfo info) { mBitmapInfo = info; mBitmap = bitmap; mIconColor = color; } protected FastBitmapDrawable createDrawable() { return new FastBitmapDrawable(mBitmapInfo); return new FastBitmapDrawable(mBitmap, mIconColor); } @Override Loading iconloaderlib/src/com/android/launcher3/icons/mono/ThemedIconDrawable.kt +6 −5 Original line number Diff line number Diff line Loading @@ -28,7 +28,8 @@ import com.android.launcher3.icons.R /** Class to handle monochrome themed app icons */ class ThemedIconDrawable(constantState: ThemedConstantState) : FastBitmapDrawable(constantState.getBitmapInfo()) { FastBitmapDrawable(constantState.getBitmap(), constantState.colorFg) { val bitmapInfo = constantState.bitmapInfo private val colorFg = constantState.colorFg private val colorBg = constantState.colorBg Loading Loading @@ -65,21 +66,21 @@ class ThemedIconDrawable(constantState: ThemedConstantState) : override fun isThemed() = true override fun newConstantState() = ThemedConstantState(mBitmapInfo, monoIcon, bgBitmap, colorBg, colorFg) ThemedConstantState(bitmapInfo, monoIcon, bgBitmap, colorBg, colorFg) override fun getIconColor() = colorFg class ThemedConstantState( bitmapInfo: BitmapInfo, val bitmapInfo: BitmapInfo, val mono: Bitmap, val whiteShadowLayer: Bitmap, val colorBg: Int, val colorFg: Int, ) : FastBitmapConstantState(bitmapInfo) { ) : FastBitmapConstantState(bitmapInfo.icon, bitmapInfo.color) { public override fun createDrawable() = ThemedIconDrawable(this) fun getBitmapInfo(): BitmapInfo = mBitmapInfo fun getBitmap(): Bitmap = mBitmap } companion object { Loading Loading
iconloaderlib/src/com/android/launcher3/icons/BitmapInfo.java +1 −2 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ public class BitmapInfo { public static final String TAG = "BitmapInfo"; @NonNull public final Bitmap icon; public final int color; Loading @@ -73,7 +72,7 @@ public class BitmapInfo { private BitmapInfo badgeInfo; public BitmapInfo(@NonNull Bitmap icon, int color) { public BitmapInfo(Bitmap icon, int color) { this.icon = icon; this.color = color; } Loading
iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java +5 −5 Original line number Diff line number Diff line Loading @@ -306,7 +306,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap return super.newIcon(context, creationFlags); } ClockIconDrawable.ClockConstantState cs = new ClockIconDrawable.ClockConstantState( this, themedFgColor, boundsOffset, info, bg, bgFilter); icon, color, themedFgColor, boundsOffset, info, bg, bgFilter); FastBitmapDrawable d = cs.newDrawable(); applyFlags(context, d, creationFlags); return d; Loading Loading @@ -341,7 +341,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap private final float mCanvasScale; ClockIconDrawable(ClockConstantState cs) { super(cs.mBitmapInfo); super(cs.mBitmap, cs.mIconColor); mBoundsOffset = cs.mBoundsOffset; mAnimInfo = cs.mAnimInfo; Loading Loading @@ -447,7 +447,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap @Override public FastBitmapConstantState newConstantState() { return new ClockConstantState(mBitmapInfo, mThemedFgColor, mBoundsOffset, return new ClockConstantState(mBitmap, mIconColor, mThemedFgColor, mBoundsOffset, mAnimInfo, mBG, mBgPaint.getColorFilter()); } Loading @@ -459,9 +459,9 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap private final ColorFilter mBgFilter; private final int mThemedFgColor; ClockConstantState(BitmapInfo info, int themedFgColor, ClockConstantState(Bitmap bitmap, int color, int themedFgColor, float boundsOffset, AnimationInfo animInfo, Bitmap bg, ColorFilter bgFilter) { super(info); super(bitmap, color); mBoundsOffset = boundsOffset; mAnimInfo = animInfo; mBG = bg; Loading
iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java +18 −25 Original line number Diff line number Diff line Loading @@ -65,7 +65,8 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { private static boolean sFlagHoverEnabled = false; protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); public final BitmapInfo mBitmapInfo; protected final Bitmap mBitmap; protected final int mIconColor; @Nullable private ColorFilter mColorFilter; Loading Loading @@ -98,24 +99,18 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { private boolean mHoverScaleEnabledForDisplay = true; protected FastBitmapDrawable(Bitmap b, int iconColor) { this(BitmapInfo.of(b, iconColor)); } public FastBitmapDrawable(Bitmap b) { this(BitmapInfo.fromBitmap(b)); this(b, Color.TRANSPARENT); } public FastBitmapDrawable(BitmapInfo info) { mBitmapInfo = info; setFilterBitmap(true); this(info.icon, info.color); } /** * Returns true if the drawable points to the same bitmap icon object */ public boolean isSameInfo(BitmapInfo info) { return mBitmapInfo == info; protected FastBitmapDrawable(Bitmap b, int iconColor) { mBitmap = b; mIconColor = iconColor; setFilterBitmap(true); } @Override Loading Loading @@ -150,7 +145,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { } protected void drawInternal(Canvas canvas, Rect bounds) { canvas.drawBitmap(mBitmapInfo.icon, null, bounds, mPaint); canvas.drawBitmap(mBitmap, null, bounds, mPaint); } /** Loading @@ -158,7 +153,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { */ public int getIconColor() { int whiteScrim = setColorAlphaBound(Color.WHITE, WHITE_SCRIM_ALPHA); return ColorUtils.compositeColors(whiteScrim, mBitmapInfo.color); return ColorUtils.compositeColors(whiteScrim, mIconColor); } /** Loading Loading @@ -225,12 +220,12 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { @Override public int getIntrinsicWidth() { return mBitmapInfo.icon.getWidth(); return mBitmap.getWidth(); } @Override public int getIntrinsicHeight() { return mBitmapInfo.icon.getHeight(); return mBitmap.getHeight(); } @Override Loading Loading @@ -338,7 +333,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { } protected FastBitmapConstantState newConstantState() { return new FastBitmapConstantState(mBitmapInfo); return new FastBitmapConstantState(mBitmap, mIconColor); } @Override Loading Loading @@ -428,7 +423,8 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { } public static class FastBitmapConstantState extends ConstantState { protected final BitmapInfo mBitmapInfo; protected final Bitmap mBitmap; protected final int mIconColor; // These are initialized later so that subclasses don't need to // pass everything in constructor Loading @@ -438,15 +434,12 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { @DrawableCreationFlags int mCreationFlags = 0; public FastBitmapConstantState(Bitmap bitmap, int color) { this(BitmapInfo.of(bitmap, color)); } public FastBitmapConstantState(BitmapInfo info) { mBitmapInfo = info; mBitmap = bitmap; mIconColor = color; } protected FastBitmapDrawable createDrawable() { return new FastBitmapDrawable(mBitmapInfo); return new FastBitmapDrawable(mBitmap, mIconColor); } @Override Loading
iconloaderlib/src/com/android/launcher3/icons/mono/ThemedIconDrawable.kt +6 −5 Original line number Diff line number Diff line Loading @@ -28,7 +28,8 @@ import com.android.launcher3.icons.R /** Class to handle monochrome themed app icons */ class ThemedIconDrawable(constantState: ThemedConstantState) : FastBitmapDrawable(constantState.getBitmapInfo()) { FastBitmapDrawable(constantState.getBitmap(), constantState.colorFg) { val bitmapInfo = constantState.bitmapInfo private val colorFg = constantState.colorFg private val colorBg = constantState.colorBg Loading Loading @@ -65,21 +66,21 @@ class ThemedIconDrawable(constantState: ThemedConstantState) : override fun isThemed() = true override fun newConstantState() = ThemedConstantState(mBitmapInfo, monoIcon, bgBitmap, colorBg, colorFg) ThemedConstantState(bitmapInfo, monoIcon, bgBitmap, colorBg, colorFg) override fun getIconColor() = colorFg class ThemedConstantState( bitmapInfo: BitmapInfo, val bitmapInfo: BitmapInfo, val mono: Bitmap, val whiteShadowLayer: Bitmap, val colorBg: Int, val colorFg: Int, ) : FastBitmapConstantState(bitmapInfo) { ) : FastBitmapConstantState(bitmapInfo.icon, bitmapInfo.color) { public override fun createDrawable() = ThemedIconDrawable(this) fun getBitmapInfo(): BitmapInfo = mBitmapInfo fun getBitmap(): Bitmap = mBitmap } companion object { Loading