question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Paging Library with DataSource

See original GitHub issue

Feature 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kittinunfcommented, Dec 3, 2018

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.

1reaction
SleeplessBytecommented, Nov 26, 2018

Hi there,

Can you link to DataSourxr and PagedList and the Paging library?

On Mon, 26 Nov 2018, 08:39 박현기, notifications@github.com wrote:

Feature 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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kittinunf/Fuel/issues/547, or mute the thread https://github.com/notifications/unsubscribe-auth/AB35WDtaCY2H30krULJyX3N7uA_BAyHWks5uy5qwgaJpZM4YyeJ4 .

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found