Package 

Class EpoxyModelWithView


  • 
    public abstract class EpoxyModelWithView<T extends View>
    extends EpoxyModel<T>
                        

    A model that allows its view to be built programmatically instead of by inflating a layout resource. Just implement buildView so the adapter can create a new view for this model when needed.

    getViewType is used by the adapter to know how to reuse views for this model. This means that all models that return the same type should be able to share the same view, and the view won't be shared with models of any other type.

    If it is left unimplemented then at runtime a unique view type will be created to use for all models of that class. The generated view type will be negative so that it cannot collide with values from resource files, which are used in normal Epoxy models. If you would like to share the same view between models of different classes you can have those classes return the same view type. A good way to manually create a view type value is by creating an R.id. value in an ids resource file.

    • Method Summary

      Modifier and Type Method Description
      abstract T buildView(@NonNull() ViewGroup parent) Create and return a new instance of a view for this model.
      EpoxyModel<T> layout(@LayoutRes() int layoutRes)
      • Methods inherited from class com.airbnb.epoxy.EpoxyModel

        addIf, addIf, addTo, bind, bind, bind, buildView, equals, getLayout, getSpanSize, hashCode, hide, id, id, id, id, id, id, id, isShown, 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

      • buildView

         abstract T buildView(@NonNull() ViewGroup parent)

        Create and return a new instance of a view for this model. If no layout params are set on thereturned view then default layout params will be used.

        Parameters:
        parent - The parent ViewGroup that the returned view will be added to.