Open atonamy opened 4 years ago
Just my 2 cents since I haven't worked with ViewPager 1 or 2, but wouldn't just using an Epoxy Carousel essentially give you what you want here? If ViewPager2 is built on RecyclerView then it doesn't seem necessary to need a ViewPager at all. Is there something specific you require?
I wrote two extensions that pretty much covered my needs:
inline fun ViewPager2.setController(controller: EpoxyController) {
adapter = controller.adapter
}
inline fun ViewPager2.setControllerAndBuildModels(controller: EpoxyController) {
setController(controller)
controller.requestModelBuild()
}
@ColtonIdle my motivation to use the ViewPager2
over RecyclerView
in Epoxy would be to have the ability to use the PageTransformer
(I think this is the way to do page margin from original ViewPager
: https://developer.android.com/reference/androidx/viewpager2/widget/MarginPageTransformer).
Just use the EpoxyController and set the adapter to the ViewPager like you would for a RecyclerView. Works for me!
Since ViewPager2 is built on
RecyclerView
component. Maybe is good reason to createEpoxyViewPager
view? Which can work with epoxy controllers and immutable models?I believe is pretty cool idea to bring epoxy to the new level with ViewPager support.
What do you think? Shall we deserve to have
EpoxyViewPager
together withEpoxyRecyclerVIew
?