I have an EpoxyModelGroup that's created within my PagedListEpoxyController#buildItemModel as follows:
EpoxyModelGroup(
R.layout.example_layout,
HeaderViewModel_()
.heading(item.heading)
.subheading(item.subheading),
CarouselModel_()
.id(item.id)
.padding(carouselPadding)
.models(item.items.map {
ItemViewModel_()
.id(it.id)
.coverImage(it.cover)
}
)
I'd like to track the visibility of the overall group, as mentioned in the wiki.
However, it seems that EpoxyModelGroup doesn't have any method to register a OnModelVisibilityChangedListener (as can be usually found on generated EpoxyModels).
What is the correct process for registering a visibility callbacks on EpoxyModelGroups?
If you do want to register visibility callbacks on EpoxyModelGroup then you must use a generated subclass of it, so that the visibility callbacks are generated. Make a subclass of EpoxyModelGroup and add the @EpoxyModelClass annotation to it to force a generated class to be created - then use the resulting generated class.
EpoxyModelGroup could be modified in the future to have visibility handling built in - pull requests are welcome!
I updated the wiki with that info too
Most helpful comment
If you do want to register visibility callbacks on
EpoxyModelGroupthen you must use a generated subclass of it, so that the visibility callbacks are generated. Make a subclass ofEpoxyModelGroupand add the@EpoxyModelClassannotation to it to force a generated class to be created - then use the resulting generated class.EpoxyModelGroup could be modified in the future to have visibility handling built in - pull requests are welcome!
I updated the wiki with that info too