library / com.camerash.filterdrawer / ChildAdapter

ChildAdapter

class ChildAdapter<Parent : ParentItem, Child : ChildItem> : Adapter<ViewHolder>

Adapter for ChildItem used in the FilterDrawer

Parameters

Parent - Your custom parent type that extends ParentItem

Child - Your custom child type that extends ChildItem

parent - ParentItem hosting this ChildAdapter

childItemList - List of ChildItem

callback - Callback to ParentItem ViewHolder when selection changes. Boolean indicates whether

Author
Camerash

See Also

ChildItem

ParentAdapter

Constructors

<init>

ChildAdapter(parent: Parent, childItemList: List<Child>, callback: (Set<Child>, Boolean) -> Unit)

Adapter for ChildItem used in the FilterDrawer

Properties

childItemList

val childItemList: List<Child>

List of ChildItem

parent

val parent: Parent

ParentItem hosting this ChildAdapter

Functions

getItemCount

fun getItemCount(): Int

getSelectedChildSet

fun getSelectedChildSet(): Set<Child>

onBindViewHolder

fun onBindViewHolder(holder: ViewHolder, position: Int): Unit

Called when view holder request binding Leave empty as we will be using the method that receives payloads

fun onBindViewHolder(holder: ViewHolder, position: Int, payloads: MutableList<Any>): Unit

Called when view holder request binding

onCreateViewHolder

fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder

Inflate view and create view holder

reset

fun reset(): Unit

Reset child filters

Companion Object Properties

RESET_FLAG

const val RESET_FLAG: Int