-
public class SimpleEpoxyModel extends EpoxyModel<View>
Helper class for cases where you don't need to do anything special when binding the view. This allows you to just provide the layout instead of needing to create a separate EpoxyModel subclass. This is useful for static layouts. You can also specify an onClick listener and the span size.
-
-
Constructor Summary
Constructors Constructor Description SimpleEpoxyModel(int layoutRes)
-
Method Summary
Modifier and Type Method Description SimpleEpoxyModelonClick(View.OnClickListener listener)SimpleEpoxyModelspan(int span)voidbind(@NonNull() View view)Binds the current data to the given view. voidunbind(@NonNull() View view)Called when the view bound to this model is recycled. intgetSpanSize(int totalSpanCount, int position, int itemCount)Subclasses can override this if they want their view to take up more than one span in a gridlayout. booleanequals(Object o)inthashCode()-
Methods inherited from class com.airbnb.epoxy.EpoxyModel
addIf, addIf, addTo, bind, bind, bind, buildView, getLayout, hide, id, id, id, id, id, id, id, isShown, layout, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onVisibilityChanged, onVisibilityStateChanged, preBind, reset, shouldSaveViewState, show, show, spanSize, spanSizeOverride, toString, unbind -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
onClick
SimpleEpoxyModel onClick(View.OnClickListener listener)
-
span
SimpleEpoxyModel span(int span)
-
bind
@CallSuper() void bind(@NonNull() View view)
Binds the current data to the given view. You should bind all fields including unset/emptyfields to ensure proper recycling.
-
unbind
@CallSuper() void unbind(@NonNull() View view)
Called when the view bound to this model is recycled. Subclasses can override this if theirview should release resources when it's recycled.
Note that bind can be called multiple times without an unbind call in betweenif the view has remained on screen to be reused across item changes. This means that you shouldnot rely on unbind to clear a view or model's state before bind is called again.
-
getSpanSize
int getSpanSize(int totalSpanCount, int position, int itemCount)
Subclasses can override this if they want their view to take up more than one span in a gridlayout.
- Parameters:
totalSpanCount- The number of spans in the gridposition- The position of the modelitemCount- The total number of items in the adapter
-
hashCode
int hashCode()
-
-
-
-