You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering, what would be the best way to implement messenger-like adapter?
So, we have sorted list where newest items are on top of list (list is sorted by item timestamp), when item is updated (new message arrives) it's moved to the top of the list (as item timestamp is updated) and items can be removed (if user unsubscribes).
My idea is to have my own sorted data list and then compare it with items in adapter, but I wonder if there's something better?
Thanks for your help.
The text was updated successfully, but these errors were encountered:
LayoutManagers already have a reverseLayout field/property to populate the RecyclerView from bottom. Is this what you're trying to achieve?
You can sort your data and add items to the adapter in any sorted order (ascending or descending as long as sorted), just change the layout order to the opposite one I guess? But as a side note, appending an ArrayList is considerably more efficient than inserting into 0th location I believe, so you should do more appends than head-pushing for performance.
Hello! :)
I'm wondering, what would be the best way to implement messenger-like adapter?
So, we have sorted list where newest items are on top of list (list is sorted by item timestamp), when item is updated (new message arrives) it's moved to the top of the list (as item timestamp is updated) and items can be removed (if user unsubscribes).
My idea is to have my own sorted data list and then compare it with items in adapter, but I wonder if there's something better?
Thanks for your help.
The text was updated successfully, but these errors were encountered: