From ea3355641e28f5830ac7450dd540f741ef060697 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Thu, 13 Aug 2015 10:48:08 -0700 Subject: [PATCH] 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 --- src/com/android/launcher3/DragDriver.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/com/android/launcher3/DragDriver.java b/src/com/android/launcher3/DragDriver.java index 9ee4b3d461..000033c2ec 100644 --- a/src/com/android/launcher3/DragDriver.java +++ b/src/com/android/launcher3/DragDriver.java @@ -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;