Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to ListAdapter (replacing RecyclerView.Adapter) #321

Merged
merged 2 commits into from
Nov 18, 2023

Conversation

cyb3rko
Copy link
Contributor

@cyb3rko cyb3rko commented Nov 12, 2023

I've replaced the classic RecyclerView.Adapter with the ListAdapter (https://developer.android.com/reference/androidx/recyclerview/widget/ListAdapter).

It includes AsyncListDiffer (https://developer.android.com/reference/androidx/recyclerview/widget/AsyncListDiffer), which uses DiffUtil to calculate differences between the current and a newly submitted list. This gives a good performance boost when updating the list (especially in Gotifys case where mostly single messages are added / removed at a time.

Furthermore it handles animations for added or removed items by itself, no need to handle that from our side anymore.

Copy link
Member

@jmattheis jmattheis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, see sub comment.

Copy link
Member

@jmattheis jmattheis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jmattheis jmattheis merged commit 0d423c1 into gotify:master Nov 18, 2023
1 check passed
@cyb3rko cyb3rko deleted the listadapter-new branch November 18, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants