epoxy-adapter / com.airbnb.epoxy / EpoxyControllerAdapter

EpoxyControllerAdapter

class EpoxyControllerAdapter : BaseEpoxyAdapter, ResultCallback

Functions

addModelBuildListener

fun addModelBuildListener(listener: OnModelBuildFinishedListener!): Unit

getBoundViewHolders

fun getBoundViewHolders(): BoundViewHolders

getCopyOfModels

fun getCopyOfModels(): MutableList<EpoxyModel<*>!>

Get an unmodifiable copy of the current models set on the adapter.

getItemCount

fun getItemCount(): Int

getModelAtPosition

fun getModelAtPosition(position: Int): EpoxyModel<*>

getModelById

fun getModelById(id: Long): EpoxyModel<*>?

Searches the current model list for the model with the given id. Returns the matching model if one is found, otherwise null is returned.

getModelPosition

fun getModelPosition(targetModel: EpoxyModel<*>): Int

isDiffInProgress

fun isDiffInProgress(): Boolean

isStickyHeader

fun isStickyHeader(position: Int): Boolean

Delegates the callbacks received in the adapter to the controller.

onAttachedToRecyclerView

fun onAttachedToRecyclerView(recyclerView: RecyclerView): Unit

onDetachedFromRecyclerView

fun onDetachedFromRecyclerView(recyclerView: RecyclerView): Unit

onExceptionSwallowed

fun onExceptionSwallowed(exception: RuntimeException): Unit

onModelBound

fun onModelBound(holder: EpoxyViewHolder, model: EpoxyModel<*>, position: Int, previouslyBoundModel: EpoxyModel<*>?): Unit

onModelUnbound

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

onResult

fun onResult(result: DiffResult): Unit

onViewAttachedToWindow

fun onViewAttachedToWindow(holder: EpoxyViewHolder): Unit

onViewDetachedFromWindow

fun onViewDetachedFromWindow(holder: EpoxyViewHolder): Unit

removeModelBuildListener

fun removeModelBuildListener(listener: OnModelBuildFinishedListener!): Unit

setupStickyHeaderView

fun setupStickyHeaderView(stickyHeader: View): Unit

Delegates the callbacks received in the adapter to the controller.

teardownStickyHeaderView

fun teardownStickyHeaderView(stickyHeader: View): Unit

Delegates the callbacks received in the adapter to the controller.

Inherited Functions

getItemId

open fun getItemId(position: Int): Long

getItemViewType

open fun getItemViewType(position: Int): Int

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

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

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.

onRestoreInstanceState

open fun onRestoreInstanceState(inState: Bundle?): Unit

onSaveInstanceState

open fun onSaveInstanceState(outState: Bundle!): 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.