Goodbye Ugly RecyclerAdapters;
Everyday; Android developers have to use some kind of list! And you need an adapter to display items to the screen. OK, make a Recycler Adapter… but… what if you need to display two different items? OR 3 or more?!
You will end up creating something like this:
Oo! and the ‘position’ you always have to handle the ‘position’ :|
What if there was an easier way!
Meet the GhostAdapter
Just follow 3 steps:
1. Items must be annotated
just bind your layout & viewholder
GhostAdapter As Recyclerviews adapter
3. Fill the adapter by annotated items
That’s it! add one item or a list! add to a specific position or at the end of list. any class that is annotated correctly will work!
- reduce boilerplate code..
- increase readability
- reduce mistakes
- only items and view holders no need to implement adapter
- support you if lot’s of UI change happens ;)
I wonder what Aritra Roy thinks about it
GhostAdapter - came from https://github.com/sajadshokri/Core-Adaptergithub.com