Closed josh-burton closed 6 years ago
Noted. I would like to avoid having too many different methods for setting padding, but I think we can support this by having another setPadding
overload that passes a custom object as a param - that object can specify padding in each direction (in either px, dp, or dimenRes) as well as item spacing
I have this class that removes the top & bottom padding from the horizontal recyclerview and it seems to be working fine.
class JobCarouselModel: CarouselModel_() {
override fun onViewAttachedToWindow(view: Carousel?) {
super.onViewAttachedToWindow(view)
val pad = view?.context?.resources?.getDimensionPixelSize(R.dimen.padding_base) ?: 0
view?.setPadding(pad, 0, pad ,0)
}
}
and adding it this way:
JobCarouselModel().paddingRes(R.dimen.padding_base).id("jobs").models(models)
The above will continue to give the item spacing for the elements in recyclerview. But I wish it was easier than creating a custom model just to support our padding requirements.
I should have a solution up tomorrow
This is what I have in mind https://github.com/airbnb/epoxy/pull/369
Merged
Thanks. Does the new method also propagate to the CarouselModel? Is it possible to do? ```CarouselModel().padding(Padding(....))```
Yes, notice it is annotated with @ModelProp
Cool, thanks again. Closed.
The Carousel seems to only support one padding value which affects all sides.
It would be great to be able to specify padding values for top, left, bottom and right.