BaseAdapter

abstract class BaseAdapter<T : Any, S : Any>(fragment: <Error class: unknown class>, val id: Int = 0, diffCallback: <Error class: unknown class><T> = BaseDiffCallback())(source)

BaseAdapter is a persistent state stored adapter that supports headers and footers. This should be used for restoring eg scroll or focus related to a view when it is recreated.

Id is a per fragment based unique id used to store the underlying data done in an internal ViewModel.

diffCallback is how the view should be handled when updating, override onUpdateContent for updates

NOTE:

By default it should save automatically, but you can also call save(recycle)

By default no state is stored, but doing an id != 0 will store

By default no headers or footers exist, override footers and headers count

Inheritors

Constructors

Link copied to clipboard
constructor(fragment: <Error class: unknown class>, id: Int = 0, diffCallback: <Error class: unknown class><T> = BaseDiffCallback())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val footers: Int = 0
Link copied to clipboard
open val headers: Int = 0
Link copied to clipboard
val id: Int = 0

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
fun getItem(position: Int): T
Link copied to clipboard
open fun getItemCount(): Int
Link copied to clipboard
fun getItemOrNull(position: Int): T?
Link copied to clipboard
fun getItemViewType(position: Int): Int
Link copied to clipboard
fun onAttachedToRecyclerView(recyclerView: <Error class: unknown class>)
Link copied to clipboard
open fun onBindContent(holder: ViewHolderState<S>, item: T, position: Int)
Link copied to clipboard
open fun onBindFooter(holder: ViewHolderState<S>)
Link copied to clipboard
open fun onBindHeader(holder: ViewHolderState<S>)
Link copied to clipboard
fun onBindViewHolder(holder: ViewHolderState<S>, position: Int)
open fun onBindViewHolder(holder: ViewHolderState<S>, position: Int, payloads: MutableList<Any>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun onDetachedFromRecyclerView(recyclerView: <Error class: unknown class>)
Link copied to clipboard
open fun onUpdateContent(holder: ViewHolderState<S>, item: T, position: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun save(recyclerView: <Error class: unknown class>)
Link copied to clipboard
open fun submitList(list: List<T>?)