From eb6a154230be51f039f1894818b97091a3d73639 Mon Sep 17 00:00:00 2001 From: Andras Kloczl Date: Tue, 9 Aug 2022 10:53:33 +0200 Subject: [PATCH] Fix widget jump bug when moved to invalid place When dropTargetLayout is null we don't need to animate the widget to the closest location but move it back to its original position. Test: manual Bug: 236135424 Change-Id: I50a793732cd9656605fdc9908f71ff0efa7e69e9 --- src/com/android/launcher3/Workspace.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 2bc5e646a0..4c9542d5c9 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2122,7 +2122,8 @@ public class Workspace extends PagedView final ItemInfo info = (ItemInfo) cell.getTag(); boolean isWidget = info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET; - if (isWidget) { + if (isWidget && dropTargetLayout != null) { + // animate widget to a valid place int animationType = resizeOnDrop ? ANIMATE_INTO_POSITION_AND_RESIZE : ANIMATE_INTO_POSITION_AND_DISAPPEAR; animateWidgetDrop(info, parent, d.dragView, null, animationType, cell, false);