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

Commit f1951ce1 authored by Tony Wickham's avatar Tony Wickham
Browse files

Fix taskbar stash misalignment when going from app to overview

Keep taskbar unaligned with hotseat if we're stashing anyway

Test: Swipe up from app with taskbar present to overview, check frame by frame to ensure icons morph directly into the handle instead of above it
Fixes: 208697792
Change-Id: If3238286b3383e75eb71fbd3b97d34bb3b44340b
parent 3d206ca9
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -121,6 +121,7 @@ import java.util.function.Supplier;
        // If going home, align the icons to hotseat
        // If going home, align the icons to hotseat
        AnimatorSet animatorSet = new AnimatorSet();
        AnimatorSet animatorSet = new AnimatorSet();


        // Update stashed flags first to ensure goingToUnstashedLauncherState() returns correctly.
        TaskbarStashController stashController = mControllers.taskbarStashController;
        TaskbarStashController stashController = mControllers.taskbarStashController;
        stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE,
        stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE,
                toState.isTaskbarStashed());
                toState.isTaskbarStashed());
@@ -195,7 +196,8 @@ import java.util.function.Supplier;
        if (hasAnyFlag(changedFlags, FLAG_RESUMED)) {
        if (hasAnyFlag(changedFlags, FLAG_RESUMED)) {
            boolean isResumed = isResumed();
            boolean isResumed = isResumed();
            ObjectAnimator anim = mIconAlignmentForResumedState
            ObjectAnimator anim = mIconAlignmentForResumedState
                    .animateToValue(isResumed ? 1 : 0)
                    .animateToValue(isResumed && goingToUnstashedLauncherState()
                            ? 1 : 0)
                    .setDuration(duration);
                    .setDuration(duration);


            anim.addListener(new AnimatorListenerAdapter() {
            anim.addListener(new AnimatorListenerAdapter() {
@@ -219,7 +221,8 @@ import java.util.function.Supplier;
        if (hasAnyFlag(changedFlags, FLAG_RECENTS_ANIMATION_RUNNING)) {
        if (hasAnyFlag(changedFlags, FLAG_RECENTS_ANIMATION_RUNNING)) {
            boolean isRecentsAnimationRunning = isRecentsAnimationRunning();
            boolean isRecentsAnimationRunning = isRecentsAnimationRunning();
            Animator animator = mIconAlignmentForGestureState
            Animator animator = mIconAlignmentForGestureState
                    .animateToValue(isRecentsAnimationRunning ? 1 : 0);
                    .animateToValue(isRecentsAnimationRunning && goingToUnstashedLauncherState()
                            ? 1 : 0);
            if (isRecentsAnimationRunning) {
            if (isRecentsAnimationRunning) {
                animator.setDuration(duration);
                animator.setDuration(duration);
            }
            }
@@ -253,6 +256,11 @@ import java.util.function.Supplier;
        return animatorSet;
        return animatorSet;
    }
    }


    /** Returns whether we're going to a state where taskbar icons should align with launcher. */
    private boolean goingToUnstashedLauncherState() {
        return !mControllers.taskbarStashController.isInStashedLauncherState();
    }

    private void playStateTransitionAnim(boolean isTransitionStateStashed,
    private void playStateTransitionAnim(boolean isTransitionStateStashed,
            AnimatorSet animatorSet, long duration, boolean committed) {
            AnimatorSet animatorSet, long duration, boolean committed) {
        TaskbarStashController controller = mControllers.taskbarStashController;
        TaskbarStashController controller = mControllers.taskbarStashController;
+7 −0
Original line number Original line Diff line number Diff line
@@ -216,6 +216,13 @@ public class TaskbarStashController {
        return hasAnyFlag(FLAGS_STASHED_IN_APP);
        return hasAnyFlag(FLAGS_STASHED_IN_APP);
    }
    }


    /**
     * Returns whether the taskbar should be stashed in the current LauncherState.
     */
    public boolean isInStashedLauncherState() {
        return hasAnyFlag(FLAG_IN_STASHED_LAUNCHER_STATE) && supportsVisualStashing();
    }

    private boolean hasAnyFlag(int flagMask) {
    private boolean hasAnyFlag(int flagMask) {
        return hasAnyFlag(mState, flagMask);
        return hasAnyFlag(mState, flagMask);
    }
    }