mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Merge "Fix spring not springing when unstashing." into tm-qpr-dev
This commit is contained in:
@@ -553,12 +553,16 @@ public class TaskbarLauncherStateController {
|
||||
animatorSet.play(stashAnimator);
|
||||
}
|
||||
|
||||
if (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL) {
|
||||
// Translate back to 0 at a shorter or same duration as the icon alignment animation.
|
||||
// This ensures there is no jump after switching to hotseat, e.g. when swiping up from
|
||||
// overview to home. Currently we do duration / 2 just to make it feel snappier.
|
||||
// Translate back to 0 at a shorter or same duration as the icon alignment animation.
|
||||
// This ensures there is no jump after switching to hotseat, e.g. when swiping up from
|
||||
// overview to home. When not in app, we do duration / 2 just to make it feel snappier.
|
||||
long resetDuration = mControllers.taskbarStashController.isInApp()
|
||||
? duration
|
||||
: duration / 2;
|
||||
if (!mControllers.taskbarTranslationController.willAnimateToZeroBefore(resetDuration)
|
||||
&& (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL)) {
|
||||
animatorSet.play(mControllers.taskbarTranslationController
|
||||
.createAnimToResetTranslation(duration / 2));
|
||||
.createAnimToResetTranslation(resetDuration));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,21 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
|
||||
return mCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if we will animate to zero before the input duration.
|
||||
*/
|
||||
public boolean willAnimateToZeroBefore(long duration) {
|
||||
if (mSpringBounce != null && mSpringBounce.isRunning()) {
|
||||
long springDuration = mSpringBounce.getDuration();
|
||||
long current = mSpringBounce.getCurrentPlayTime();
|
||||
return (springDuration - current < duration);
|
||||
}
|
||||
if (mTranslationYForSwipe.isAnimatingToValue(0)) {
|
||||
return mTranslationYForSwipe.getRemainingTime() < duration;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an animation to reset the taskbar translation to {@code 0}.
|
||||
*/
|
||||
|
||||
@@ -132,6 +132,15 @@ public class AnimatedFloat {
|
||||
return isAnimating() && mEndValue != null && mEndValue == endValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remaining time of the existing animation (if any).
|
||||
*/
|
||||
public long getRemainingTime() {
|
||||
return isAnimating() && mValueAnimator.isRunning()
|
||||
? Math.max(0, mValueAnimator.getDuration() - mValueAnimator.getCurrentPlayTime())
|
||||
: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether we are currently not animating, and the animation's value matches the given.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user