The RecyclerView, unlike to ListView, doesn\'t have a simple way to set an empty view to it, so one has to manage it manually, making empty view vi
Here's a little Kotlin extension method that builds on the answer by nibarius.
fun RecyclerView.executeAfterAllAnimationsAreFinished(
callback: (RecyclerView) -> Unit
) = post(
object : Runnable {
override fun run() {
if (isAnimating) {
// itemAnimator is guaranteed to be non-null after isAnimating() returned true
itemAnimator!!.isRunning {
post(this)
}
} else {
callback(this@executeAfterAllAnimationsAreFinished)
}
}
}
)