From 520ffec9d387c634c3dbcef1b510616bf29d66a3 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 21 Jun 2018 13:38:53 -0700 Subject: When controlling atomic components, bound to remaining progress Before, we were just controlling the components as far as we had left, which was fine since they are just a subtle effect anyway. But now that we don't fade out until the very end, this means that long swiping from home usually kept recents in the background during the entire swipe and then abruptly disappear after letting go. Now we make sure the entire atomic animation plays by the time we reach all apps, so recents will fade out in all cases. Bug: 79867407 Change-Id: I7cb6790d9055bc76b4b73ed761604042a308c987 --- .../android/launcher3/touch/AbstractStateChangeTouchController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/com/android') diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index d478d48653..55f850c8d4 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -283,7 +283,9 @@ public abstract class AbstractStateChangeTouchController protected void updateProgress(float fraction) { mCurrentAnimation.setPlayFraction(fraction); if (mAtomicComponentsController != null) { - mAtomicComponentsController.setPlayFraction(fraction - mAtomicComponentsStartProgress); + // Make sure we don't divide by 0, and have at least a small runway. + float start = Math.min(mAtomicComponentsStartProgress, 0.9f); + mAtomicComponentsController.setPlayFraction((fraction - start) / (1 - start)); } maybeUpdateAtomicAnim(mFromState, mToState, fraction); } -- cgit v1.2.3