epoxy icon indicating copy to clipboard operation
epoxy copied to clipboard

Padding is being added randomly and automatically to Epoxy

Open sdzshn3 opened this issue 4 years ago • 1 comments
trafficstars

I simply have a EpoxyRecyclerView initialized programmatically in kotlin code and set have set manager as LinearLayoutManager. then just added models into a Carousel by overriding the layoutmanager with LinearLayoutManager. and then called addTo().

Now, when I run the app, sometimes padding will be more and some times less at both left and right.

Check this sample code

val binding = (view.dataBinding) as ViewholderItemMealsInclusionBinding
binding.recyclerView.setHasFixedSize(true)
binding.recyclerView.layoutManager = LinearLayoutManager(this@CampActivityEpoxyExtended)
binding.recyclerView.buildModelsWith(
    object : EpoxyRecyclerView.ModelBuilderCallback {
        override fun buildModels(controller: EpoxyController) {
            val models = mutableListOf<EpoxyModel<*>>()

            camp.inclusions?.forEach { meta ->
                meta.text?.let {
                    models.add(
                        AdventureAvailableVariantsInclusionsItemLayoutBindingModel_()
                            .id(it.hashCode())
                            .text(it)
                    )
                }
            }

            VerticalGridSpan1Model_()
                .id(models.hashCode())
                .models(models)
                .padding(
                    Carousel.Padding(
                        0,
                        0,
                        0,
                        0,
                        resources.getDimension(R.dimen.standard_spacing_between_items)
                            .toInt()
                    )
                )
                .addTo(controller)
        }
    }
)
@ModelView(saveViewState = false, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
class VerticalGridSpan1(context: Context) : Carousel(context) {

    override fun createLayoutManager(): LayoutManager {
        return LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
    }
}

sdzshn3 avatar Jul 12 '21 12:07 sdzshn3

Hi, same happens to me. Have you understood why?

MircoVigna17 avatar Jul 14 '22 09:07 MircoVigna17