Open utwyko opened 5 years ago
Hi, @utwyko I agree that Groupie needs to have some support for Pagination. I'd be happy to take PRs for this. It sounds like a problem that would require a few iterations to get right.
maybe we can take a look on how Epoxy is handling Paging now.
Hi! I tried to write PagedGroupAdapter
.
If it looks good, create a PR and make some corrections!
Does anybody could make Groupie works with Paging 3.0?
Technically, Groupie should only provide first-party support for Paging 3 if it becomes stable, and not alpha.
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
It's ready for production, it would be nice to have with groupie. https://developer.android.com/jetpack/androidx/releases/paging#version_300_5
Any update by anyone on this please to support paging 3? If anyone has any fork for this, please message here
hey guys Is there any progress or plans to work on this? I'm currently building a project that HEAVILY relies on Groupie, and Android Paging Library support would be incredibly helpful.
Is 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:
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).Group
. I'm not sure if this is a problem but ideally you'd submit the paged list directly into the adapter.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 toGroupAdapter
.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 toGroupAdapter
.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.