Today I encountered another really interesting issue (or probably a bug?!). This time it is related to views and animating them.

If you animate a view like this:

[view].animate().scaleX(0f).scaleY(0f).setDuration(180).setListener(object:Animator.AnimatorListener {
    override fun onAnimationRepeat(p0: Animator?) {}
    override fun onAnimationCancel(p0: Animator?) {}
    override fun onAnimationStart(p0: Animator?) {}
    override fun onAnimationEnd(p0: Animator?) {
        // Anything you do after the animation is ended
    }
}.start()

... and then hide the view: [view].visibility = View.GONE

Everything works fine until the next time you set the view's visibility to View.VISIBLE and animate the scale parameters:

[view].visibility = View.VISIBLE
[view].animate().scaleX(1f).scaleY(1f).setDuration(180).start()

There're problems showing/hiding views like the way mentioned above.

The solution:

After the animation is completed - remove the listeners!!!
[view].animate().setListener(null)