I have ScaleAnimation which change size of some View from small to big and then back to small (with RepeatMode = Reverse). It is repeated infinitely.
Each time animation has been repeated, I need to do some operation. I use onAnimationRepeat callback which is called when Animation reaches smallest or biggest state. But how to resolve which one of them? In other words how to get current value of ScaleAnimation?
Animation animation = new ScaleAnimation(
1f, 5f,
1f, 5f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.REVERSE);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationRepeat(Animation arg0)
{
//I NEED TO FIND OUT HERE WHETHER THE VIEW IS IN BIG OR SMALL STATE
//I can use below function but it works only on API >= 29
someView.getAnimationMatrix();
}
//other methods
});
someView.StartAnimation(animation);
I found getAnimationMatrix() method, which returns matrix of current animation values, but it is only available from API 29 and I need to support also lower Android versions.