Goodbye Ugly RecyclerAdapters;

Sajad Shokri
Aug 29, 2017 · 1 min read

Hello GhostAdapter

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

2. Use GhostAdapter As Recyclerviews adapter

that’s easy

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!

so what?

  1. reduce boilerplate code..

I wonder what Aritra Roy thinks about it

compile ‘ir.coderz.ghostadapter:GhostAdapter:0.2@aar’

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade