Loading iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +25 −4 Original line number Diff line number Diff line Loading @@ -199,7 +199,7 @@ public class BaseIconFactory implements AutoCloseable { /** * Creates bitmap using the source drawable and various parameters. * The bitmap is visually normalized with other icons and has enough spacing to add shadow. * The bitmap is visually normalized with other icons. * * @param icon source of the icon * @param user info can be used for a badge Loading @@ -210,16 +210,37 @@ public class BaseIconFactory implements AutoCloseable { */ public BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user, boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale) { return createBadgedIconBitmap(icon, user, shrinkNonAdaptiveIcons, isInstantApp, scale, false /* addShadow */); } /** * Creates bitmap using the source drawable and various parameters. * The bitmap is visually normalized with other icons and has enough spacing to add shadow. * * @param icon source of the icon * @param user info can be used for a badge * @param shrinkNonAdaptiveIcons {@code true} if non adaptive icons should be treated * @param isInstantApp info can be used for a badge * @param scale returns the scale result from normalization * @param addShadow If true, adds a shadow under the icon. * @return a bitmap suitable for disaplaying as an icon at various system UIs. */ private BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user, boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale, boolean addShadow) { if (scale == null) { scale = new float[1]; } icon = normalizeAndWrapToAdaptiveIcon(icon, shrinkNonAdaptiveIcons, null, scale); Bitmap bitmap = createIconBitmap(icon, scale[0]); if (ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) { if (addShadow) { mCanvas.setBitmap(bitmap); getShadowGenerator().recreateIcon(Bitmap.createBitmap(bitmap), mCanvas); mCanvas.setBitmap(null); } } if (isInstantApp) { badgeWithDrawable(bitmap, mContext.getDrawable(R.drawable.ic_instant_app_badge)); Loading iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java +1 −1 Original line number Diff line number Diff line Loading @@ -510,7 +510,7 @@ public abstract class BaseIconCache { * Cache class to store the actual entries on disk */ public static final class IconDB extends SQLiteCacheHelper { private static final int RELEASE_VERSION = 27; private static final int RELEASE_VERSION = 28; public static final String TABLE_NAME = "icons"; public static final String COLUMN_ROWID = "rowid"; Loading Loading
iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +25 −4 Original line number Diff line number Diff line Loading @@ -199,7 +199,7 @@ public class BaseIconFactory implements AutoCloseable { /** * Creates bitmap using the source drawable and various parameters. * The bitmap is visually normalized with other icons and has enough spacing to add shadow. * The bitmap is visually normalized with other icons. * * @param icon source of the icon * @param user info can be used for a badge Loading @@ -210,16 +210,37 @@ public class BaseIconFactory implements AutoCloseable { */ public BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user, boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale) { return createBadgedIconBitmap(icon, user, shrinkNonAdaptiveIcons, isInstantApp, scale, false /* addShadow */); } /** * Creates bitmap using the source drawable and various parameters. * The bitmap is visually normalized with other icons and has enough spacing to add shadow. * * @param icon source of the icon * @param user info can be used for a badge * @param shrinkNonAdaptiveIcons {@code true} if non adaptive icons should be treated * @param isInstantApp info can be used for a badge * @param scale returns the scale result from normalization * @param addShadow If true, adds a shadow under the icon. * @return a bitmap suitable for disaplaying as an icon at various system UIs. */ private BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user, boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale, boolean addShadow) { if (scale == null) { scale = new float[1]; } icon = normalizeAndWrapToAdaptiveIcon(icon, shrinkNonAdaptiveIcons, null, scale); Bitmap bitmap = createIconBitmap(icon, scale[0]); if (ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) { if (addShadow) { mCanvas.setBitmap(bitmap); getShadowGenerator().recreateIcon(Bitmap.createBitmap(bitmap), mCanvas); mCanvas.setBitmap(null); } } if (isInstantApp) { badgeWithDrawable(bitmap, mContext.getDrawable(R.drawable.ic_instant_app_badge)); Loading
iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java +1 −1 Original line number Diff line number Diff line Loading @@ -510,7 +510,7 @@ public abstract class BaseIconCache { * Cache class to store the actual entries on disk */ public static final class IconDB extends SQLiteCacheHelper { private static final int RELEASE_VERSION = 27; private static final int RELEASE_VERSION = 28; public static final String TABLE_NAME = "icons"; public static final String COLUMN_ROWID = "rowid"; Loading