In Elements, presenters have the responsibility of laying down elements, that is, creating
Views and binding Element data to them.
This is the simplest component and most of the time you don’t even need to subclass the
Presenter class, thanks
to the extensions provided by the library.
These are the main tasks:
||Here you must provide a
||The holder was created. You can perform here initialization task that do not depend on data (like color filters to icon), or add Views and object to the Holder cache using
|Binding holder to data||
||Bind data, contained in the given
|Attaching holder to hierarchy||
||Called when holder is attached to the view hierarchy and is about to be visible.|
|Detaching holder from hierarchy||
||Called when holder is detached from the view hierarchy and is invisible.|
|Unbinding holder from data||
||Called when the holder is unbound from the
Presenters also accept a click listener that will be automatically added to each view.
The click listener will be added to the root view of the Holder, or, if found, to a child view that
has the id
R.id.click. This way you can still use the provided listener for internal clicks.