Loading src/com/android/launcher3/DragController.java +11 −9 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ import java.util.HashSet; /** * Class for initiating a drag within a view or across multiple views. */ public class DragController { public class DragController implements DragDriver.EventListener { private static final String TAG = "Launcher.DragController"; /** Indicates the drag is a move. */ Loading Loading @@ -91,7 +91,7 @@ public class DragController { /** the area at the edge of the screen that makes the workspace go left * or right while you're dragging. */ private int mScrollZone; private final int mScrollZone; private DropTarget.DragObject mDragObject; Loading Loading @@ -123,7 +123,7 @@ public class DragController { private int mTmpPoint[] = new int[2]; private Rect mDragLayerRect = new Rect(); protected int mFlingToDeleteThresholdVelocity; protected final int mFlingToDeleteThresholdVelocity; private VelocityTracker mVelocityTracker; /** Loading Loading @@ -341,6 +341,7 @@ public class DragController { } endDrag(); } public void onAppsRemoved(final ArrayList<String> packageNames, HashSet<ComponentName> cns) { // Cancel the current drag if we are removing an app that we are dragging if (mDragObject != null) { Loading Loading @@ -428,18 +429,14 @@ public class DragController { mLastTouchUpTime = -1; } /** * Call this from the drag driver. */ @Override public void onDriverDragMove(float x, float y) { final int[] dragLayerPos = getClampedDragLayerPos(x, y); handleMoveEvent(dragLayerPos[0], dragLayerPos[1]); } /** * Call this from the drag driver. */ @Override public void onDriverDragEnd(float x, float y, DropTarget dropTargetOverride) { final int[] dragLayerPos = getClampedDragLayerPos(x, y); final int dragLayerX = dragLayerPos[0]; Loading Loading @@ -467,6 +464,11 @@ public class DragController { endDrag(); } @Override public void onDriverDragCancel() { cancelDrag(); } /** * Call this from a drag source view. */ Loading src/com/android/launcher3/DragDriver.java +18 −12 Original line number Diff line number Diff line Loading @@ -28,10 +28,16 @@ import android.view.View; * Base class for driving a drag/drop operation. */ public abstract class DragDriver { protected final DragController mDragController; protected final EventListener mEventListener; public DragDriver(DragController dragController) { mDragController = dragController; public interface EventListener { void onDriverDragMove(float x, float y); void onDriverDragEnd(float x, float y, DropTarget dropTargetOverride); void onDriverDragCancel(); } public DragDriver(EventListener eventListener) { mEventListener = eventListener; } /** Loading Loading @@ -113,7 +119,7 @@ class SystemDragDriver extends DragDriver { if (!mDragView.startDrag(dragData, shadowBuilder, null, flags)) { mDragging = false; mDragController.cancelDrag(); mEventListener.onDriverDragCancel(); return; } Loading Loading @@ -151,7 +157,7 @@ class SystemDragDriver extends DragDriver { case DragEvent.ACTION_DRAG_LOCATION: mLastX = event.getX(); mLastY = event.getY(); mDragController.onDriverDragMove(event.getX(), event.getY()); mEventListener.onDriverDragMove(event.getX(), event.getY()); return true; case DragEvent.ACTION_DROP: Loading @@ -172,7 +178,7 @@ class SystemDragDriver extends DragDriver { final DropTarget dropTargetOverride = acceptedByAnotherWindow ? new AnotherWindowDropTarget(mDragView.getContext()) : null; mDragController.onDriverDragEnd(mLastX, mLastY, dropTargetOverride); mEventListener.onDriverDragEnd(mLastX, mLastY, dropTargetOverride); mDragging = false; return true; Loading @@ -199,14 +205,14 @@ class InternalDragDriver extends DragDriver { switch (action) { case MotionEvent.ACTION_MOVE: mDragController.onDriverDragMove(ev.getX(), ev.getY()); mEventListener.onDriverDragMove(ev.getX(), ev.getY()); break; case MotionEvent.ACTION_UP: mDragController.onDriverDragMove(ev.getX(), ev.getY()); mDragController.onDriverDragEnd(ev.getX(), ev.getY(), null); mEventListener.onDriverDragMove(ev.getX(), ev.getY()); mEventListener.onDriverDragEnd(ev.getX(), ev.getY(), null); break; case MotionEvent.ACTION_CANCEL: mDragController.cancelDrag(); mEventListener.onDriverDragCancel(); break; } Loading @@ -219,10 +225,10 @@ class InternalDragDriver extends DragDriver { switch (action) { case MotionEvent.ACTION_UP: mDragController.onDriverDragEnd(ev.getX(), ev.getY(), null); mEventListener.onDriverDragEnd(ev.getX(), ev.getY(), null); break; case MotionEvent.ACTION_CANCEL: mDragController.cancelDrag(); mEventListener.onDriverDragCancel(); break; } Loading Loading
src/com/android/launcher3/DragController.java +11 −9 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ import java.util.HashSet; /** * Class for initiating a drag within a view or across multiple views. */ public class DragController { public class DragController implements DragDriver.EventListener { private static final String TAG = "Launcher.DragController"; /** Indicates the drag is a move. */ Loading Loading @@ -91,7 +91,7 @@ public class DragController { /** the area at the edge of the screen that makes the workspace go left * or right while you're dragging. */ private int mScrollZone; private final int mScrollZone; private DropTarget.DragObject mDragObject; Loading Loading @@ -123,7 +123,7 @@ public class DragController { private int mTmpPoint[] = new int[2]; private Rect mDragLayerRect = new Rect(); protected int mFlingToDeleteThresholdVelocity; protected final int mFlingToDeleteThresholdVelocity; private VelocityTracker mVelocityTracker; /** Loading Loading @@ -341,6 +341,7 @@ public class DragController { } endDrag(); } public void onAppsRemoved(final ArrayList<String> packageNames, HashSet<ComponentName> cns) { // Cancel the current drag if we are removing an app that we are dragging if (mDragObject != null) { Loading Loading @@ -428,18 +429,14 @@ public class DragController { mLastTouchUpTime = -1; } /** * Call this from the drag driver. */ @Override public void onDriverDragMove(float x, float y) { final int[] dragLayerPos = getClampedDragLayerPos(x, y); handleMoveEvent(dragLayerPos[0], dragLayerPos[1]); } /** * Call this from the drag driver. */ @Override public void onDriverDragEnd(float x, float y, DropTarget dropTargetOverride) { final int[] dragLayerPos = getClampedDragLayerPos(x, y); final int dragLayerX = dragLayerPos[0]; Loading Loading @@ -467,6 +464,11 @@ public class DragController { endDrag(); } @Override public void onDriverDragCancel() { cancelDrag(); } /** * Call this from a drag source view. */ Loading
src/com/android/launcher3/DragDriver.java +18 −12 Original line number Diff line number Diff line Loading @@ -28,10 +28,16 @@ import android.view.View; * Base class for driving a drag/drop operation. */ public abstract class DragDriver { protected final DragController mDragController; protected final EventListener mEventListener; public DragDriver(DragController dragController) { mDragController = dragController; public interface EventListener { void onDriverDragMove(float x, float y); void onDriverDragEnd(float x, float y, DropTarget dropTargetOverride); void onDriverDragCancel(); } public DragDriver(EventListener eventListener) { mEventListener = eventListener; } /** Loading Loading @@ -113,7 +119,7 @@ class SystemDragDriver extends DragDriver { if (!mDragView.startDrag(dragData, shadowBuilder, null, flags)) { mDragging = false; mDragController.cancelDrag(); mEventListener.onDriverDragCancel(); return; } Loading Loading @@ -151,7 +157,7 @@ class SystemDragDriver extends DragDriver { case DragEvent.ACTION_DRAG_LOCATION: mLastX = event.getX(); mLastY = event.getY(); mDragController.onDriverDragMove(event.getX(), event.getY()); mEventListener.onDriverDragMove(event.getX(), event.getY()); return true; case DragEvent.ACTION_DROP: Loading @@ -172,7 +178,7 @@ class SystemDragDriver extends DragDriver { final DropTarget dropTargetOverride = acceptedByAnotherWindow ? new AnotherWindowDropTarget(mDragView.getContext()) : null; mDragController.onDriverDragEnd(mLastX, mLastY, dropTargetOverride); mEventListener.onDriverDragEnd(mLastX, mLastY, dropTargetOverride); mDragging = false; return true; Loading @@ -199,14 +205,14 @@ class InternalDragDriver extends DragDriver { switch (action) { case MotionEvent.ACTION_MOVE: mDragController.onDriverDragMove(ev.getX(), ev.getY()); mEventListener.onDriverDragMove(ev.getX(), ev.getY()); break; case MotionEvent.ACTION_UP: mDragController.onDriverDragMove(ev.getX(), ev.getY()); mDragController.onDriverDragEnd(ev.getX(), ev.getY(), null); mEventListener.onDriverDragMove(ev.getX(), ev.getY()); mEventListener.onDriverDragEnd(ev.getX(), ev.getY(), null); break; case MotionEvent.ACTION_CANCEL: mDragController.cancelDrag(); mEventListener.onDriverDragCancel(); break; } Loading @@ -219,10 +225,10 @@ class InternalDragDriver extends DragDriver { switch (action) { case MotionEvent.ACTION_UP: mDragController.onDriverDragEnd(ev.getX(), ev.getY(), null); mEventListener.onDriverDragEnd(ev.getX(), ev.getY(), null); break; case MotionEvent.ACTION_CANCEL: mDragController.cancelDrag(); mEventListener.onDriverDragCancel(); break; } Loading