Feature Request: Android Paging Library support
See original GitHub issueIs your feature request related to a problem? Please describe The Android Paging library is becoming the standard way to handle paging on Android. As far as I know, it currently does not work with Groupie yet. It would be great to add support for the library to Groupie.
@chibatching has written an article on how to connect the Paging library with Groupie. This is a great start, I’m not sure it’s the ideal solution:
- It requires you to have a
PagedList
containing groupieItem
s. This is not a great separation of concern. We want theDataSource
to provide data, not groupieItem
s to keep theDataSource
free from any view related logic. The post suggests passing a transform function to the datasource, which works, but it still means that theViewModel
is exposing aPagedList
of groupie items. You could transform thePagedList
by using the.map
function on theDataSourceFactory
. However this means losing any additional information on the factory (such as aLiveData
exposing error states). - It loads all content into a single
Group
. I’m not sure if this is a problem but ideally you’d submit the paged list directly into the adapter. - It’s not a native solution that the library provides
Describe the solution you’d like First-class support for the paging library in the main groupie library or perhaps an additional module.
Option 1
Add a update(p pagedList<T>, t TransformFunction)
function to GroupAdapter
.
This function takes a PagedList of any raw data, and a transform function that maps the data to groupie items.
Option 2
Add a update(p PagedList<T: Item>
) function to GroupAdapter
.
This still requires that the PagedList is mapped to groupie items by the consumer first.
Additional context If this is something you would consider adding to the library, I’d be happy to give it a shot and see if I can come up with a PR.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:8 (1 by maintainers)
Top GitHub Comments
Paging 3 is api stable now. They have reached beta as of ~February 10. Could we start looking into this now? https://developer.android.com/jetpack/androidx/releases/paging#3.0.0-beta01
Any update by anyone on this please to support paging 3? If anyone has any fork for this, please message here