From 251ab6e8476aafe3627b0d9025cd5a7c70128f10 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 2 Dec 2016 18:54:32 -0800 Subject: [PATCH] Lower the transition threshold for dropping on Workspace. Old threshold: 0.5f New threshold: 0.25f The threshold is used when dragging to Workspace from any drag source other than Workspace, including Hotseat. This lowered threshold is more forgiving for faster drags. Bug: 33210055 Change-Id: Ic121fb4b7caa3ea66abb48a8a3f3bd36f3365749 --- src/com/android/launcher3/Workspace.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 10680b4e0..2d4af5287 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -100,6 +100,14 @@ public class Workspace extends PagedView Insettable, DropTargetSource { private static final String TAG = "Launcher.Workspace"; + /** The value that {@link #mTransitionProgress} must be greater than for + * {@link #transitionStateShouldAllowDrop()} to return true. */ + private static final float ALLOW_DROP_TRANSITION_PROGRESS = 0.25f; + + /** The value that {@link #mTransitionProgress} must be greater than for + * {@link #isFinishedSwitchingState()} ()} to return true. */ + private static final float FINISHED_SWITCHING_STATE_TRANSITION_PROGRESS = 0.5f; + private static boolean ENFORCE_DRAG_EVENT_ORDER = false; private static final int SNAP_OFF_EMPTY_SCREEN_DURATION = 400; @@ -1171,7 +1179,8 @@ public class Workspace extends PagedView /** This differs from isSwitchingState in that we take into account how far the transition * has completed. */ public boolean isFinishedSwitchingState() { - return !mIsSwitchingState || (mTransitionProgress > 0.5f); + return !mIsSwitchingState + || (mTransitionProgress > FINISHED_SWITCHING_STATE_TRANSITION_PROGRESS); } protected void onWindowVisibilityChanged (int visibility) { @@ -2273,8 +2282,8 @@ public class Workspace extends PagedView return dv; } - public boolean transitionStateShouldAllowDrop() { - return ((!isSwitchingState() || mTransitionProgress > 0.5f) && + private boolean transitionStateShouldAllowDrop() { + return ((!isSwitchingState() || mTransitionProgress > ALLOW_DROP_TRANSITION_PROGRESS) && (mState == State.NORMAL || mState == State.SPRING_LOADED)); } -- 2.11.0