Merge "Track overview animation as atomic animation." into ub-launcher3-master
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
index ff1b5f6..b80830a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
@@ -43,6 +43,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppTransitionManagerImpl;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -87,6 +88,10 @@
if (handlingOverviewAnim()) {
mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged);
}
+
+ if (mAtomicAnim != null) {
+ mAtomicAnim.cancel();
+ }
}
protected void onMotionPauseChanged(boolean isPaused) {
@@ -193,13 +198,27 @@
Animator overviewAnim = mLauncher.getAppTransitionManager().createStateElementAnimation(
INDEX_PAUSE_TO_OVERVIEW_ANIM);
- overviewAnim.addListener(new AnimatorListenerAdapter() {
+ mAtomicAnim = new AnimatorSet();
+ mAtomicAnim.addListener(new AnimationSuccessListener() {
@Override
- public void onAnimationEnd(Animator animation) {
+ public void onAnimationSuccess(Animator animator) {
onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE);
}
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ if (mCancelled) {
+ mPeekAnim = mLauncher.getStateManager().createAtomicAnimation(mFromState,
+ mToState, new AnimatorSetBuilder(), ATOMIC_OVERVIEW_PEEK_COMPONENT,
+ PEEK_OUT_ANIM_DURATION);
+ mPeekAnim.start();
+ }
+ mAtomicAnim = null;
+ }
});
- overviewAnim.start();
+ mAtomicAnim.play(overviewAnim);
+ mAtomicAnim.start();
}
@Override