diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-07-13 17:50:32 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-07-13 17:54:03 -0700 |
commit | 440c360bc395c43683fa9ca226e59f9e35f9e926 (patch) | |
tree | 54a690d1c973348e2f05be1b051329ecdec7a91a /src/com/android/launcher2/DragController.java | |
parent | 6569f2c80e179c2f8ed73dae6b01d971ec20f005 (diff) | |
download | android_packages_apps_Trebuchet-440c360bc395c43683fa9ca226e59f9e35f9e926.tar.gz android_packages_apps_Trebuchet-440c360bc395c43683fa9ca226e59f9e35f9e926.tar.bz2 android_packages_apps_Trebuchet-440c360bc395c43683fa9ca226e59f9e35f9e926.zip |
Fix bug with drag visualization and UserFolders.
When dragging an app shortcut, it was possible that we'd show a red rectangle
around a cell occupied by a UserFolder. This shouldn't be possible -- as soon
as that cell becomes the target drop cell, the folder should start handling
the drag and drop events.
Change-Id: I1b7a8b1aa9aeb7e2f1bd51ce8d947c06455e988f
Diffstat (limited to 'src/com/android/launcher2/DragController.java')
-rw-r--r-- | src/com/android/launcher2/DragController.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index b4f972bb2..f2fad9a08 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -394,6 +394,12 @@ public class DragController { // Drop on someone? final int[] coordinates = mCoordinatesTemp; DropTarget dropTarget = findDropTarget(screenX, screenY, coordinates); + DropTarget delegate = dropTarget.getDropTargetDelegate( + mDragSource, coordinates[0], coordinates[1], + (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo); + if (delegate != null) { + dropTarget = delegate; + } if (dropTarget != null) { if (mLastDropTarget == dropTarget) { dropTarget.onDragOver(mDragSource, coordinates[0], coordinates[1], @@ -482,13 +488,25 @@ public class DragController { final ArrayList<DropTarget> dropTargets = mDropTargets; final int count = dropTargets.size(); for (int i=count-1; i>=0; i--) { - final DropTarget target = dropTargets.get(i); + DropTarget target = dropTargets.get(i); target.getHitRect(r); + + // Convert the hit rect to screen coordinates target.getLocationOnScreen(dropCoordinates); r.offset(dropCoordinates[0] - target.getLeft(), dropCoordinates[1] - target.getTop()); + if (r.contains(x, y)) { + DropTarget delegate = target.getDropTargetDelegate(mDragSource, + x, y, (int)mTouchOffsetX, (int)mTouchOffsetY, mDragView, mDragInfo); + if (delegate != null) { + target = delegate; + target.getLocationOnScreen(dropCoordinates); + } + + // Make dropCoordinates relative to the DropTarget dropCoordinates[0] = x - dropCoordinates[0]; dropCoordinates[1] = y - dropCoordinates[1]; + return target; } } |