Fixing dragging with mouse.

If you click at the icon with mouse, then release without moving,
the framework won't generate DRAG_LOCATION events, and we'll assume
the the drag ended at (0,0) coordinate.

Fixing by updating coords at any event that has coordinates.

Bug: 22028725
Change-Id: I1872b479035e14aa9fece1532b05194fa86a4907
This commit is contained in:
Vadim Tryshev
2015-08-13 10:48:08 -07:00
parent f2c45762f2
commit ea3355641e
@@ -150,9 +150,13 @@ class SystemDragDriver extends DragDriver {
switch (action) {
case DragEvent.ACTION_DRAG_STARTED:
mLastX = event.getX();
mLastY = event.getY();
return true;
case DragEvent.ACTION_DRAG_ENTERED:
mLastX = event.getX();
mLastY = event.getY();
return true;
case DragEvent.ACTION_DRAG_LOCATION:
@@ -162,10 +166,14 @@ class SystemDragDriver extends DragDriver {
return true;
case DragEvent.ACTION_DROP:
mLastX = event.getX();
mLastY = event.getY();
mReceivedDropEvent = true;
return true;
case DragEvent.ACTION_DRAG_EXITED:
mLastX = event.getX();
mLastY = event.getY();
mEventListener.onDriverDragExitWindow();
return true;