mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Actually call LauncherTransitionable.onLauncherTransitionStep().
Previously, it was only called at the start and end of the transition; now it is called as the animation interpolates. Specifically, a dummy ValueAnimator is played alongside the transition animation and calls dispatchOnLauncherTransitionStep() as it goes. One place where this is important is in Workspace, where mTransitionProgress is used to determine things like whether the workspace should accept a drop - hence the bug that caused apps dragged from All Apps to vanish when dropped before the transition ended. Bug: 24215358 Change-Id: I32cd633c53557305caf84e87c9a4d4f07eef2223
This commit is contained in:
@@ -22,6 +22,7 @@ import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Resources;
|
||||
import android.util.Log;
|
||||
@@ -229,6 +230,8 @@ public class LauncherStateTransitionAnimation {
|
||||
startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState,
|
||||
animated ? revealDuration : 0, overlaySearchBarView);
|
||||
|
||||
Animator updateTransitionStepAnim = dispatchOnLauncherTransitionStepAnim(fromView, toView);
|
||||
|
||||
if (animated && initialized) {
|
||||
// Setup the reveal view animation
|
||||
int width = revealView.getMeasuredWidth();
|
||||
@@ -342,11 +345,12 @@ public class LauncherStateTransitionAnimation {
|
||||
animation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
animation.play(updateTransitionStepAnim);
|
||||
|
||||
// Dispatch the prepare transition signal
|
||||
dispatchOnLauncherTransitionPrepare(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionPrepare(toView, animated, false);
|
||||
|
||||
|
||||
final AnimatorSet stateAnimation = animation;
|
||||
final Runnable startAnimRunnable = new Runnable() {
|
||||
public void run() {
|
||||
@@ -401,6 +405,24 @@ public class LauncherStateTransitionAnimation {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Animator that calls {@link #dispatchOnLauncherTransitionStep(View, float)} on
|
||||
* {@param fromView} and {@param toView} as the animation interpolates.
|
||||
*
|
||||
* This is a bit hacky: we create a dummy ValueAnimator just for the AnimatorUpdateListener.
|
||||
*/
|
||||
private Animator dispatchOnLauncherTransitionStepAnim(final View fromView, final View toView) {
|
||||
ValueAnimator updateAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
updateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
dispatchOnLauncherTransitionStep(fromView, animation.getAnimatedFraction());
|
||||
dispatchOnLauncherTransitionStep(toView, animation.getAnimatedFraction());
|
||||
}
|
||||
});
|
||||
return updateAnimator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts and animation to the workspace from the apps view.
|
||||
*/
|
||||
@@ -509,12 +531,16 @@ public class LauncherStateTransitionAnimation {
|
||||
startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState,
|
||||
animated ? revealDuration : 0, overlaySearchBarView);
|
||||
|
||||
Animator updateTransitionStepAnim = dispatchOnLauncherTransitionStepAnim(fromView, toView);
|
||||
|
||||
if (animated && initialized) {
|
||||
// Play the workspace animation
|
||||
if (workspaceAnim != null) {
|
||||
animation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
animation.play(updateTransitionStepAnim);
|
||||
|
||||
// hideAppsCustomizeHelper is called in some cases when it is already hidden
|
||||
// don't perform all these no-op animations. In particularly, this was causing
|
||||
// the all-apps button to pop in and out.
|
||||
|
||||
Reference in New Issue
Block a user