How to set delay time to List adapter default animation

600 Views Asked by At

Every thing in List Adapter Works fine. But I want to set delay time while it doing its default animation. It was like super speed. But I need set a delay of 500L

Consider a Page that has Edittext and Recyclerview. When the page open everything works fine. But when user typed any words in Edit Text filter process takes place. After filter I update the list by following code

someAdapter.apply {
   submitList(someList.toList())
}

Problem is default animation of List adaper is super speed.

2

There are 2 best solutions below

0
Vinayak Moger On BEST ANSWER
recyclerview.itemAnimator!!.changeDuration = 2000L
0
MrLittle On

You can edit the following parameters in the recyclerView class:

init {
    itemAnimator!!.changeDuration = 2000L  //default value: 250 
    itemAnimator!!.addDuration = 2000L  //default value: 120
    itemAnimator!!.moveDuration = 2000L  //default value: 250
    itemAnimator!!.removeDuration = 2000L  //default value: 120
}