VerseModel

abstract class VerseModel<T : Any>(val id: Any, val data: T)

Represents a piece of UI in a androidx.recyclerview.widget.RecyclerView.

Inheritors

Constructors

Link copied to clipboard
constructor(id: Any, data: T)

Properties

Link copied to clipboard
val data: T
Link copied to clipboard
val id: Any
Link copied to clipboard
abstract val layoutRes: Int
Link copied to clipboard
open val onAttach: () -> Unit? = null
Link copied to clipboard
open val onClick: () -> Unit? = null
Link copied to clipboard
open val onDetach: () -> Unit? = null

Functions

Link copied to clipboard
abstract fun bind(holder: SmartViewHolder)

Binds the data to the holder.

open fun bind(holder: SmartViewHolder, payloads: List<Any>)
Link copied to clipboard
abstract fun createHolder(parent: ViewGroup): SmartViewHolder

Creates a new SmartViewHolder for this model.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open fun getSpanSize(totalSpan: Int, position: Int): Int
Link copied to clipboard

Returns the stable ViewType ID for this model. Uses instance-level caching to ensure O(1) performance during scrolling.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun onCreate(holder: SmartViewHolder)

One-time initialization callback executed immediately after createHolder. Use this to set up click listeners or one-time styling.

Link copied to clipboard
open fun onViewCreated(view: View)

Optional callback executed when the view is created.