I'm making an expandable nested recyclerview.
I have implemented both a parent recycler view and a child(nested) recycler view, but I would like the next item to be pushed out more smoothly when the previous item is expanded.
I'll show you an example image.
First what I want.
But what I made.
If you look at the GIF file, you won't notice much of a difference.
However, in the app in the first picture I referenced, when the first item is expanded, the second item is pushed out really smoothly.
However, what I made is that when the first item is expanded, the second item is pushed out like a break.
How can I make it softly pushed out?
I implemented it in epoxy, but I don't think RecyclerView will be any different.
thank you.
ParentController
class ParentEpoxyController : EpoxyController() {
private var data : List<ParentItem> = listOf()
set(value) {
field = value
requestModelBuild()
}
override fun buildModels() {
data.forEachIndexed { index, item ->
ParentDataModel_()
.id(index)
.title(item.workout)
.list(item.list)
.onBind { model, holder, position ->
bindParentRV(holder,item)
bindNestedRV(holder,item)
}
.addTo(this)
}
}
private fun bindParentRV(holder: ParentDataModel.ItemViewHolder, item: ParentItem) {
holder.apply {
expandBtn.setOnClickListener {
nestedRV.isVisible = !item.isExpandable
borderline.isVisible = !item.isExpandable
item.isExpandable = !item.isExpandable
requestModelBuild()
}
}
}
private fun bindNestedRV(holder: ParentDataModel.ItemViewHolder, item: ParentItem) {
holder.nestedRV.apply {
val controller = ChildEpoxyController()
controller.setItem(item.list)
adapter = controller.adapter
isVisible = item.isExpandable
}
}
fun setItem(items : List<ParentItem>) {
data = items
}
}

