val rotate = RotateAnimation(
degreeOld, degree,
RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f).also {
it.duration = animationDuration
it.fillAfter = true
it.repeatCount = repeatCount
it.setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {}
override fun onAnimationRepeat(animation: Animation) {}
override fun onAnimationEnd(animation: Animation) {
onAnimationEnd()// do something
}
})
}
viewBinding.img.startAnimation(rotate)
There is a view in Fragment and i set animation on it.
Everything works. But when Fragment onPause, onAnimationEnd is not called.
override fun onAnimationEnd(animation: Animation) {
onAnimationEnd()// not called when Fragment onPause
}
It cant be solved in fragment onHiddenChanged or onResume etc. because I have to do something after animation end.
How to solve it.