Cancelling a drag should signal to the source that the drag is incomplete.

Change-Id: I6464c4ccf15b550dd319e18c2e998131e46ccc0f
This commit is contained in:
Winson Chung committed 2011-01-04 16:04:32 -08:00
1 parent c1ef5c33d9
commit 621e6406fa
1 file changed
+7 -4
@@ -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;