Open Chaseos opened 5 years ago
So, after working with it a bit and with a teammate's help, we found a solution that works. Basically involves just creating a BindingAdapter for the second EpoxyRecyclerView.
binding.parentsEpoxyRecycler.withModels {
cardsList.forEachIndexed { index, card ->
cardView {
id("card", index.toLong())
names(card.names)
}
}
}
@BindingAdapter("listOfNames")
fun EpoxyRecyclerView.setupNamesRecyclerView(names: List<String>) {
withModels {
names.forEachIndexed { index, name ->
nameView {
id("name", index.toLong())
name(name)
}
}
}
}
Then in your EpoxyRecyclerView
for the cards you set the listOfNames
value to the names you passed in.
Great, I'm not too familiar with databinding but I'm glad you have it working.
I'm attempting to have a EpoxyRecyclerView of cards, and within them a EpoxyRecyclerView of names, but I'm getting a NPE crash when doing so on the item's recycler.
My Parent view has a EpoxyRecyclerView and my cardItem that I insert in it has a EpoxyRecyclerView.
I'm using the
.withModels
extension and the auto generated models through making the package-info.java class.When I try to call
.withModels
on the item's EpoxyRecyclerView I get a NPE.So it's pretty much like this. There will never be more than 5 or so card items.