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

Commit 519779ee authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Only reset fling velocity if opposite direction

Test: Go to lockscreen, open QS, close QS with a really weird touch
and check whether velocity matches finger speed tracking

Change-Id: Ib738cb428cdf177a1387a9dd4c79d094502325bd
parent 7566520f
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1313,9 +1313,12 @@ public class NotificationPanelView extends PanelView implements
            }
            return;
        }
        boolean belowFalsingThreshold = isFalseTouch();
        if (belowFalsingThreshold) {

        // If we move in the opposite direction, reset velocity and use a different duration.
        boolean oppositeDirection = false;
        if (vel > 0 && !expand || vel < 0 && expand) {
            vel = 0;
            oppositeDirection = true;
        }
        ValueAnimator animator = ValueAnimator.ofFloat(mQsExpansionHeight, target);
        if (isClick) {
@@ -1324,7 +1327,7 @@ public class NotificationPanelView extends PanelView implements
        } else {
            mFlingAnimationUtils.apply(animator, mQsExpansionHeight, target, vel);
        }
        if (belowFalsingThreshold) {
        if (oppositeDirection) {
            animator.setDuration(350);
        }
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {