AdapterDelegates icon indicating copy to clipboard operation
AdapterDelegates copied to clipboard

#88 Jetpack Paging 3 support

Open krossovochkin opened this issue 4 years ago • 7 comments

My vision on how to implement support for new paging 3 jetpack library. Relates to #88

Main obstacle is that AdapterDelegates are heavily based on "List<T>" in their implementations. And new Paging library doesn't have final List underneath. But seems there is no need in that, because the only features that could be needed from List - are getting item by position and maybe size of a list. All of this is a public API of adapter and can be exposed under some interface, which I called AdapterItemProvider. But it creates a new separate parallel branch of implementations.

What's inside this PR:

  • some updates on build.gradle (as e.g. Java 1.8 compatibility is required)
  • base interface for AdapterItemProvider and Abs...Delegate for it
  • ViewBinding DSL for new Abs...Delegate
  • LayoutContainer DSL for new Abs...Delegate
  • Delegation adapter implementation for Paging 3 Jetpack library along with support of new AdapterItemProvider interface
  • Sample

What's missing:

  • naming most likely not final and could be updated
  • docs (javadoc, readme, ...)
  • something else?

Current PR I think still is a WIP. Most part is done, but some polishing might be needed.

@sockeqwe, hope you'll be able to review it (or find someone to review) Thank you

krossovochkin avatar Jul 01 '20 18:07 krossovochkin

Hi @sockeqwe

Did you have a chance to look at this PR?

Thank you

krossovochkin avatar Jul 12 '20 13:07 krossovochkin

Hi @krossovochkin Sorry for the delay, I am on vacation and didn't check my mails frequently. Will take a look at it now, but I think it could end up in a major rework of this library as I also wanted to address other issues like #89 and #83.

Although I didn't look at your code changes yet, I think this is something that could lead to bigger changes and longer time until it's released (just to manage expectations)

sockeqwe avatar Jul 14 '20 09:07 sockeqwe

Hi @sockeqwe No problem. Was also on a vacation recently)

I would be happy if lib had 5 release with covering more pain points. Personally, I don't expect this PR to be merged. I've just wanted to accelerate discussion and provide my vision. As code shows more than textual description of the problem.

krossovochkin avatar Jul 16 '20 19:07 krossovochkin

@ibrahimyilmaz thanks for review But some things were implemented in a way they are in other places in the lib. Sample part of the lib is not a perfect piece of code by itself. Tried not to introduce some new approaches in this implementation. Instead of writing probably same comments I'll add few reactions )

Thanks again for your time

krossovochkin avatar Jul 30 '20 14:07 krossovochkin

I've also gotten interested in paging 3 support. For the moment I'm forced to use Paging 2. @sockeqwe can the community somehow help with the refactoring (adapterdelegates5) which would enable this as well as #89 & #83?

vanniktech avatar Jan 25 '22 17:01 vanniktech

Hey, to be honest I dont think adapterdelegates5 will ever be created. I think with Jetpack Compose this library will become more and more obsolete.

I personally done use pagination library, thus don't know much about it. I'm happy to add any artifact to adapter delegates to support pagination 3, I just don't have (and want) invest much of my time in pagination 3. I hope you understand. So what I can do is the following: I can take until mid of February a look into Pagination 3 library APIs then get back again to this PR to check what is missing / required to add support.

sockeqwe avatar Jan 29 '22 09:01 sockeqwe

Totally understandable & sounds good.

I don't know much about pagination either. I've had to use it for my RSS Reader though as some users have 40+ sources and loading hundreds of entries from the database isn't the best way (either OOM or result from sqlite database was too large). I'm creating my paging source from SQLDelight using their pagination support and wanted to keep my adapter delegates so that I didn't need to change that part too.

vanniktech avatar Jan 29 '22 10:01 vanniktech

Any update on this?

ahulyk avatar Jun 06 '23 08:06 ahulyk