Package 

Class SimpleEpoxyModel


  • 
    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
      SimpleEpoxyModel onClick(View.OnClickListener listener)
      SimpleEpoxyModel span(int span)
      void bind(@NonNull() View view) Binds the current data to the given view.
      void unbind(@NonNull() View view) Called when the view bound to this model is recycled.
      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.
      boolean equals(Object o)
      int hashCode()
      • 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
    • Constructor Detail

      • SimpleEpoxyModel

        SimpleEpoxyModel(int layoutRes)
    • Method Detail

      • 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 grid
        position - The position of the model
        itemCount - The total number of items in the adapter