epoxy-adapter / com.airbnb.epoxy / BaseEpoxyAdapter

BaseEpoxyAdapter

abstract class BaseEpoxyAdapter : Adapter<EpoxyViewHolder!>, StickyHeaderCallbacks

Constructors

<init>

BaseEpoxyAdapter()

Functions

getBoundViewHolders

open fun getBoundViewHolders(): BoundViewHolders!

Returns an object that manages the view holders currently bound to the RecyclerView. This object is mainly used by the base Epoxy adapter to save view states, but you may find it useful to help access views or models currently shown in the RecyclerView.

getItemCount

open fun getItemCount(): Int

getItemId

open fun getItemId(position: Int): Long

getItemViewType

open fun getItemViewType(position: Int): Int

getModelPosition

open fun getModelPosition(model: EpoxyModel<*>!): Int

Finds the position of the given model in the list. Doesn't use indexOf to avoid unnecessary equals() calls since we're looking for the same object instance.

getSpanCount

open fun getSpanCount(): Int

getSpanSizeLookup

open fun getSpanSizeLookup(): SpanSizeLookup!

For use with a grid layout manager - use this to get the SpanSizeLookup for models in this adapter. This will delegate span look up calls to each model's . Make sure to also call #setSpanCount(int) so the span count is correct.

isEmpty

open fun isEmpty(): Boolean

isMultiSpan

open fun isMultiSpan(): Boolean

isStickyHeader

open fun isStickyHeader(position: Int): Boolean

Called to check if the item at the position is a sticky item, by default returns false.

onBindViewHolder

open fun onBindViewHolder(holder: EpoxyViewHolder, position: Int): Unit
open fun onBindViewHolder(holder: EpoxyViewHolder, position: Int, payloads: MutableList<Any!>): Unit

onCreateViewHolder

open fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EpoxyViewHolder

onDetachedFromRecyclerView

open fun onDetachedFromRecyclerView(recyclerView: RecyclerView): Unit

onExceptionSwallowed

open fun onExceptionSwallowed(exception: RuntimeException!): Unit

This is called when recoverable exceptions happen at runtime. They can be ignored and Epoxy will recover, but you can override this to be aware of when they happen.

onFailedToRecycleView

open fun onFailedToRecycleView(holder: EpoxyViewHolder): Boolean

onModelBound

open fun onModelBound(holder: EpoxyViewHolder!, model: EpoxyModel<*>!, position: Int, payloads: MutableList<Any!>?): Unit
open fun onModelBound(holder: EpoxyViewHolder!, model: EpoxyModel<*>!, position: Int): Unit

Called immediately after a model is bound to a view holder. Subclasses can override this if they want alerts on when a model is bound.

onModelUnbound

open fun onModelUnbound(holder: EpoxyViewHolder!, model: EpoxyModel<*>!): Unit

Called immediately after a model is unbound from a view holder. Subclasses can override this if they want alerts on when a model is unbound.

onRestoreInstanceState

open fun onRestoreInstanceState(inState: Bundle?): Unit

onSaveInstanceState

open fun onSaveInstanceState(outState: Bundle!): Unit

onViewAttachedToWindow

open fun onViewAttachedToWindow(holder: EpoxyViewHolder): Unit

onViewDetachedFromWindow

open fun onViewDetachedFromWindow(holder: EpoxyViewHolder): Unit

onViewRecycled

open fun onViewRecycled(holder: EpoxyViewHolder): Unit

setSpanCount

open fun setSpanCount(spanCount: Int): Unit

If you are using a grid layout manager you must call this to set the span count of the grid. This span count will be passed on to the models so models can choose what span count to be.

setupStickyHeaderView

open fun setupStickyHeaderView(stickyHeader: View): Unit

Optional callback to setup the sticky view, by default it doesn't do anything.

teardownStickyHeaderView

open fun teardownStickyHeaderView(stickyHeader: View): Unit

Optional callback to perform tear down operation on the sticky view, by default it doesn't do anything.

Inheritors

EpoxyAdapter

abstract class EpoxyAdapter : BaseEpoxyAdapter

Allows you to easily combine different view types in the same adapter, and handles view holder creation, binding, and ids for you. Subclasses just need to add their desired EpoxyModel objects and the rest is done automatically.

EpoxyControllerAdapter

class EpoxyControllerAdapter : BaseEpoxyAdapter, ResultCallback