Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83b7a6d8 authored by vadimt's avatar vadimt
Browse files

Accelerating dragging to workspace by using pause at the end of the

gesture

Change-Id: Ib14b9519e23aa34156dab9eff75cd2609ad57e14
parent 8bdd83ec
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -873,12 +873,17 @@ public final class LauncherInstrumentation {
        final Point start = new Point(startX, startY);
        final Point end = new Point(endX, endY);
        sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start);
        final long endTime = movePointer(start, end, steps, downTime, slowDown);
        sendPointer(downTime, endTime, MotionEvent.ACTION_UP, end);
    }

    long movePointer(Point start, Point end, int steps, long downTime, boolean slowDown) {
        long endTime = movePointer(downTime, downTime, steps * GESTURE_STEP_MS, start, end);
        if (slowDown) {
            endTime = movePointer(downTime, endTime + GESTURE_STEP_MS, 5 * GESTURE_STEP_MS, end,
                    end);
        }
        sendPointer(downTime, endTime, MotionEvent.ACTION_UP, end);
        return endTime;
    }

    void waitForIdle() {
+1 −3
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import com.android.launcher3.testing.TestProtocol;
 * Operations on the workspace screen.
 */
public final class Workspace extends Home {
    private static final int DRAG_DURATION = 500;
    private static final int FLING_STEPS = 10;
    private final UiObject2 mHotseat;

@@ -170,8 +169,7 @@ public final class Workspace extends Home {
        LauncherInstrumentation.log("dragIconToWorkspace: sent down");
        launcher.waitForLauncherObject(longPressIndicator);
        LauncherInstrumentation.log("dragIconToWorkspace: indicator");
        launcher.movePointer(
                downTime, SystemClock.uptimeMillis(), DRAG_DURATION, launchableCenter, dest);
        launcher.movePointer(launchableCenter, dest, 10, downTime, true);
        LauncherInstrumentation.log("dragIconToWorkspace: moved pointer");
        launcher.sendPointer(
                downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);