Merge "[Bouncer] Reset y translation and alpha" into tm-dev am: 9ebf699935
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17821773 Change-Id: Icc7a14fd654beec44af11034e558cce23f731791 Ignore-AOSP-First: this is an automerge Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -181,10 +181,12 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> {
|
|||||||
public void createAnimation(final View view, long delay, long duration, float translationY,
|
public void createAnimation(final View view, long delay, long duration, float translationY,
|
||||||
boolean appearing, Interpolator interpolator, final Runnable endRunnable) {
|
boolean appearing, Interpolator interpolator, final Runnable endRunnable) {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
view.setAlpha(appearing ? 0f : 1.0f);
|
float targetAlpha = appearing ? 1f : 0f;
|
||||||
view.setTranslationY(appearing ? translationY : 0);
|
float targetTranslationY = appearing ? 0 : translationY;
|
||||||
|
view.setAlpha(1.0f - targetAlpha);
|
||||||
|
view.setTranslationY(translationY - targetTranslationY);
|
||||||
Animator alphaAnim;
|
Animator alphaAnim;
|
||||||
float targetAlpha = appearing ? 1f : 0f;
|
|
||||||
if (view.isHardwareAccelerated()) {
|
if (view.isHardwareAccelerated()) {
|
||||||
RenderNodeAnimator alphaAnimRt = new RenderNodeAnimator(RenderNodeAnimator.ALPHA,
|
RenderNodeAnimator alphaAnimRt = new RenderNodeAnimator(RenderNodeAnimator.ALPHA,
|
||||||
targetAlpha);
|
targetAlpha);
|
||||||
@@ -205,14 +207,21 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (endRunnable != null) {
|
alphaAnim.addListener(new AnimatorListenerAdapter() {
|
||||||
alphaAnim.addListener(new AnimatorListenerAdapter() {
|
@Override
|
||||||
@Override
|
public void onAnimationCancel(Animator animation) {
|
||||||
public void onAnimationEnd(Animator animation) {
|
// If Animation is canceled, we want to ensure UI is reset.
|
||||||
|
view.setAlpha(targetAlpha);
|
||||||
|
view.setTranslationY(targetTranslationY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
if (endRunnable != null) {
|
||||||
endRunnable.run();
|
endRunnable.run();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
alphaAnim.start();
|
alphaAnim.start();
|
||||||
startTranslationYAnimation(view, delay, duration, appearing ? 0 : translationY,
|
startTranslationYAnimation(view, delay, duration, appearing ? 0 : translationY,
|
||||||
interpolator);
|
interpolator);
|
||||||
|
|||||||
Reference in New Issue
Block a user