-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for databinding in list view items #34
Comments
Hi, I haven't had a proper look at databinding yet but I don't think is gonna be easy to integrate. First thing is that the current structure of I don't think creating two base classes is a good option because, as you said, we would end up with too many base classes. The flag in the annotation is a better solution but I don't think it's enough. I haven't thought about this properly yet but the way I see this being implemented is by having a different view holder (e.g. |
Hello. I agree that a lot of structure of Maybe instead of |
If we keep My understanding is that databinding generates a class per layout based on your layout name. Then if, for example, you data item is an For example: ListItemBinding binding = DataBindingUtil.inflate(layoutInflater, R.layout.list_item, viewGroup, false);
binding.setUser(user);
void onSetValues(User user, Object binding, ItemPosition itemPosition) {
ListItemBinding listItemBinding = (ListItemBinding) binding;
listItemBinding.setUser(user);
} This could be an option, however having that parameter of type |
First off, thanks for this library.
I was wondering what would be the best way to add support for databinding when using an ItemViewHolder with a recyclerview (or listview). I am thinking either making the
onCreateViewHolder
abstract, and creating two base classes, depending on whether one is using the databinding or not. The problem with this solution is that it would double the number of classes one can subclass.What about adding a flag to the LayoutId annotation set to true when using databinding, and is false by default?
Thanks,
The text was updated successfully, but these errors were encountered: