Does not work with DiffUtill
Opened this issue · 1 comments
Stashevskiy commented
Hello, I found that library does not work with DiffUtill. When a new list is added, it will scroll to the first position. Сould you fix this?
ajans commented
I don't think this has anything to do with DiffUtil.
Try this before you set the adapter to the recyclerview:
In Kotlin:
adapter.stateRestorationPolicy =
RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY
In java:
adapter.setStateRestorationPolicy(RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY);
If you get a compilation error, try updating the recyclerview-dependency to current version:
implementation "androidx.recyclerview:recyclerview:1.2.0-beta01"