summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/dragndrop/DragView.java2
-rw-r--r--src/com/android/launcher3/graphics/IconShape.java9
-rw-r--r--src/com/android/launcher3/icons/LauncherIcons.java15
-rw-r--r--src/com/android/launcher3/touch/WorkspaceTouchListener.java5
-rw-r--r--src/com/android/launcher3/views/FloatingIconView.java3
5 files changed, 27 insertions, 7 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/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
index 07ddccb31..310d598b2 100644
--- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java
+++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
@@ -99,7 +99,6 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
handleLongPress = mTempRect.contains((int) ev.getX(), (int) ev.getY());
}
- cancelLongPress();
if (handleLongPress) {
mLongPressState = STATE_REQUESTED;
mTouchDownPoint.set(ev.getX(), ev.getY());
@@ -148,6 +147,10 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
}
}
+ if (action == ACTION_UP || action == ACTION_CANCEL) {
+ cancelLongPress();
+ }
+
return result;
}
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(