Loading iconloaderlib/src/com/android/launcher3/icons/MonochromeIconFactory.java +23 −1 Original line number Diff line number Diff line Loading @@ -82,7 +82,6 @@ public class MonochromeIconFactory extends Drawable { // Crate a color matrix which converts the icon to grayscale and then uses the average // of RGB components as the alpha component. ColorMatrix satMatrix = new ColorMatrix(); satMatrix.setSaturation(0); float[] vals = satMatrix.getArray(); vals[15] = vals[16] = vals[17] = .3333f; vals[18] = vals[19] = 0; Loading Loading @@ -145,6 +144,29 @@ public class MonochromeIconFactory extends Drawable { int p2 = Math.round((p - min) * 0xFF / range); mPixels[i] = flipColor ? (byte) (255 - p2) : (byte) (p2); } // Second phase of processing, aimed on increasing the contrast for (int i = 0; i < mPixels.length; i++) { int p = mPixels[i] & 0xFF; int p2; double coefficient; if (p > 128) { coefficient = (1 - (double) (p - 128) / 128); p2 = 255 - (int) (coefficient * (255 - p)); } else { coefficient = (1 - (double) (128 - p) / 128); p2 = (int) (coefficient * p); } if (p2 > 255) { p2 = 255; } else if (p2 < 0) { p2 = 0; } mPixels[i] = (byte) p2; } buffer.rewind(); mAlphaBitmap.copyPixelsFromBuffer(buffer); } Loading iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.kt +2 −3 Original line number Diff line number Diff line Loading @@ -639,9 +639,8 @@ constructor( fun getPackageKey(packageName: String, user: UserHandle) = ComponentKey(ComponentName(packageName, packageName + EMPTY_CLASS_NAME), user) // Ensures archived app icons are invalidated after flag is flipped. // TODO: Remove conditional with FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS @JvmField val RELEASE_VERSION = if (Flags.forceMonochromeAppIcons()) 3 else 2 // Ensures themed bitmaps in the icon cache are invalidated @JvmField val RELEASE_VERSION = if (Flags.forceMonochromeAppIcons()) 4 else 3 @JvmField val TABLE_NAME = "icons" @JvmField val COLUMN_ROWID = "rowid" Loading Loading
iconloaderlib/src/com/android/launcher3/icons/MonochromeIconFactory.java +23 −1 Original line number Diff line number Diff line Loading @@ -82,7 +82,6 @@ public class MonochromeIconFactory extends Drawable { // Crate a color matrix which converts the icon to grayscale and then uses the average // of RGB components as the alpha component. ColorMatrix satMatrix = new ColorMatrix(); satMatrix.setSaturation(0); float[] vals = satMatrix.getArray(); vals[15] = vals[16] = vals[17] = .3333f; vals[18] = vals[19] = 0; Loading Loading @@ -145,6 +144,29 @@ public class MonochromeIconFactory extends Drawable { int p2 = Math.round((p - min) * 0xFF / range); mPixels[i] = flipColor ? (byte) (255 - p2) : (byte) (p2); } // Second phase of processing, aimed on increasing the contrast for (int i = 0; i < mPixels.length; i++) { int p = mPixels[i] & 0xFF; int p2; double coefficient; if (p > 128) { coefficient = (1 - (double) (p - 128) / 128); p2 = 255 - (int) (coefficient * (255 - p)); } else { coefficient = (1 - (double) (128 - p) / 128); p2 = (int) (coefficient * p); } if (p2 > 255) { p2 = 255; } else if (p2 < 0) { p2 = 0; } mPixels[i] = (byte) p2; } buffer.rewind(); mAlphaBitmap.copyPixelsFromBuffer(buffer); } Loading
iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.kt +2 −3 Original line number Diff line number Diff line Loading @@ -639,9 +639,8 @@ constructor( fun getPackageKey(packageName: String, user: UserHandle) = ComponentKey(ComponentName(packageName, packageName + EMPTY_CLASS_NAME), user) // Ensures archived app icons are invalidated after flag is flipped. // TODO: Remove conditional with FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS @JvmField val RELEASE_VERSION = if (Flags.forceMonochromeAppIcons()) 3 else 2 // Ensures themed bitmaps in the icon cache are invalidated @JvmField val RELEASE_VERSION = if (Flags.forceMonochromeAppIcons()) 4 else 3 @JvmField val TABLE_NAME = "icons" @JvmField val COLUMN_ROWID = "rowid" Loading