library / com.camerash.filterdrawer / ParentAdapter

ParentAdapter

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

Adapter for ParentItem used in the FilterDrawer

Parameters

Parent - Your custom parent type that extends ParentItem

Child - Your custom child type that extends ChildItem

parentItemList - list of ParentItem

childSelectListenerList - list of OnChildSelectListener to be called when changes happens

Author
Camerash

See Also

ParentItem

ChildAdapter

Constructors

<init>

ParentAdapter(parentItemList: List<Parent>, childSelectListenerList: ArrayList<OnChildSelectListener<Parent, Child>>)

Adapter for ParentItem used in the FilterDrawer

Properties

childSelectListenerList

var childSelectListenerList: ArrayList<OnChildSelectListener<Parent, Child>>

list of OnChildSelectListener to be called when changes happens

Functions

getItemCount

fun getItemCount(): Int

getSelectedChildren

fun getSelectedChildren(): Map<Parent, Set<Child>>

Get the map of ParentItem to set of currently selected ChildItem

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 FilterDrawer

updateItems

fun updateItems(parentItemList: List<Parent>): Unit

Update list of ParentItem

Companion Object Properties

RESET_FLAG

const val RESET_FLAG: Int