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

Enable Endless Scroll #7060

Closed
wants to merge 3 commits into from
Closed

Conversation

mhf1998
Copy link
Contributor

@mhf1998 mhf1998 commented Jul 9, 2023

Fixes #7059
In the mentioned issue, I proposed an enhancement to implement the Endless Scroll feature in the message list. And I presented the full explanation in that issue.

In this branch:
in the first commit, I added a function to detect reaching the end of the list and load the next 25 messages automatically without involving the user.

Also, in another commit, I removed the option of clicking the footer so that only the footer is displayed (because we are loading with EndlessScroll and we don't need a Button). But we still show the footer and show the status to the user at the moment (when reaching the end of the list we show "Load up to 25 more" message, and when loading messages we show "Loading messages..." message)

@cketti
Copy link
Member

cketti commented Aug 8, 2023

I believe not everyone will like automatically loading additional messages. So while this can be the default behavior, we should retain the ability to manually load additional messages.

Rather than the approach you're using, I think we should switch to using the AndroidX paging library. That is probably a much larger effort, but will be a) more reliable and b) work better for users with large folders (see #3472).

@cketti cketti closed this Aug 8, 2023
@rezazarchi
Copy link
Contributor

I reviewed code and research a little about migrating to Jetpack Paging.
I have identified several areas that will require rewriting in the adapter to ensure seamless integration. Here is a summary of the changes we need to make in the adapter:

  1. MessageListDiffCallback
  2. Message list items getter and setter
  3. Active message handling
  4. Selected messages handling
  5. Footer
  6. Get message item
  7. Get position by MessageReference
  8. Selection-related actions and methods

Furthermore, we'll also need to create a new DataSource Factory and make slight modifications to our data observation, data submission to the adapter, and the load more mechanisms.

I believe these changes are necessary to ensure the successful integration of Jetpack Paging and take advantage of its benefits in terms of efficient data loading and pagination. According to Google documents It has a lot of benefits while the workload may be a lot.

  • In-memory caching for your paged data. This helps ensure that your app uses system resources efficiently while working with paged data.
  • Built-in request deduplication, which helps ensure that your app uses network bandwidth and system resources efficiently.
  • Configurable RecyclerView adapters that automatically request data as the user scrolls toward the end of the loaded data.
  • First-class support for Kotlin coroutines and flows as well as LiveData and RxJava.
  • Built-in support for error handling, including refresh and retry capabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement endless scroll in emails list
4 participants