I want to implement ImageView RotationXBy(180f) when my dropDown is being shown. So the problem is when user clicks on view very fast, my arrow view dissapears/rotates into a very small. How to handle multiple animation start with cancelling the previous animation?
I call the animation when user clicks the view:
spinner_petType.setOnShowListener(object : EditSpinner.OnShowListener {
override fun onShow() {
arrow_down_type.animate()
.rotationXBy(180f)
.duration = 200
hideSoftInputPanel()
}
})
And when user dismiss the dropDown:
spinner_petType.setOnDismissListener {
arrow_down_type.animate()
.rotationXBy(180f).duration = 200
}
So the animation don't wait until the other animation end. I tried to add Listener and disable view, but this method breaks my logic. Help!