I have Message table in Room with following structure: id, text, animRes, readStatus.
Then I subscribe to livedata exposed by room to display this item in recyclerview with diffutil adapter.
When new message appeared in RV, animation start playing. If I add readStatus to diffutil areContentsTheSame function, my animation would restart each time readStatus changes, that why I can't just use diffutil to redraw full view.
Is there any way to update only one inner indicator view inside RV items, when value in the room changes? How this works in messenger, where changing of read status doesn't restart animation (stickers or gif)?
Thanks)
Finally, I found an answer)
Implement DiffUtil (getChangePayload should return something if you want partial updating, otherwise return null for full rebind):
Then in adapter (example with ViewBinding from here: https://stackoverflow.com/a/60427658):
We call onBindViewHolder constructor only if getChangePayload from diffUtil return null. Otherwise just change target view, simple and effective)
Upd: If payload changes while add animation playing, two animations overlap each other and the result is not nice.
This can be fixed in this way: