From c8392ea8810247825300d6bdb72dbddee99e7006 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Fri, 28 Oct 2022 16:38:37 -0700 Subject: [PATCH] Return the right radius to start reorder when dragging a Widget Currently the radius is only one cell but in the case of a widget we want the radius of the whole widget. Fix: 255421400 Test: this case only happens when dagging comming from outside of the cell layuot in the corners dragging a widget Change-Id: I3fe294d18283dbecb27df1a2d4748dd44db9b956 --- src/com/android/launcher3/CellLayout.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 75d7b6b203..f3ea626679 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -941,7 +941,7 @@ public class CellLayout extends ViewGroup { cellToRect(targetCell[0], targetCell[1], spanX, spanY, cellBoundsWithSpacing); cellBoundsWithSpacing.inset(-mBorderSpace.x / 2, -mBorderSpace.y / 2); - if (canCreateFolder(getChildAt(targetCell[0], targetCell[1]))) { + if (canCreateFolder(getChildAt(targetCell[0], targetCell[1])) && spanX == 1 && spanY == 1) { // Take only the circle in the smaller dimension, to ensure we don't start reordering // too soon before accepting a folder drop. int minRadius = centerPoint[0] - cellBoundsWithSpacing.left; @@ -951,8 +951,9 @@ public class CellLayout extends ViewGroup { return minRadius; } // Take up the entire cell, including space between this cell and the adjacent ones. - return (float) Math.hypot(cellBoundsWithSpacing.width() / 2f, - cellBoundsWithSpacing.height() / 2f); + // Multiply by span to scale radius + return (float) Math.hypot(spanX * cellBoundsWithSpacing.width() / 2f, + spanY * cellBoundsWithSpacing.height() / 2f); } public int getCellWidth() {