From: Adam Cohen Date: Sat, 8 Feb 2014 00:34:51 +0000 (-0800) Subject: Fix NPE in when dropping from all apps (issue 12917451) X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ec0d61d79ef50010660b426b259a8ccb14656b31;p=android-x86%2Fpackages-apps-Trebuchet.git 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 --- 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; }