BaseBindListAdapter

open class BaseBindListAdapter<T : Any>(var mContext: Context, val mVariableId: Int, diffCallback: ItemDiffUtil<T>) : ListAdapter<ItemWrapper<T>, ItemBindHolder<T>> , ItemClickListener<T>

BaseBindListAdapter

Since

1.2.0

Constructors

Link copied to clipboard
constructor(mContext: Context, mVariableId: Int, diffCallback: ItemDiffUtil<T>)

Properties

Link copied to clipboard
protected var mContext: Context
Link copied to clipboard
private var mEmptyItem: ItemWrapper<T>?
Link copied to clipboard
private var mLoadingItem: ItemWrapper<T>?
Link copied to clipboard
Link copied to clipboard
private val mVariableId: Int

Set the id of the variable if the content in the layout file is as follows:

Functions

Link copied to clipboard
override fun getItemViewType(position: Int): Int
Link copied to clipboard
Link copied to clipboard
override fun onBindViewHolder(holder: ItemBindHolder<T>, position: Int)
Link copied to clipboard
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemBindHolder<T>
Link copied to clipboard
fun setEmptyView(@LayoutRes id: Int?, scope: ItemWrapper<T>.() -> Unit = {})

Custom empty layout. Specify the layout through id and specify the click event related to the layout through scope.

Link copied to clipboard
fun setLoadingView(@LayoutRes id: Int?, scope: ItemWrapper<T>.() -> Unit = {})

Custom loading layout. Specify the layout through id and specify the click event related to the layout through scope.

Link copied to clipboard
override fun setOnItemClickListener(listener: OnItemClickListener<T>?)

Register a callback to be invoked when the item is clicked.

Link copied to clipboard

Register a callback to be invoked when the item is clicked and held.

Link copied to clipboard
protected open fun setViewHolder(binding: ViewDataBinding): ItemBindHolder<T>

Returns ItemBindHolder by default. If you want to customize ItemBindHolder you need to inherit ItemBindHolder and override the setViewHolder method to use your customized ItemBindHolder as the return value.

Link copied to clipboard
open override fun submitList(list: List<ItemWrapper<T>>?)
open override fun submitList(list: List<ItemWrapper<T>>?, commitCallback: Runnable?)

fun submitList(items: List<T>, @LayoutRes id: Int? = null, commitCallback: Runnable? = null, scope: ItemWrapper<T>.() -> Unit = {})

Submits a new list to be diffed, and displayed.

Link copied to clipboard

Submits a loading layout to be displayed.