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

Commit 4a9a6781 authored by Jon Miranda's avatar Jon Miranda Committed by Jon @
Browse files

Prevent taskbar reset animation from playing when gesture is in progress.

This fixes the bug that appears when you launch an app and immediately
swipe up on taskbar.

Fixes: 278617335
Test: launch app, immediately swipe up on taskbar
Flag: NONE
Change-Id: I56eddfae9c81b1ef827622cf0f13ffd26fadd5c3
parent ac7c1e37
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable

    private boolean mHasSprungOnceThisGesture;
    private @Nullable ValueAnimator mSpringBounce;
    private boolean mGestureInProgress;
    private boolean mGestureEnded;
    private boolean mAnimationToHomeRunning;

@@ -155,7 +156,12 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
    /**
     * Returns an animation to reset the taskbar translation to {@code 0}.
     */
    public ObjectAnimator createAnimToResetTranslation(long duration) {
    public ValueAnimator createAnimToResetTranslation(long duration) {
        if (mGestureInProgress) {
            // Return an empty animator as the translation will reset itself after gesture ends.
            return ValueAnimator.ofFloat(0).setDuration(duration);
        }

        ObjectAnimator animator = mTranslationYForSwipe.animateToValue(0);
        animator.setInterpolator(Interpolators.LINEAR);
        animator.setDuration(duration);
@@ -192,6 +198,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
            mAnimationToHomeRunning = false;
            cancelSpringIfExists();
            reset();
            mGestureInProgress = true;
        }
        /**
         * Called when there is movement to move the taskbar.
@@ -215,6 +222,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
                mGestureEnded = true;
                startSpring();
            }
            mGestureInProgress = false;
        }
    }