Posted on

Android SimpleRecyclerView Custom View Type


android recyclerview custom viewtype

Continuing with writing SimpleRecyclerView library, a clean and easy RecyclerView library. Today’s feature is handling custom view types

So before I locked Adapter to just one view type and basically user didn’t have any way to create more than one view type (for the simplicity of ProgressBar footer implementation).¬† But actually it’s not that hard to have a nice and easy ProgressBar footer handling and give user access to create many different view types without him needing to handle footer type

View Type

Now there’s new method available to determine view type and I added second attribute for onCreateHolder

ProgressBar footer type is still just as seemeless as before, you don’t need to worry about that. It’s still handled by default by library in background if you set SimpleRecyclerView#onLoadMoreListener

So now creating custom view types works just like with your regular RecyclerView!

What’s Next?

So I think this gets something more functional now with SimpleRecyclerView. It’s seamless to have default ProgressBar footer, default initial load ProgressBar, onLoadMoreListener when reached bottom, empty view, custom layouts handling

And for the rest – it works just like regular RecyclerView. I’m looking forward to implement swipe features like in Gmail

I haven’t used it in production, but I think it’s getting there soon. Also mayble some nice solution for having horizontal lists as list items. Current latest change gives all the needed leverage to do it manually, but it’s nice for library to help in this¬† one

Also maybe having on item click listener. This one is more of convenience.

 

You can get full readme and installation instructions here. Let’ me know about features you’d like to see and if you find it easy to understand. It’s still up to changes. And don’t forget to subscribe if you want to get more of posts from me!