summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-03-28 16:56:30 -0700
committerTony Wickham <twickham@google.com>2016-03-29 12:41:14 -0700
commit855b1b5fff5f6f03a641b3b6973780a24fd9641e (patch)
treeb33415fbe8d3fac286c093549cb26f220a6099ab /src/com/android/launcher3/dragndrop
parent1f5d3ccc253ab0e4b2abb911a83e7f4d33b6869f (diff)
downloadandroid_packages_apps_Trebuchet-855b1b5fff5f6f03a641b3b6973780a24fd9641e.tar.gz
android_packages_apps_Trebuchet-855b1b5fff5f6f03a641b3b6973780a24fd9641e.tar.bz2
android_packages_apps_Trebuchet-855b1b5fff5f6f03a641b3b6973780a24fd9641e.zip
Add distance threshold for dragged items before accepted by targets.
With the new spring-loaded workspace, items are often very close to button drop targets (e.g. App Info) at the start of a drag. This threshold makes it less likely to accidentally drop on a target. Bug: 24099531 Change-Id: I4912ceeb0b63958816177c7bde073e825176d987
Diffstat (limited to 'src/com/android/launcher3/dragndrop')
-rw-r--r--src/com/android/launcher3/dragndrop/DragController.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 7524128d4..f4470f320 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -276,6 +276,9 @@ public class DragController implements DragDriver.EventListener {
mLauncher.getDragLayer().performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
dragView.show(mMotionDownX, mMotionDownY);
+ mDistanceSinceScroll = 0;
+ mLastTouch[0] = mMotionDownX;
+ mLastTouch[1] = mMotionDownY;
handleMoveEvent(mMotionDownX, mMotionDownY);
return dragView;
}
@@ -536,6 +539,10 @@ public class DragController implements DragDriver.EventListener {
checkScrollState(x, y);
}
+ public float getDistanceDragged() {
+ return mDistanceSinceScroll;
+ }
+
public void forceTouchMove() {
int[] dummyCoordinates = mCoordinatesTemp;
DropTarget dropTarget = findDropTarget(mLastTouch[0], mLastTouch[1], dummyCoordinates);