Cancelling a drag should signal to the source that the drag is incomplete.
Change-Id: I6464c4ccf15b550dd319e18c2e998131e46ccc0f
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 876ad87..0f24cd9 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -394,6 +394,9 @@
* Stop dragging without dropping.
*/
public void cancelDrag() {
+ if (mDragging) {
+ mDragSource.onDropCompleted(null, false);
+ }
endDrag();
}
@@ -433,21 +436,21 @@
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 @@
drop(screenX, screenY);
}
endDrag();
-
break;
case MotionEvent.ACTION_CANCEL:
cancelDrag();
+ break;
}
return true;