From ec0d61d79ef50010660b426b259a8ccb14656b31 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 7 Feb 2014 16:34:51 -0800 Subject: [PATCH] Fix NPE in when dropping from all apps (issue 12917451) When dropping from all apps, accept drop was returning true if the item was above a folder, however, when it came time to complete the drop, the folder wouldn't accept the item. This can be prevented by increasing the criteria in acceptDrop. Change-Id: Ib644ec45984e8366c33bb674f3d3a76e22ed5160 --- src/com/android/launcher3/Workspace.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 0a7088dec..50d29ed29 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2709,12 +2709,13 @@ public class Workspace extends SmoothPagedView mTargetCell); float distance = dropTargetLayout.getDistanceFromCell(mDragViewVisualCenter[0], mDragViewVisualCenter[1], mTargetCell); - if (willCreateUserFolder((ItemInfo) d.dragInfo, dropTargetLayout, - mTargetCell, distance, true)) { + if (mCreateUserFolderOnDrop && willCreateUserFolder((ItemInfo) d.dragInfo, + dropTargetLayout, mTargetCell, distance, true)) { return true; } - if (willAddToExistingUserFolder((ItemInfo) d.dragInfo, dropTargetLayout, - mTargetCell, distance)) { + + if (mAddToExistingFolderOnDrop && willAddToExistingUserFolder((ItemInfo) d.dragInfo, + dropTargetLayout, mTargetCell, distance)) { return true; } -- 2.11.0