Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding is being added randomly and automatically to Epoxy #1210

Open
sdzshn3 opened this issue Jul 12, 2021 · 1 comment
Open

Padding is being added randomly and automatically to Epoxy #1210

sdzshn3 opened this issue Jul 12, 2021 · 1 comment

Comments

@sdzshn3
Copy link

sdzshn3 commented Jul 12, 2021

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)
    }
}
@MircoVigna17
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants