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

Commit 413e7d44 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Subtracting the touchSlop when dragging the window, to prevent initial...

Merge "Subtracting the touchSlop when dragging the window, to prevent initial jump" into ub-launcher3-master
parents 30cd59a7 1c22aa13
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {

    private static final long RECENTS_VIEW_VISIBILITY_DELAY = 120;
    private static final long RECENTS_VIEW_VISIBILITY_DURATION = 150;
    private static final long DEFAULT_SWIPE_DURATION = 200;
    private static final long MAX_SWIPE_DURATION = 200;
    private static final long MIN_SWIPE_DURATION = 80;

    // Ideal velocity for a smooth transition
    private static final float PIXEL_PER_MS = 2f;
@@ -128,8 +129,8 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
        new Handler().postDelayed(() -> mStateCallback.setState(STATE_RECENTS_DELAY_COMPLETE),
                RECENTS_VIEW_VISIBILITY_DELAY);

        long duration = Math.min(DEFAULT_SWIPE_DURATION,
                Math.max((long) (-mCurrentDisplacement / PIXEL_PER_MS), 0));
        long duration = Math.min(MAX_SWIPE_DURATION,
                Math.max((long) (-mCurrentDisplacement / PIXEL_PER_MS), MIN_SWIPE_DURATION));
        if (mCurrentShift.getCurrentAnimation() != null) {
            ObjectAnimator anim = mCurrentShift.getCurrentAnimation();
            long theirDuration = anim.getDuration() - anim.getCurrentPlayTime();
@@ -264,7 +265,7 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
        float flingThreshold = res.getDimension(R.dimen.quickstep_fling_threshold_velocity);
        boolean isFling = Math.abs(endVelocity) > flingThreshold;

        long duration = DEFAULT_SWIPE_DURATION;
        long duration = MAX_SWIPE_DURATION;
        final float endShift;
        if (!isFling) {
            endShift = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW ? 1 : 0;
+3 −1
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ public class TouchInteractionService extends Service {
    private int mActivePointerId = INVALID_POINTER_ID;
    private VelocityTracker mVelocityTracker;
    private int mTouchSlop;
    private float mStartDisplacement;
    private NavBarSwipeInteractionHandler mInteractionHandler;

    private ISystemUiProxy mISystemUiProxy;
@@ -184,11 +185,12 @@ public class TouchInteractionService extends Service {
                float displacement = ev.getY(pointerIndex) - mDownPos.y;
                if (mInteractionHandler == null) {
                    if (Math.abs(displacement) >= mTouchSlop) {
                        mStartDisplacement = Math.signum(displacement) * mTouchSlop;
                        startTouchTracking();
                    }
                } else {
                    // Move
                    mInteractionHandler.updateDisplacement(displacement);
                    mInteractionHandler.updateDisplacement(displacement - mStartDisplacement);
                }
                break;
            }