Merge "Ensure final values are set when StaggeredWorkspaceAnim is cancelled/ended." into ub-launcher3-rvc-dev

This commit is contained in:
Jonathan Miranda
2020-04-29 16:37:50 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 0 deletions
@@ -202,6 +202,12 @@ public class StaggeredWorkspaceAnim {
alpha.setInterpolator(LINEAR);
alpha.setDuration(ALPHA_DURATION_MS);
alpha.setStartDelay(startDelay);
alpha.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
v.setAlpha(1f);
}
});
mAnimators.play(alpha);
}
@@ -17,6 +17,8 @@ package com.android.launcher3.anim;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.util.FloatProperty;
@@ -195,6 +197,12 @@ public class SpringAnimationBuilder {
animator.setDuration(getDuration()).setInterpolator(LINEAR);
animator.addUpdateListener(anim ->
property.set(target, getInterpolatedValue(anim.getAnimatedFraction())));
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
property.set(target, mEndValue);
}
});
return animator;
}