Closed curiousily closed 5 years ago
UPDATE
If I do this:
adapter.items = newList
diff.dispatchUpdatesTo(adapter)
I do get the list to show. However, after trying to delete the second item - the list is restarted to its initial state. Again, that behaviour is not observed using "raw" adapter - everything there works just fine. Maybe I am doing the update incorrectly?
Hm, that sounds strange. AdapterDelegates is not doing something special here.
Is your app open source so that I can debug / reproduce it more easily? which version of AdaterDelegate / RecyclerView are you using?
Again, that behaviour is not observed using "raw" adapter - everything there works just fine.
With the same DiffUtil.Callback implementation?
Hi @sockeqwe,
Yes. It is open source. I've setted it up as nicely as I could for you to replicate it:
Clone this branch:
https://github.com/iPoli/iPoli-android/tree/kotlin
(I am using Android Studio Beta 3)
Adapter delegates version: com.hannesdorfmann:adapterdelegates3:3.0.1
RecyclerView version: com.android.support:recyclerview-v7:26.0.1
The Callback implementation looks the same to me.
Steps to reproduce:
onCreateView
and render
.Btw, any feedback on the MVI implementation would be greatly appreciated!
Thank you for looking into the issue!
Regards
Thanks, i will take a look tomorrow.
Sorry for the long silence. Unfortunately, I haven't had time yet to checkout your source code (but the UI looks gorgeous! well done!).
However, I hacked together a little demo that shows that the DiffUtils and animations are working as intended. See here (part of this repository, you can launch the sample app):
So AdapterDelegates is not really doing anything special here when it comes to applying DiffUtil.Results. it just forwards the adapter calls to the corresponding AdapterDelegate. Therefore it sounds pretty strange that you face an issue with DiffUtils with AdapterDelegates, but not by using "raw" adapter.
Just a guess into the blue. Is your data immutable (incl. the list itself) when calculating the diff result?
Can this be closed?
Hi,
I've been playing around with DiffUtil and AdapterDelegates but can't seem to show the items using those two. However, running DIffUtil with "raw" RecyclerView.Adapter works fine. Here is a snippet of the code I am using:
Adapter
Delegate
Setting up
Updating with new data
After the call to
dispatchUpdatesTo
nothing happens. The list is blank.For the "raw" adapter I use the approach as defined here:
https://github.com/antoniolg/diffutil-recyclerview-kotlin/blob/master/app/src/main/java/com/antonioleiva/diffutilkotlin/AutoUpdatableAdapter.kt
and my adapter looks like this:
Running somewhat similar code using a "raw" adapter works just fine. Any thoughts? Am I doing something wrong?
Thanks for the awesome lib!