baserecyclerviewadapter / com.skydoves.baserecyclerviewadapter / BaseAdapter

BaseAdapter

abstract class BaseAdapter : Adapter<BaseViewHolder>, LifecycleObserver

BaseAdapter is an abstract class for structuring the base adapter class.

Constructors

<init>

BaseAdapter()

BaseAdapter is an abstract class for structuring the base adapter class.

Functions

addItemListOnSection

fun <T> addItemListOnSection(section: Int, items: List<T>): Unit

adds an item list on the section.

addItemOnSection

fun addItemOnSection(section: Int, item: Any): Unit

adds an item on the section.

addSection

fun <T> addSection(section: List<T>): Unit

adds a section on the section list.

addSectionList

fun <T> addSectionList(sections: List<List<T>>): Unit

adds a section list on the section list.

clearAllSections

fun clearAllSections(): Unit

clears all sections.

clearSection

fun clearSection(section: Int): Unit

clears a section.

getItemCount

open fun getItemCount(): Int

gets all item counts on the sections.

getItemViewType

open fun getItemViewType(position: Int): Int

insertSection

fun <T> insertSection(row: Int, section: List<T>): Unit

inserts an section on the section list.

layout

abstract fun layout(sectionRow: SectionRow): Int

returns layout resources by section rows.

objectFromPosition

fun objectFromPosition(position: Int): Any

objectFromSectionRow

fun objectFromSectionRow(sectionRow: SectionRow): Any

onBindViewHolder

open fun onBindViewHolder(viewHolder: BaseViewHolder, position: Int): Unit

onCreateViewHolder

open fun onCreateViewHolder(viewGroup: ViewGroup, layout: Int): BaseViewHolder

onDestroyed

fun onDestroyed(): Unit

onViewAttachedToWindow

open fun onViewAttachedToWindow(holder: BaseViewHolder): Unit

onViewDetachedFromWindow

open fun onViewDetachedFromWindow(holder: BaseViewHolder): Unit

removeItemOnSection

fun removeItemOnSection(section: Int, item: Any): Unit

removes an item on the section.

removeSection

fun <T> removeSection(section: Int): Unit

removes a section on the section list.

reverseSection

fun <T> reverseSection(section: Int): Unit

reverses item list on the section.

sectionCount

fun sectionCount(section: Int): Int

gets section count.

sectionItems

fun <T> sectionItems(section: Int): MutableList<Any>

gets mutable an item list on the sections.

sections

fun sections(): MutableList<MutableList<Any>>

gets mutable section list.

viewHolder

abstract fun viewHolder(layout: Int, view: View): BaseViewHolder

returns RecyclerView.ViewHolder by layouts.