Hello everyone!
I'm trying to use a ListAdapter, with a list in which items are not unique. Items are kinda like this:
data class Item(val a: String, val b: String)
My problems comes trying to create a DiffCallback:
If I use oldItem == newItem on
itemsAreTheSame
, this is going to return true on items that are not the same, for instance, the first two on the following list:
Item("a", "a")
Item("a", "a")
Item("b", "b")
As long as an operation doesn't involve items with the same content, everything works fine: animations, add, edit, move, delete. But this gets buggy when items are equal.
If I delete the second item, the first one will also be deleted. If I add or move something, the animation is wrong, kind of reversed.
What I wanted to know is if there's any other way to handle something like this, without adding an identifier, nor using a custom differ without ListAdapter.