Framework drag driver now sends new event type - exited window.

When drag exits Launcher window (for example, goes to Shelf) launcher doesn't get notified
and thinks the drag is still over it. For example if there is a moved shaking icon in Hotseat,
it will keep shaking.

Fixing this.

Bug: 22028725
Change-Id: Ie57572a57a324d426c9f6e57dc0bba56630e92df
This commit is contained in:
Vadim Tryshev
2015-08-07 17:23:35 -07:00
parent 9430ff23c8
commit ceed3b87dc
2 changed files with 10 additions and 0 deletions
@@ -436,6 +436,14 @@ public class DragController implements DragDriver.EventListener {
handleMoveEvent(dragLayerPos[0], dragLayerPos[1]);
}
@Override
public void onDriverDragExitWindow() {
if (mLastDropTarget != null) {
mLastDropTarget.onDragExit(mDragObject);
mLastDropTarget = null;
}
}
@Override
public void onDriverDragEnd(float x, float y, DropTarget dropTargetOverride) {
final int[] dragLayerPos = getClampedDragLayerPos(x, y);
@@ -32,6 +32,7 @@ public abstract class DragDriver {
public interface EventListener {
void onDriverDragMove(float x, float y);
void onDriverDragExitWindow();
void onDriverDragEnd(float x, float y, DropTarget dropTargetOverride);
void onDriverDragCancel();
}
@@ -165,6 +166,7 @@ class SystemDragDriver extends DragDriver {
return true;
case DragEvent.ACTION_DRAG_EXITED:
mEventListener.onDriverDragExitWindow();
return true;
case DragEvent.ACTION_DRAG_ENDED: