Conversation list flickers
Steps to reproduce
Use Talk 21.1.0RC2 Have a list of conversations Switch back and forth to messages list and conversation list
Expected behaviour
No flickers
Actual behaviour
https://github.com/user-attachments/assets/e53761b8-94d3-4e4f-a6a9-0267cd6eb435
Device brand and model
Samsung A33
Android version
14
Nextcloud Talk app version
21.1.0 RC2
Nextcloud server version
31
Talk version
No response
Custom Signaling server configured
None
Custom TURN server configured
None
Custom STUN server configured
None
Android logs
No response
Server log
Additional information
No response
This is a known behavior (although it seems to be more intense than on my devices).
For the conversation list we will have a look especially when migrating this screen to compose.
The avatars in chat may flicker because of a different reason.
This is a known behavior (although it seems to be more intense than on my devices).
It was better a few weeks ago. Last update I did (don't recall which version I was on), dramatically increased the issue :)
I have taken some time to investigate this one; it is a bit tricky.
There are a few issues in place:
ConversationListActivity issues
- The
ConversationListActivityis using theFlexibleAdapterto display the items, which does provide anupdateDataSetmethod to update the list without animations. Unfortunately, passinganimate: falsedoesn't really do much. - If to remove the item animator from the
recylerView, the flickering goes away (as do all the other animations, but there is a workaround)
Image loading issues:
- However, in that case, another flickering happens: the image loading makes the avatar flicker, and it's not the fault of coil, but the fact that the views don't seem to preserve, and the images load multiple times for seemingly the same item
- I saw it on the "Note to self" chat, and tried just setting the drawable without using coil, but that didn't help, the image was overwritten.
fun ImageView.loadNoteToSelfAvatar() {
val layers = arrayOfNulls<Drawable>(2)
layers[0] = ContextCompat.getDrawable(context, R.drawable.ic_launcher_background)
layers[1] = ContextCompat.getDrawable(context, R.drawable.ic_note_to_self)
val layerDrawable = LayerDrawable(layers)
val data: Any = layerDrawable
// This does not help
setImageDrawable(data)
}
I'll keep digging into it, since the flickering annoys me very much. I'll try to make sure the views don't get rerendered if not changed.
Found another potential solution to the ConversationList flicker.
I messed with the ConversationModel class equals and hashCode functions, and limited it to internalId. That completely got rid of the flickering, which suggests that if only the fields we care about displaying are changed, it is possible to reduce the flickering significantly.
And since there are no more extra redraws, the icons now also stay in place on the ConversationActivity, which is a pleasant improvement. Preparing pull request now.