Fix qsb when flinging to home during gesture to overview from home
- AllAppsTransitionController should not animate alphas for atomic components even when failing fast (we already had this check for the normal flow where mProgress != targetProgress). - Don't set state to NORMAL until both the workspace stagger anim and overview peek anim are finished Test: swipe up and hold from the nav bar on the home screen, then, without lifting finger, fling upwards to return home; ensure qsb springs in staggered formation with rest of workspace, and alpha matches accordingly Bug: 154637581 Change-Id: Iafeaeac50ee8bce05492628d443c3ca4ab3d26df
This commit is contained in:
1 parent
946696124a
commit
80846543b5
3 files changed
+31
-4
No files matched your search
+23
-3
@@ -24,6 +24,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK;
|
||||
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.PointF;
|
||||
@@ -59,6 +60,8 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo
|
||||
|
||||
private boolean mDidTouchStartInNavBar;
|
||||
private boolean mReachedOverview;
|
||||
private boolean mIsOverviewRehidden;
|
||||
private boolean mIsHomeStaggeredAnimFinished;
|
||||
// The last recorded displacement before we reached overview.
|
||||
private PointF mStartDisplacement = new PointF();
|
||||
|
||||
@@ -144,6 +147,13 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo
|
||||
}
|
||||
}
|
||||
|
||||
// Used if flinging back to home after reaching overview
|
||||
private void maybeSwipeInteractionToHomeComplete() {
|
||||
if (mIsHomeStaggeredAnimFinished && mIsOverviewRehidden) {
|
||||
onSwipeInteractionCompleted(NORMAL, Touch.FLING);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean handlingOverviewAnim() {
|
||||
return mDidTouchStartInNavBar && super.handlingOverviewAnim();
|
||||
@@ -180,9 +190,17 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo
|
||||
stateManager.goToState(NORMAL, true,
|
||||
() -> onSwipeInteractionCompleted(NORMAL, Touch.FLING));
|
||||
} else {
|
||||
mIsHomeStaggeredAnimFinished = mIsOverviewRehidden = false;
|
||||
|
||||
StaggeredWorkspaceAnim staggeredWorkspaceAnim = new StaggeredWorkspaceAnim(
|
||||
mLauncher, velocity, false /* animateOverviewScrim */);
|
||||
staggeredWorkspaceAnim.start();
|
||||
staggeredWorkspaceAnim.addAnimatorListener(new AnimationSuccessListener() {
|
||||
@Override
|
||||
public void onAnimationSuccess(Animator animator) {
|
||||
mIsHomeStaggeredAnimFinished = true;
|
||||
maybeSwipeInteractionToHomeComplete();
|
||||
}
|
||||
}).start();
|
||||
|
||||
// StaggeredWorkspaceAnim doesn't animate overview, so we handle it here.
|
||||
stateManager.cancelAnimation();
|
||||
@@ -191,8 +209,10 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo
|
||||
config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK;
|
||||
AnimatorSet anim = stateManager.createAtomicAnimation(
|
||||
stateManager.getState(), NORMAL, config);
|
||||
anim.addListener(AnimationSuccessListener.forRunnable(
|
||||
() -> onSwipeInteractionCompleted(NORMAL, Touch.SWIPE)));
|
||||
anim.addListener(AnimationSuccessListener.forRunnable(() -> {
|
||||
mIsOverviewRehidden = true;
|
||||
maybeSwipeInteractionToHomeComplete();
|
||||
}));
|
||||
anim.start();
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -175,6 +175,11 @@ public class StaggeredWorkspaceAnim {
|
||||
return mAnimators;
|
||||
}
|
||||
|
||||
public StaggeredWorkspaceAnim addAnimatorListener(Animator.AnimatorListener listener) {
|
||||
mAnimators.addListener(listener);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the animation.
|
||||
*/
|
||||
|
||||
@@ -159,7 +159,9 @@ public class AllAppsTransitionController implements StateHandler<LauncherState>,
|
||||
StateAnimationConfig config, PendingAnimation builder) {
|
||||
float targetProgress = toState.getVerticalProgress(mLauncher);
|
||||
if (Float.compare(mProgress, targetProgress) == 0) {
|
||||
setAlphas(toState, config, builder);
|
||||
if (!config.onlyPlayAtomicComponent()) {
|
||||
setAlphas(toState, config, builder);
|
||||
}
|
||||
// Fail fast
|
||||
onProgressAnimationEnd();
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user