EpoxyModel

abstract class EpoxyModel<T>

Helper to bind data to a view using a builder style. The parameterized type should extend Android's View or EpoxyHolder.

See also

Constructors

EpoxyModel
Link copied to clipboard
open fun EpoxyModel()

Types

AddPredicate
Link copied to clipboard
interface AddPredicate
#addIf(AddPredicate, EpoxyController)
SpanSizeOverrideCallback
Link copied to clipboard
interface SpanSizeOverrideCallback

Functions

addIf
Link copied to clipboard
open fun addIf(condition: Boolean, @NonNull() controller: EpoxyController)
Add this model to the given controller if the condition is true.
open fun addIf(@NonNull() predicate: EpoxyModel.AddPredicate, @NonNull() controller: EpoxyController)
Add this model to the given controller if the AddPredicate return true.
addTo
Link copied to clipboard
open fun addTo(@NonNull() controller: EpoxyController)
Add this model to the given controller.
bind
Link copied to clipboard
open fun bind(@NonNull() view: T)
Binds the current data to the given view.
open fun bind(@NonNull() view: T, @NonNull() previouslyBoundModel: EpoxyModel<out Any>)
Similar to bind, but provides a non null model which was previously bound tothis view.
open fun bind(@NonNull() view: T, @NonNull() payloads: List<Any>)
Similar to bind, but provides a non null, non empty list of payloadsdescribing what changed.
buildView
Link copied to clipboard
open fun buildView(@NonNull() parent: ViewGroup): View
Create and return a new instance of a view for this model.
equals
Link copied to clipboard
open fun equals(o: Any): Boolean
getSpanSize
Link copied to clipboard
open fun getSpanSize(totalSpanCount: Int, position: Int, itemCount: Int): Int
Subclasses can override this if they want their view to take up more than one span in a gridlayout.
hashCode
Link copied to clipboard
open fun hashCode(): Int
hide
Link copied to clipboard
open fun hide(): EpoxyModel<T>
Change the visibility of the model so that it's view is hidden.
id
Link copied to clipboard
open fun id(): Long
open fun id(@Nullable() key: CharSequence): EpoxyModel<T>
Use a string as the model id.
open fun id(@Nullable() ids: Array<Number>): EpoxyModel<T>
Use multiple numbers as the id for this model.
open fun id(id: Long): EpoxyModel<T>
Override the default id in cases where the data subject naturally has an id, like an objectfrom a database.
open fun id(@Nullable() key: CharSequence, @Nullable() otherKeys: Array<CharSequence>): EpoxyModel<T>
Use several strings to define the id of the model.
open fun id(@Nullable() key: CharSequence, id: Long): EpoxyModel<T>
Set an id that is namespaced with a string.
open fun id(id1: Long, id2: Long): EpoxyModel<T>
Use two numbers as the id for this model.
isShown
Link copied to clipboard
open fun isShown(): Boolean
Whether the model's view should be shown on screen.
layout
Link copied to clipboard
open fun layout(@LayoutRes() layoutRes: Int): EpoxyModel<T>
onFailedToRecycleView
Link copied to clipboard
open fun onFailedToRecycleView(@NonNull() view: T): Boolean
Called if the RecyclerView failed to recycle this model's view.
onViewAttachedToWindow
Link copied to clipboard
open fun onViewAttachedToWindow(@NonNull() view: T)
Called when this model's view is attached to the window.
onViewDetachedFromWindow
Link copied to clipboard
open fun onViewDetachedFromWindow(@NonNull() view: T)
Called when this model's view is detached from the the window.
onVisibilityChanged
Link copied to clipboard
open fun onVisibilityChanged(@FloatRange(from = 0.0f, to = 100.0fpercentVisibleHeight: Float, @FloatRange(from = 0.0f, to = 100.0fpercentVisibleWidth: Float, @Px() visibleHeight: Int, @Px() visibleWidth: Int, @NonNull() view: T)
TODO link to the wiki
onVisibilityStateChanged
Link copied to clipboard
open fun onVisibilityStateChanged(visibilityState: Int, @NonNull() view: T)
TODO link to the wiki
reset
Link copied to clipboard
open fun reset(): EpoxyModel<T>
Sets fields of the model to default ones.
shouldSaveViewState
Link copied to clipboard
open fun shouldSaveViewState(): Boolean
Whether the adapter should save the state of the view bound to this model.
show
Link copied to clipboard
open fun show(): EpoxyModel<T>
Change the visibility of the model so that it's view is shown.
open fun show(show: Boolean): EpoxyModel<T>
Change the visibility of the model's view.
spanSize
Link copied to clipboard
fun spanSize(totalSpanCount: Int, position: Int, itemCount: Int): Int
Returns the actual span size of this model, using the SpanSizeOverrideCallback if onewas set, otherwise using the value from getSpanSize
spanSizeOverride
Link copied to clipboard
open fun spanSizeOverride(@Nullable() spanSizeCallback: EpoxyModel.SpanSizeOverrideCallback): EpoxyModel<T>
toString
Link copied to clipboard
open fun toString(): String
unbind
Link copied to clipboard
open fun unbind(@NonNull() view: T)
Called when the view bound to this model is recycled.

Properties

layout
Link copied to clipboard
private open val layout: Int

Inheritors

SimpleEpoxyModel
Link copied to clipboard
EpoxyModelWithView
Link copied to clipboard
EpoxyModelWithHolder
Link copied to clipboard