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

Commit b5482137 authored by Jon Miranda's avatar Jon Miranda Committed by Automerger Merge Worker
Browse files

Merge "Allow user gesture to take priority over taskbar translation reset...

Merge "Allow user gesture to take priority over taskbar translation reset animnatiuon." into tm-qpr-dev am: 4288be12

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22464244



Change-Id: I75fdac300d2875b28ef0b230c27396c68b469ade
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 472fe81e 4288be12
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ public class TaskbarLauncherStateController {
        long resetDuration = mControllers.taskbarStashController.isInApp()
                ? duration
                : duration / 2;
        if (!mControllers.taskbarTranslationController.willAnimateToZeroBefore(resetDuration)
        if (mControllers.taskbarTranslationController.shouldResetBackToZero(resetDuration)
                && (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL)) {
            animatorSet.play(mControllers.taskbarTranslationController
                    .createAnimToResetTranslation(resetDuration));
+16 −5
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
    private boolean mHasSprungOnceThisGesture;
    private @Nullable ValueAnimator mSpringBounce;
    private boolean mGestureEnded;
    private boolean mGestureInProgress;
    private boolean mAnimationToHomeRunning;

    private final boolean mIsTransientTaskbar;
@@ -123,6 +124,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable

    private void reset() {
        mGestureEnded = false;
        mGestureInProgress = false;
        mHasSprungOnceThisGesture = false;
    }

@@ -134,18 +136,24 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
    }

    /**
     * Returns true if we will animate to zero before the input duration.
     * Returns {@code true} if we should reset the animation back to zero.
     *
     * Returns {@code false} if there is a gesture in progress, or if we are already animating
     * to 0 within the specified duration.
     */
    public boolean willAnimateToZeroBefore(long duration) {
    public boolean shouldResetBackToZero(long duration) {
        if (mGestureInProgress) {
            return false;
        }
        if (mSpringBounce != null && mSpringBounce.isRunning()) {
            long springDuration = mSpringBounce.getDuration();
            long current = mSpringBounce.getCurrentPlayTime();
            return (springDuration - current < duration);
            return (springDuration - current >= duration);
        }
        if (mTranslationYForSwipe.isAnimatingToValue(0)) {
            return mTranslationYForSwipe.getRemainingTime() < duration;
            return mTranslationYForSwipe.getRemainingTime() >= duration;
        }
        return false;
        return true;
    }

    /**
@@ -188,6 +196,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
            mAnimationToHomeRunning = false;
            cancelSpringIfExists();
            reset();
            mGestureInProgress = true;
        }
        /**
         * Called when there is movement to move the taskbar.
@@ -211,6 +220,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
                mGestureEnded = true;
                startSpring();
            }
            mGestureInProgress = false;
        }
    }

@@ -222,6 +232,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
        pw.println(prefix + "\tmHasSprungOnceThisGesture=" + mHasSprungOnceThisGesture);
        pw.println(prefix + "\tmAnimationToHomeRunning=" + mAnimationToHomeRunning);
        pw.println(prefix + "\tmGestureEnded=" + mGestureEnded);
        pw.println(prefix + "\tmGestureInProgress=" + mGestureInProgress);
        pw.println(prefix + "\tmSpringBounce is running=" + (mSpringBounce != null
                && mSpringBounce.isRunning()));
    }