setAndAnimateDrawable

fun setAndAnimateDrawable(@DrawableRes resId: Int, context: Context, drawableHolder: ImageView, onAnimationComplete: () -> Unit? = null)

Creates and sets a drawable to the holder view, if the drawable is animatable, the animation is started and the callback function gets invoked once its finished.

Parameters

drawableHolder

An ImageView instance to set the drawable to, if created.

onAnimationComplete

A function to run when the drawable animation ends, if able to animate. If a function is provided but the drawable can't be animated, the function will run immediately.