Currently for multi-ViewHolder implementations of RecyclerView everyone suggests to have a when/switch case
in onCreateViewHolder()
e.g. here: How to create RecyclerView with multiple view type?
or here: https://medium.com/@gilbertchristopher/a-recyclerview-with-multiple-view-type-22619a5ad365
I'd like to have a cleaner onCreateViewHolder()
method but need a way to move this decision making code into ViewHolders
themselves.
Any ideas?
Here's my adapter class for more detail in github, I'm currently doing the decision making in baseViewHolder
Class : https://github.com/davida5/DavidsResume/blob/master/app/src/main/java/davids/resume/screens/resume/ResumeAdapter.kt