ViewBindingModel

abstract class ViewBindingModel<VB : ViewBinding, T : Any>(id: Any, data: T) : VerseModel<T>

A specialized VerseModel for ViewBinding.

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
open fun bind(holder: SmartViewHolder, payloads: List<Any>)
abstract fun bind(binding: VB, item: T)

open override fun bind(holder: SmartViewHolder)

Binds the data to the holder.

Link copied to clipboard
open override 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
abstract fun inflate(inflater: LayoutInflater, parent: ViewGroup): VB
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.