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:
Tony Wickham
2015-10-02 16:22:08 -07:00
parent fd4264b2b5
commit 0bb211a9d5
3 changed files with 45 additions and 18 deletions

View File

@@ -24,7 +24,6 @@ import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewTreeObserver;
import com.android.launcher3.util.UiThreadCircularReveal;
@@ -59,24 +58,25 @@ public class LauncherAnimUtils {
// it should be cancelled
public static void startAnimationAfterNextDraw(final Animator animator, final View view) {
view.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
private boolean mStarted = false;
public void onDraw() {
if (mStarted) return;
mStarted = true;
// Use this as a signal that the animation was cancelled
if (animator.getDuration() == 0) {
return;
}
animator.start();
private boolean mStarted = false;
final ViewTreeObserver.OnDrawListener listener = this;
view.post(new Runnable() {
public void run() {
view.getViewTreeObserver().removeOnDrawListener(listener);
}
});
public void onDraw() {
if (mStarted) return;
mStarted = true;
// Use this as a signal that the animation was cancelled
if (animator.getDuration() == 0) {
return;
}
});
animator.start();
final ViewTreeObserver.OnDrawListener listener = this;
view.post(new Runnable() {
public void run() {
view.getViewTreeObserver().removeOnDrawListener(listener);
}
});
}
});
}
public static void onDestroyActivity() {