From 621e6406fadba27d6cff1c38b31d5cdf99c0f97a Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 4 Jan 2011 16:03:57 -0800 Subject: [PATCH] Cancelling a drag should signal to the source that the drag is incomplete. Change-Id: I6464c4ccf15b550dd319e18c2e998131e46ccc0f --- src/com/android/launcher2/DragController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index 876ad8797c..0f24cd9e22 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -394,6 +394,9 @@ public class DragController { * Stop dragging without dropping. */ public void cancelDrag() { + if (mDragging) { + mDragSource.onDropCompleted(null, false); + } endDrag(); } @@ -433,21 +436,21 @@ public class DragController { switch (action) { case MotionEvent.ACTION_MOVE: break; - case MotionEvent.ACTION_DOWN: // Remember location of down touch mMotionDownX = screenX; mMotionDownY = screenY; mLastDropTarget = null; break; - - case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: if (mDragging) { drop(screenX, screenY); } endDrag(); break; + case MotionEvent.ACTION_CANCEL: + cancelDrag(); + break; } return mDragging; @@ -568,10 +571,10 @@ public class DragController { drop(screenX, screenY); } endDrag(); - break; case MotionEvent.ACTION_CANCEL: cancelDrag(); + break; } return true;