I have created an AnimatedVectorDrawable, it works pretty well, now I am looking for a way to change the animation or hide the view after it finishes. I was hoping there was
It is strange that there is no direct API for getting this. I suppose a workaround that doesn't involve overrides would just be simply to find the animation in your set of animations that takes the most amount of time, then post a delayed runnable to hide the view.
int longestAnimationTime = 500; //miliseconds, defined in XML possibly?
drawable.start();
drawableView.postDelayed(new Runnable() {
@Override
public void run() {
drawableView.setVisibility(View.GONE);
}
}, longestAnimationTime);
Downside is that it involves hard coding your longest animation time, but as long as you are referencing the same constant value both in the animation XML and in code, it would work correctly, no overrides needed.