Merge "Revert "Get animation update timing for AVD"" into mnc-dr1.5-dev am: a466e15223
am: 22116275aa
* commit '22116275aa2b7184c65b14c3e92455d76d3c67d4':
Revert "Get animation update timing for AVD"
This commit is contained in:
@@ -19,7 +19,6 @@ import android.animation.AnimatorInflater;
|
|||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
import android.animation.Animator.AnimatorListener;
|
import android.animation.Animator.AnimatorListener;
|
||||||
import android.animation.ValueAnimator;
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
@@ -141,16 +140,6 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
|
|||||||
/** Local, mutable animator set. */
|
/** Local, mutable animator set. */
|
||||||
private final AnimatorSet mAnimatorSet = new AnimatorSet();
|
private final AnimatorSet mAnimatorSet = new AnimatorSet();
|
||||||
|
|
||||||
// Setup a value animator to get animation update callbacks.
|
|
||||||
private final ValueAnimator mUpdateAnim = ValueAnimator.ofFloat(0f, 1f);
|
|
||||||
private final ValueAnimator.AnimatorUpdateListener mUpdateListener =
|
|
||||||
new ValueAnimator.AnimatorUpdateListener() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationUpdate(ValueAnimator animation) {
|
|
||||||
invalidateSelf();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resources against which this drawable was created. Used to attempt
|
* The resources against which this drawable was created. Used to attempt
|
||||||
* to inflate animators if applyTheme() doesn't get called.
|
* to inflate animators if applyTheme() doesn't get called.
|
||||||
@@ -616,32 +605,6 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
|
|||||||
if (!mHasAnimatorSet) {
|
if (!mHasAnimatorSet) {
|
||||||
mAnimatedVectorState.prepareLocalAnimators(mAnimatorSet, mRes);
|
mAnimatedVectorState.prepareLocalAnimators(mAnimatorSet, mRes);
|
||||||
mHasAnimatorSet = true;
|
mHasAnimatorSet = true;
|
||||||
// Setup an infinitely running ValueAnimator, start it when AnimatorSet starts and
|
|
||||||
// end it when AnimatorSet ends, so we get the animation update timing for
|
|
||||||
// invalidating the drawable. Ideally, we would set an update listener on AnimatorSet,
|
|
||||||
// but since AnimatorSet doesn't support that yet, this is the alternative to achieve
|
|
||||||
// the same goal.
|
|
||||||
mUpdateAnim.setRepeatCount(ValueAnimator.INFINITE);
|
|
||||||
mUpdateAnim.addUpdateListener(mUpdateListener);
|
|
||||||
mAnimatorSet.addListener(new AnimatorListener() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationStart(Animator animation) {
|
|
||||||
mUpdateAnim.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
mUpdateAnim.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationCancel(Animator animation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationRepeat(Animator animation) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mRes = null;
|
mRes = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -767,4 +730,4 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
|
|||||||
mAnimationCallbacks.clear();
|
mAnimationCallbacks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user