-
Notifications
You must be signed in to change notification settings - Fork 728
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
EpoxyModelGroup with Android Data Binding #327
Comments
You should be able to use models created via databinding in a model group without issue. You can't create an EpoxyModelGroup via databinding though. The model group should just be a thin shell that organizes all of the views inside it, it shouldn't need to do much logic itself |
Yes, if you wanted to group the header and carousel I would recommend making the header one model (with title, button, and description), and the carousel a separate model. The group would be very simple to hold them
with a layout like
and you could use the group in your controller like
So all the group is doing is adding the models in order in a vertical linear layout, and changing the background color of the linear layout. The model group is not super sophisticated, it doesn't recycle inner views between other groups. See #289 for more info. so you have to be careful to use a different layout file for different types of models. If this is a common use case for you a simpler way might be to make Let me know if that clears it up or you still have questions. I would love to support recycling of nested views, like that linked issues talks about. That would make model groups much better all around. If you ever want to contribute you'd be most welcome :) |
btw I realized that generating a model group subclass like that will require this change #330 |
Closing this for now, feel free to reopen if you still have questions |
Hey, thank you so much. I used a combination of the above approaches and was able to succeed in getting things to work by taking your suggestion and having each model set its own color. When the next version is released with #330 I'll refactor so that I can set it on the linear layout via attribute. Thanks again for your help, as soon as I get done with this project I'll see where I can jump in and help! |
Glad it worked 👍 I released the new version last night btw, hope it works for you |
Epoxy now supports models creation from data binding layouts, but there doesn't seem to be an accessible way of defining a data bound modelgroup/container and then inserting other data bound models within it.
For my use case, I have a controller that contains many dynamically created Carousels. I need to be able to group some of those carousels into the same section with a shared background and header as defined in the section container's created viewmodel. Hopefully, this is clear enough, but any assistance would be appreciated.
The text was updated successfully, but these errors were encountered: