diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/graphics/LauncherIcons.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/com/android/launcher3/graphics/LauncherIcons.java b/src/com/android/launcher3/graphics/LauncherIcons.java index ab589f198..25f8f2e3e 100644 --- a/src/com/android/launcher3/graphics/LauncherIcons.java +++ b/src/com/android/launcher3/graphics/LauncherIcons.java @@ -225,6 +225,17 @@ public class LauncherIcons { bitmapDrawable.setTargetDensity(context.getResources().getDisplayMetrics()); } } + + Class iconClass = null; + if (FeatureFlags.ADAPTIVE_ICON_SHADOW && Utilities.isAtLeastO()) { + try { + iconClass = Class.forName("android.graphics.drawable.AdaptiveIconDrawable"); + } catch (Exception e) { + } + } + if (iconClass != null && iconClass.isAssignableFrom(icon.getClass())) { + scale *= ShadowGenerator.getScaleForBounds(new RectF(0, 0, 0, 0)); + } int sourceWidth = icon.getIntrinsicWidth(); int sourceHeight = icon.getIntrinsicHeight(); if (sourceWidth > 0 && sourceHeight > 0) { @@ -258,15 +269,8 @@ public class LauncherIcons { icon.setBounds(sOldBounds); canvas.setBitmap(null); - if (FeatureFlags.ADAPTIVE_ICON_SHADOW && Utilities.isAtLeastO()) { - try { - Class clazz = Class.forName("android.graphics.drawable.AdaptiveIconDrawable"); - if (clazz.isAssignableFrom(icon.getClass())) { - bitmap = ShadowGenerator.getInstance(context).recreateIcon(bitmap); - } - } catch (Exception e) { - // do nothing - } + if (iconClass != null && iconClass.isAssignableFrom(icon.getClass())) { + bitmap = ShadowGenerator.getInstance(context).recreateIcon(bitmap); } return bitmap; } |