Loading iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +1 −8 Original line number Diff line number Diff line Loading @@ -189,10 +189,7 @@ public class BaseIconFactory implements AutoCloseable { @NonNull public AdaptiveIconDrawable createShapedAdaptiveIcon(Bitmap iconBitmap) { Drawable drawable = new FixedSizeBitmapDrawable(iconBitmap); if (getIconScale() < 1f) { drawable = createScaledDrawable(drawable, 1 / getIconScale()); } float inset = getExtraInsetFraction() * getIconScale(); float inset = getExtraInsetFraction(); inset = inset / (1 + 2 * inset); return new AdaptiveIconDrawable(new ColorDrawable(BLACK), new InsetDrawable(drawable, inset, inset, inset, inset) Loading Loading @@ -298,10 +295,6 @@ public class BaseIconFactory implements AutoCloseable { return drawable.getIconMask(); } public float getIconScale() { return 1f; } @NonNull public Bitmap getWhiteShadowLayer() { if (mWhiteShadowLayer == null) { Loading iconloaderlib/src/com/android/launcher3/icons/MonochromeIconFactory.java +2 −2 Original line number Diff line number Diff line Loading @@ -100,12 +100,12 @@ public class MonochromeIconFactory extends Drawable { * Creates a monochrome version of the provided drawable */ @WorkerThread public Drawable wrap(AdaptiveIconDrawable icon, Path shapePath, Float iconScale) { public Drawable wrap(AdaptiveIconDrawable icon, Path shapePath) { mFlatCanvas.drawColor(Color.BLACK); drawDrawable(icon.getBackground()); drawDrawable(icon.getForeground()); generateMono(); return new ClippedMonoDrawable(this, shapePath, iconScale); return new ClippedMonoDrawable(this, shapePath); } @WorkerThread Loading iconloaderlib/src/com/android/launcher3/icons/mono/MonoIconThemeController.kt +4 −10 Original line number Diff line number Diff line Loading @@ -62,7 +62,6 @@ class MonoIconThemeController( icon, info, factory.getShapePath(icon, Rect(0, 0, info.icon.width, info.icon.height)), factory.iconScale, sourceHint?.isFileDrawable ?: false, factory.shouldForceThemeIcon(), ) Loading @@ -85,16 +84,15 @@ class MonoIconThemeController( base: AdaptiveIconDrawable, info: BitmapInfo, shapePath: Path, iconScale: Float, isFileDrawable: Boolean, shouldForceThemeIcon: Boolean, ): Drawable? { val mono = base.monochrome if (mono != null) { return ClippedMonoDrawable(mono, shapePath, iconScale) return ClippedMonoDrawable(mono, shapePath) } if (Flags.forceMonochromeAppIcons() && shouldForceThemeIcon && !isFileDrawable) { return MonochromeIconFactory(info.icon.width).wrap(base, shapePath, iconScale) return MonochromeIconFactory(info.icon.width).wrap(base, shapePath) } return null } Loading Loading @@ -149,11 +147,8 @@ class MonoIconThemeController( return monoDrawable?.let { AdaptiveIconDrawable(ColorDrawable(colors[0]), it) } } class ClippedMonoDrawable( base: Drawable?, private val shapePath: Path, private val iconScale: Float, ) : InsetDrawable(base, -AdaptiveIconDrawable.getExtraInsetFraction()) { class ClippedMonoDrawable(base: Drawable?, private val shapePath: Path) : InsetDrawable(base, -AdaptiveIconDrawable.getExtraInsetFraction()) { // TODO(b/399666950): remove this after launcher icon shapes is fully enabled private val mCrop = AdaptiveIconDrawable(ColorDrawable(Color.BLACK), null) Loading @@ -162,7 +157,6 @@ class MonoIconThemeController( val saveCount = canvas.save() if (Flags.enableLauncherIconShapes()) { canvas.clipPath(shapePath) canvas.scale(iconScale, iconScale, bounds.width() / 2f, bounds.height() / 2f) } else { canvas.clipPath(mCrop.iconMask) } Loading Loading
iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +1 −8 Original line number Diff line number Diff line Loading @@ -189,10 +189,7 @@ public class BaseIconFactory implements AutoCloseable { @NonNull public AdaptiveIconDrawable createShapedAdaptiveIcon(Bitmap iconBitmap) { Drawable drawable = new FixedSizeBitmapDrawable(iconBitmap); if (getIconScale() < 1f) { drawable = createScaledDrawable(drawable, 1 / getIconScale()); } float inset = getExtraInsetFraction() * getIconScale(); float inset = getExtraInsetFraction(); inset = inset / (1 + 2 * inset); return new AdaptiveIconDrawable(new ColorDrawable(BLACK), new InsetDrawable(drawable, inset, inset, inset, inset) Loading Loading @@ -298,10 +295,6 @@ public class BaseIconFactory implements AutoCloseable { return drawable.getIconMask(); } public float getIconScale() { return 1f; } @NonNull public Bitmap getWhiteShadowLayer() { if (mWhiteShadowLayer == null) { Loading
iconloaderlib/src/com/android/launcher3/icons/MonochromeIconFactory.java +2 −2 Original line number Diff line number Diff line Loading @@ -100,12 +100,12 @@ public class MonochromeIconFactory extends Drawable { * Creates a monochrome version of the provided drawable */ @WorkerThread public Drawable wrap(AdaptiveIconDrawable icon, Path shapePath, Float iconScale) { public Drawable wrap(AdaptiveIconDrawable icon, Path shapePath) { mFlatCanvas.drawColor(Color.BLACK); drawDrawable(icon.getBackground()); drawDrawable(icon.getForeground()); generateMono(); return new ClippedMonoDrawable(this, shapePath, iconScale); return new ClippedMonoDrawable(this, shapePath); } @WorkerThread Loading
iconloaderlib/src/com/android/launcher3/icons/mono/MonoIconThemeController.kt +4 −10 Original line number Diff line number Diff line Loading @@ -62,7 +62,6 @@ class MonoIconThemeController( icon, info, factory.getShapePath(icon, Rect(0, 0, info.icon.width, info.icon.height)), factory.iconScale, sourceHint?.isFileDrawable ?: false, factory.shouldForceThemeIcon(), ) Loading @@ -85,16 +84,15 @@ class MonoIconThemeController( base: AdaptiveIconDrawable, info: BitmapInfo, shapePath: Path, iconScale: Float, isFileDrawable: Boolean, shouldForceThemeIcon: Boolean, ): Drawable? { val mono = base.monochrome if (mono != null) { return ClippedMonoDrawable(mono, shapePath, iconScale) return ClippedMonoDrawable(mono, shapePath) } if (Flags.forceMonochromeAppIcons() && shouldForceThemeIcon && !isFileDrawable) { return MonochromeIconFactory(info.icon.width).wrap(base, shapePath, iconScale) return MonochromeIconFactory(info.icon.width).wrap(base, shapePath) } return null } Loading Loading @@ -149,11 +147,8 @@ class MonoIconThemeController( return monoDrawable?.let { AdaptiveIconDrawable(ColorDrawable(colors[0]), it) } } class ClippedMonoDrawable( base: Drawable?, private val shapePath: Path, private val iconScale: Float, ) : InsetDrawable(base, -AdaptiveIconDrawable.getExtraInsetFraction()) { class ClippedMonoDrawable(base: Drawable?, private val shapePath: Path) : InsetDrawable(base, -AdaptiveIconDrawable.getExtraInsetFraction()) { // TODO(b/399666950): remove this after launcher icon shapes is fully enabled private val mCrop = AdaptiveIconDrawable(ColorDrawable(Color.BLACK), null) Loading @@ -162,7 +157,6 @@ class MonoIconThemeController( val saveCount = canvas.save() if (Flags.enableLauncherIconShapes()) { canvas.clipPath(shapePath) canvas.scale(iconScale, iconScale, bounds.width() / 2f, bounds.height() / 2f) } else { canvas.clipPath(mCrop.iconMask) } Loading