I'm working on something which requires about 10 animations to be played one after another, but there are some conditions to be checked at the end of each animation, so I can't use animation set or setStartDelay.
I found it very easy to do on Jelly Bean with new methods on of which is withEndAction while I was doing it as an experiment, but now I've to implement it in an App with minSdk 10.
I'm using Nine Old Android and it works great, but using setListner is very difficult and creates code that is difficult to maintain for 10 consecutive animations.
So I was thinking, creating an Adapter that inherits from nine old androids and I could add withEndAction function which executes the runnable?
Can someone guide me on how to do that, and is there any better way of doing this?
Thanks
I used setListener
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
viewPropertyAnimator.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
doSomething();
}
});
} else {
viewPropertyAnimator.withEndAction(new Runnable() {
@Override
public void run() {
doSomething();
}
});
}
You can now use ViewCompat
and append any animations you want.
ViewCompat.animate(yourView).scaleY(3).withEndAction(yourRunnable).start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With