I have an MVP application with two nested recycler views. The view holders are in charge now of handling view changes, for example visibility changes. But I also have logic and data mixed inside my view holder, how could I order this?
I'm starting to write a contract for each product with Views and Actions. Each RecyclerView should have its own View Interface and Presenter? Given that the ViewHolder has control over the itemView
, it should extend a View Interface?
You can reuse the presenter you already have, expand current View contract with methods you need. Prefer smaller interfaces, in your case, different view interface for your adapter ViewHolders and different interface for your Fragment/Activity.
You can dedicate special function in your presenter that will bind the passive view in the adapter, like:
presenter.bindProductViewHolder(viewHolder, position....)
Where viewHolder
implements the smaller interface that is suggested above.