SkeletonLayout icon indicating copy to clipboard operation
SkeletonLayout copied to clipboard

Does not work with DiffUtill

Open Stashevskiy opened this issue 5 years ago • 1 comments

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?

Stashevskiy avatar Nov 19 '20 13:11 Stashevskiy

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"

ajans avatar Jan 18 '21 15:01 ajans