diff options
author | Hyunyoung Song <hyunyoungs@google.com> | 2019-06-03 15:46:47 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-06-03 15:46:47 -0700 |
commit | 355a04ed39e0e06425b6724bbc49c921e423e35d (patch) | |
tree | 09b7aecf15f4d25f770991c968168b731b91f4e4 /src | |
parent | 80ed6012ddad9af65ced8b651c0356d9cfd87ee6 (diff) | |
parent | ed45267bf998bbd9c299da3757c0ee570c8b8932 (diff) | |
download | android_packages_apps_Trebuchet-355a04ed39e0e06425b6724bbc49c921e423e35d.tar.gz android_packages_apps_Trebuchet-355a04ed39e0e06425b6724bbc49c921e423e35d.tar.bz2 android_packages_apps_Trebuchet-355a04ed39e0e06425b6724bbc49c921e423e35d.zip |
Merge "Add shape detection logic only for circle icons" into ub-launcher3-qt-dev
am: ed45267bf9
Change-Id: I73fb9cfb2ed66bf88baa62f53714c028ea47b648
Diffstat (limited to 'src')
4 files changed, 23 insertions, 6 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index d1bd2db13..09c5e5b2b 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -243,7 +243,7 @@ public class DragView extends View implements LauncherStateManager.StateListener nDr = new AdaptiveIconDrawable(new ColorDrawable(Color.BLACK), null); } Utilities.scaleRectAboutCenter(bounds, - li.getNormalizer().getScale(nDr, null)); + li.getNormalizer().getScale(nDr, null, null, null)); } AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) dr; diff --git a/src/com/android/launcher3/graphics/IconShape.java b/src/com/android/launcher3/graphics/IconShape.java index 88e4452e1..4369385ae 100644 --- a/src/com/android/launcher3/graphics/IconShape.java +++ b/src/com/android/launcher3/graphics/IconShape.java @@ -91,6 +91,10 @@ public abstract class IconShape { private SparseArray<TypedValue> mAttrs; + public boolean enableShapeDetection(){ + return false; + }; + public abstract void drawShape(Canvas canvas, float offsetX, float offsetY, float radius, Paint paint); @@ -194,6 +198,11 @@ public abstract class IconShape { protected float getStartRadius(Rect startRect) { return startRect.width() / 2f; } + + @Override + public boolean enableShapeDetection() { + return true; + } } public static class RoundedSquare extends SimpleRectShape { diff --git a/src/com/android/launcher3/icons/LauncherIcons.java b/src/com/android/launcher3/icons/LauncherIcons.java index 5c4af1fe6..3b74307db 100644 --- a/src/com/android/launcher3/icons/LauncherIcons.java +++ b/src/com/android/launcher3/icons/LauncherIcons.java @@ -30,6 +30,7 @@ import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.ItemInfoWithIcon; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; +import com.android.launcher3.graphics.IconShape; import com.android.launcher3.model.PackageItemInfo; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.util.Themes; @@ -50,11 +51,15 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable { private static LauncherIcons sPool; private static int sPoolId = 0; + public static LauncherIcons obtain(Context context) { + return obtain(context, IconShape.getShape().enableShapeDetection()); + } + /** * Return a new Message instance from the global pool. Allows us to * avoid allocating new objects in many cases. */ - public static LauncherIcons obtain(Context context) { + public static LauncherIcons obtain(Context context, boolean shapeDetection) { int poolId; synchronized (sPoolSync) { if (sPool != null) { @@ -67,7 +72,8 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable { } InvariantDeviceProfile idp = LauncherAppState.getIDP(context); - return new LauncherIcons(context, idp.fillResIconDpi, idp.iconBitmapSize, poolId); + return new LauncherIcons(context, idp.fillResIconDpi, idp.iconBitmapSize, poolId, + shapeDetection); } public static void clearPool() { @@ -81,8 +87,9 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable { private LauncherIcons next; - private LauncherIcons(Context context, int fillResIconDpi, int iconBitmapSize, int poolId) { - super(context, fillResIconDpi, iconBitmapSize); + private LauncherIcons(Context context, int fillResIconDpi, int iconBitmapSize, int poolId, + boolean shapeDetection) { + super(context, fillResIconDpi, iconBitmapSize, shapeDetection); mPoolId = poolId; } diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index e4591b618..95c96817a 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -529,7 +529,8 @@ public class FloatingIconView extends View implements bounds.inset(mBlurSizeOutline / 2, mBlurSizeOutline / 2); try (LauncherIcons li = LauncherIcons.obtain(mLauncher)) { - Utilities.scaleRectAboutCenter(bounds, li.getNormalizer().getScale(drawable, null)); + Utilities.scaleRectAboutCenter(bounds, li.getNormalizer().getScale(drawable, null, + null, null)); } bounds.inset( |