OSDN Git Service

Prevent clipping on the top and left side on AdaptiveIconDrawables
authorHyunyoung Song <hyunyoungs@google.com>
Tue, 6 Jun 2017 19:12:22 +0000 (12:12 -0700)
committerHyunyoung Song <hyunyoungs@google.com>
Tue, 6 Jun 2017 20:21:11 +0000 (13:21 -0700)
b/62372639

Change-Id: I0b2c0daecba2904f3e89f7b0b558d9b10f5dcbf6

src/com/android/launcher3/graphics/LauncherIcons.java
src/com/android/launcher3/graphics/ShadowGenerator.java

index 53521f2..19e5702 100644 (file)
@@ -266,9 +266,10 @@ public class LauncherIcons {
 
             sOldBounds.set(icon.getBounds());
             if (Utilities.isAtLeastO() && icon instanceof AdaptiveIconDrawable) {
-                int offset = Math.min(left, top);
+                int offset = Math.max((int)(ShadowGenerator.BLUR_FACTOR * iconBitmapSize),
+                        Math.min(left, top));
                 int size = Math.max(width, height);
-                icon.setBounds(offset, offset, offset + size, offset + size);
+                icon.setBounds(offset, offset, size, size);
             } else {
                 icon.setBounds(left, top, left+width, top+height);
             }
index 469fe34..5d8cca8 100644 (file)
@@ -35,7 +35,7 @@ public class ShadowGenerator {
 
     // Percent of actual icon size
     private static final float HALF_DISTANCE = 0.5f;
-    private static final float BLUR_FACTOR = 0.5f/48;
+    public static final float BLUR_FACTOR = 0.5f/48;
 
     // Percent of actual icon size
     private static final float KEY_SHADOW_DISTANCE = 1f/48;