Track LauncherState for task bar stashing better

- Animate in onStateTransitionStart
- Commit in onStateTransitionComplete

Fixes: 193938970
Fixes: 200765631
Fixes: 201644899
Test: Go home from overview; Go to all apps from home; Go to overview from home
Change-Id: I393022c86f09806fea29fb5bc7191304b473f231
This commit is contained in:
Tracy Zhou
2021-09-30 10:14:34 -07:00
parent 32f3616f0c
commit ae88197e5f
4 changed files with 104 additions and 17 deletions

View File

@@ -63,7 +63,7 @@ public class TaskbarStashController {
/**
* How long to stash/unstash when manually invoked via long press.
*/
private static final long TASKBAR_STASH_DURATION = 300;
public static final long TASKBAR_STASH_DURATION = 300;
/**
* The scale TaskbarView animates to when being stashed.
@@ -271,7 +271,12 @@ public class TaskbarStashController {
return false;
}
private Animator createAnimToIsStashed(boolean isStashed, long duration) {
/**
* Create a stash animation and save to {@link #mAnimator}.
* @param isStashed whether it's a stash animation or an unstash animation
* @param duration duration of the animation
*/
private void createAnimToIsStashed(boolean isStashed, long duration) {
if (mAnimator != null) {
mAnimator.cancel();
}
@@ -281,7 +286,7 @@ public class TaskbarStashController {
// Just hide/show the icons instead of stashing into a handle.
mAnimator.play(mIconAlphaForStash.animateToValue(isStashed ? 0 : 1)
.setDuration(duration));
return mAnimator;
return;
}
AnimatorSet fullLengthAnimatorSet = new AnimatorSet();
@@ -353,7 +358,6 @@ public class TaskbarStashController {
mAnimator = null;
}
});
return mAnimator;
}
/**
@@ -473,12 +477,13 @@ public class TaskbarStashController {
boolean isStashed = mStashCondition.test(flags);
if (mIsStashed != isStashed) {
mIsStashed = isStashed;
Animator animator = createAnimToIsStashed(mIsStashed, duration);
createAnimToIsStashed(mIsStashed, duration);
if (start) {
animator.start();
mAnimator.start();
}
return mAnimator;
}
return mAnimator;
return null;
}
}
}