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
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 10680b4..2d4af52 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -100,6 +100,14 @@
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 @@
/** 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 @@
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));
}