Support Paging Library with DataSource
See original GitHub issueFeature Request
Description
LiveData with Fuel is awesome integration. I think it will be also great with Paging Library for api pagination. (DataSource, PagedList)
Proposed Solution
data class User(val key : String)
// ...
val pageSize = 20
val staticParams = listOf("limit" to pageSize)
val request = "https://...".httpGet(staticParams)
val onLastItemLoaded = { last : User -> listOf(*staticParams, "next" to user.key) }
val config = PagedList.Config.Builder().setPageSize(pageSize).build()
val source = request.dataSource<String, User>(dynamicParams : onLastItemLoaded)
val pagedList = source.toLiveData(config)
// or
val pagedList = request.livePagedList<String, User>(config, dynamicParams : onLastItemLoaded)
Alternatives I’ve considered
I have no idea. I think it can’t append query parameters dynamically.
Additional context
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Paging 2 library overview - Android Developers
The Paging Library helps you load and display small chunks of data at a time. Loading partial data on demand reduces usage of...
Read more >Paging Library Guide | CodePath Android Cliffnotes
Google's new Paging Library now provides this support. Note: Endless Scrolling guide ... You will also need to first pick what kind of...
Read more >Paging 3 — Easier Way to Pagination | by Metin Özcura
The Paging 3 library provides first-class Kotlin support, designed to fit recommended Android app architecture and works seamlessly with other ...
Read more >Android Paging Library Step By Step Implementation Guide
Implementation of Paging Library from Scratch with Kotlin & REST API ... Create an Android Project & don't forget to include Kotlin Support....
Read more >How to Implement Paging Library in Android with Example?
Paging Components · DataSource: The DataSource class is where you tell your application how much data you want to load into it.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But out of the top of my head, I don’t think it fits well into the Fuel repo though. I think it is more like a child repo where it should have someone who really commits to this to maintain it. I would rather leave Fuel (even the extension) as it is unless we have something really ubiquitous.
Hi there,
Can you link to DataSourxr and PagedList and the Paging library?
On Mon, 26 Nov 2018, 08:39 박현기, notifications@github.com wrote: