Hey guys, I need your help. The application which ...
# android
f
Hey guys, I need your help. The application which I’m working on contains many RecyclerViews, and each of the RecyclerViews can contain many types of items, 10+ on average. I joined my current team earlier on, and I felt very painful to maintain the huge bunch of viewtypes and binding logic during this time. So I wrote a library recently, trying to make this kind of situation a little bit easier. I hope you guys can help me review this library and give me some suggestions about API design, naming and etc. Thanks. And this is my library: https://github.com/fengdai/registry
c
Not to shit on your creation, but ever took a look at Epoxy? https://github.com/airbnb/epoxy Maybe it can give you some ideas on some (extra) features in the future?
c
you could learn a lot from airbnb’s approach, mainly on how they managed to make it testable. They have a wealth of unit tests which would make it easier for me to contribute back to them.
f
I knew Epoxy before. It's great, but not my saver. My motivation of creating this library is to relieve my pain of maintaining the existing code, which has been written years ago.
c
Ooh but I’m not saying you should rewrite all your existing code, but rather when creating such a library you could maybe reference it. But then again, looks like you already new about Epoxy so disregard my comment as it is obsolete 😄
f
Anyway, thanks. Any suggestion is welcome. I think I should provide more information about the background: The legacy code modularizes RecyclerView with ViewHolders: ViewHolder takes responsibility of view creation and reference holding, along with a method which binds its views to a specific data (I found many people tend to modularize RecyclerView like this, and that's why I think my library may be useful to them, too), which is good. But, on the other hand: view type definition, view type to ViewHolder mapping and data to view type mapping are verbose and error prone when maintained, which is bad. The bad part is what made me painful and which I wanted to get rid of.