Preventing stutter at beginning of All Apps animation
Bug: 6579204 Change-Id: I6e4eec80726a469d51494564933fe213bfdf47d3
This commit is contained in:
@@ -2403,32 +2403,37 @@ public final class Launcher extends Activity
|
|||||||
observer = null;
|
observer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final AnimatorSet stateAnimation = mStateAnimation;
|
||||||
|
final Runnable startAnimRunnable = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// Check that mStateAnimation hasn't changed while
|
||||||
|
// we waited for a layout/draw pass
|
||||||
|
if (mStateAnimation != stateAnimation)
|
||||||
|
return;
|
||||||
|
setPivotsForZoom(toView, scale);
|
||||||
|
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||||
|
dispatchOnLauncherTransitionStart(toView, animated, false);
|
||||||
|
mWorkspace.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// Check that mStateAnimation hasn't changed while
|
||||||
|
// we waited for a layout/draw pass
|
||||||
|
if (mStateAnimation != stateAnimation)
|
||||||
|
return;
|
||||||
|
mStateAnimation.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
if (delayAnim) {
|
if (delayAnim) {
|
||||||
final AnimatorSet stateAnimation = mStateAnimation;
|
|
||||||
final OnGlobalLayoutListener delayedStart = new OnGlobalLayoutListener() {
|
final OnGlobalLayoutListener delayedStart = new OnGlobalLayoutListener() {
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
mWorkspace.post(new Runnable() {
|
mWorkspace.post(startAnimRunnable);
|
||||||
public void run() {
|
|
||||||
// Check that mStateAnimation hasn't changed while
|
|
||||||
// we waited for a layout pass
|
|
||||||
if (mStateAnimation == stateAnimation) {
|
|
||||||
// Need to update pivots for zoom if layout changed
|
|
||||||
setPivotsForZoom(toView, scale);
|
|
||||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
|
||||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
|
||||||
mStateAnimation.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
observer.removeOnGlobalLayoutListener(this);
|
observer.removeOnGlobalLayoutListener(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
observer.addOnGlobalLayoutListener(delayedStart);
|
observer.addOnGlobalLayoutListener(delayedStart);
|
||||||
} else {
|
} else {
|
||||||
setPivotsForZoom(toView, scale);
|
startAnimRunnable.run();
|
||||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
|
||||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
|
||||||
mStateAnimation.start();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toView.setTranslationX(0.0f);
|
toView.setTranslationX(0.0f);
|
||||||
@@ -2539,7 +2544,14 @@ public final class Launcher extends Activity
|
|||||||
}
|
}
|
||||||
dispatchOnLauncherTransitionStart(fromView, animated, true);
|
dispatchOnLauncherTransitionStart(fromView, animated, true);
|
||||||
dispatchOnLauncherTransitionStart(toView, animated, true);
|
dispatchOnLauncherTransitionStart(toView, animated, true);
|
||||||
mStateAnimation.start();
|
final Animator stateAnimation = mStateAnimation;
|
||||||
|
mWorkspace.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (stateAnimation != mStateAnimation)
|
||||||
|
return;
|
||||||
|
mStateAnimation.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
fromView.setVisibility(View.GONE);
|
fromView.setVisibility(View.GONE);
|
||||||
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
|
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user