Move PIN/Pattern appear animation to RenderThread (2/2)
Bug: 22205322 Change-Id: Idd16de04701c330b7559bb403316f691a9a717e9
This commit is contained in:
@@ -499,40 +499,12 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
final Runnable finishListener) {
|
final Runnable finishListener) {
|
||||||
if (obj instanceof LockPatternView.CellState) {
|
if (obj instanceof LockPatternView.CellState) {
|
||||||
final LockPatternView.CellState animatedCell = (LockPatternView.CellState) obj;
|
final LockPatternView.CellState animatedCell = (LockPatternView.CellState) obj;
|
||||||
if (appearing) {
|
mLockPatternView.startCellStateAnimation(animatedCell,
|
||||||
animatedCell.scale = 0.0f;
|
1f, appearing ? 1f : 0f, /* alpha */
|
||||||
animatedCell.alpha = 1.0f;
|
appearing ? translationY : 0f, /* startTranslation */
|
||||||
}
|
appearing ? 0f : translationY, /* endTranslation */
|
||||||
animatedCell.translateY = appearing ? translationY : 0;
|
appearing ? 0f : 1f, 1f /* scale */,
|
||||||
ValueAnimator animator = ValueAnimator.ofFloat(animatedCell.translateY,
|
delay, duration, interpolator, finishListener);
|
||||||
appearing ? 0 : translationY);
|
|
||||||
animator.setInterpolator(interpolator);
|
|
||||||
animator.setDuration(duration);
|
|
||||||
animator.setStartDelay(delay);
|
|
||||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationUpdate(ValueAnimator animation) {
|
|
||||||
float animatedFraction = animation.getAnimatedFraction();
|
|
||||||
if (appearing) {
|
|
||||||
animatedCell.scale = animatedFraction;
|
|
||||||
} else {
|
|
||||||
animatedCell.alpha = 1 - animatedFraction;
|
|
||||||
}
|
|
||||||
animatedCell.translateY = (float) animation.getAnimatedValue();
|
|
||||||
mLockPatternView.invalidate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (finishListener != null) {
|
|
||||||
animator.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
finishListener.run();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
animator.start();
|
|
||||||
mLockPatternView.invalidate();
|
|
||||||
} else {
|
} else {
|
||||||
mAppearAnimationUtils.createAnimation((View) obj, delay, duration, translationY,
|
mAppearAnimationUtils.createAnimation((View) obj, delay, duration, translationY,
|
||||||
appearing, interpolator, finishListener);
|
appearing, interpolator, finishListener);
|
||||||
|
Reference in New Issue
Block a user