OSDN Git Service

Fix NPE in when dropping from all apps (issue 12917451)
authorAdam Cohen <adamcohen@google.com>
Sat, 8 Feb 2014 00:34:51 +0000 (16:34 -0800)
committerAdam Cohen <adamcohen@google.com>
Sat, 8 Feb 2014 00:34:51 +0000 (16:34 -0800)
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

index 0a7088d..50d29ed 100644 (file)
@@ -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;
             }