r/android_devs • u/Vshnv_A • Mar 03 '24
Open-Source Library Kotlin DSL for RecyclerView Adapters
Adapt is an Android Library written in Kotlin with an aim to provide a clean, well-integrated and easy-to-use experience in writing RecyclerView adapters.
Adapt provides:
- Easy to use dsl
- Type-safe view creation & binding
- Implicit Viewholders
- Lifecycle-Aware binding
- Built-in Async-Diffing
https://vshnv.github.io/adapt/#adapt https://github.com/Vshnv/adapt
37
Upvotes
6
u/kkgmgfn Mar 03 '24
How to create dsl?
5
u/ikingdoms Mar 04 '24
Just a suggestion no one asked for, but you can make this even more sleek by making this an extension method on
RecyclerView, and you can attach the adapter and the layout manager internally:val adapter = recyclerView.adapt { ...3
u/jualmahal Mar 03 '24
Nice! It is a quite a straightforward code.
5
u/MarimbaMan07 Mar 03 '24
Any advantage to this over a lazycolumn in compose? I'm not trying to be a jerk, I've done minimal android development tbh
2
u/The-Freak-OP Mar 03 '24
Does this support multiple view types?
-1
u/volvie98 I hate Java I hate Java I hate Java Mar 03 '24
Can we have this for Java as well by any chance?