package Ġcom . k yle du o . al add in . gen ie . actions . view Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . content . Context Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . dr ake et . mult it ype . Item View Delegate Ċ import Ġcom . k yle du o . al add in . gen ie . actions . R Ċ import Ġcom . k yle du o . al add in . gen ie . actions . data . Action Ċ import Ġcom . k yle du o . al add in . gen ie . actions . data . No Receiver Ref Holder Ċ import Ġcom . k yle du o . al add in . gen ie . actions . databinding . Al add in Gen ie Actions Action Item Binding Ċ import Ġcom . k yle du o . al add in . ui . On ItemClickListener Ċ import Ġcom . k yle du o . al add in . ui . inflate View Ċ Ċ /** Ċ Ġ* Ġ@ author Ġk yle du o Ġon Ġ 2 0 2 1 / 6 / 1 7 Ċ Ġ*/ Ċ class ĠHook Action Item View Delegate ( ĊĠĠĠ Ġprivate Ġval Ġon ItemClickListener : ĠOn ItemClickListener < Action < Any >> Ċ ) Ġ: ĠItem View Delegate < Action <* >, ĠHook Action Item ViewHolder >() Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠHook Action Item ViewHolder , Ġitem : ĠAction <* >) Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Suppress (" UN CHECK ED _ CAST ") ĊĠĠĠĠĠĠĠ Ġholder . bind ( item Ġas ĠAction < Any >) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( context : ĠContext , Ġparent : ĠViewGroup ): ĠHook Action Item ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠHook Action Item ViewHolder ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġparent . inflate View ( R . layout . al add in _ gen ie _ actions _ action _ item ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon ItemClickListener ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠHook Action Item ViewHolder ( ĊĠĠĠ ĠitemView : ĠView , ĊĠĠĠ Ġprivate Ġval Ġon ItemClickListener : ĠOn ItemClickListener < Action < Any >> Ċ ) Ġ: ĠRecyclerView . ViewHolder ( item View ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġbinding Ġ= ĠAl add in Gen ie Actions Action Item Binding . bind ( item View ) ĊĊĠĠĠ Ġ@ Suppress Lint (" SetText I 1 8 n ") ĊĠĠĠ Ġfun Ġbind ( action : ĠAction < in ĠAny >) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . al add in Gen ie Actions Action ItemName . text Ġ= Ġaction . title ĊĠĠĠĠĠĠĠ Ġbinding . al add in Gen ie Actions Action Item Content . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon ItemClickListener . on Item Click ( absolute Adapter Position , Ġaction ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( action . reference . get () Ġ== ĠNo Receiver Ref Holder ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . al add in Gen ie Actions Action Item Content . setBackground Resource ( R . drawable . al add in _ gen ie _ actions _ no _ receiver _ action _ item _ content _ bg ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . al add in Gen ie Actions Action Item Receiver . text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ No ĠReceiver ]" ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . al add in Gen ie Actions Action Item Content . setBackground Resource ( R . drawable . al add in _ gen ie _ actions _ action _ item _ content _ bg ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . al add in Gen ie Actions Action Item Receiver . text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ ${ action . receiver Class . simple Name } Ġ# ${ action . receiver No }] " ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }