package Ġsg . v ouch . v ouch sdk . ui . adapter Ċ Ċ import Ġandroid . graphics . Color Ċ import Ġandroid . graphics . Port er D uff Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġsg . v ouch . v ouch sdk . R Ċ import Ġsg . v ouch . v ouch sdk . data . model . message . response . Button Model Ċ import Ġsg . v ouch . v ouch sdk . ui . V ouch Chat ClickListener Ċ import Ġsg . v ouch . v ouch sdk . ui . V ouch Chat ViewModel Ċ import Ġsg . v ouch . v ouch sdk . ui . model . V ouch Chat Model Ċ import Ġsg . v ouch . v ouch sdk . ui . model . V ouch Chat Type Ċ import Ġsg . v ouch . v ouch sdk . utils . parse Color Ċ import Ġsg . v ouch . v ouch sdk . utils . safe Ċ import Ġsg . v ouch . v ouch sdk . utils . setFont Family Ċ import Ġkotlinx . android . synt hetic . main . item _ gallery _ element _ button . view .* Ċ Ċ /** Ċ Ġ* Ġ@ Author Ġby ĠRad h ika ĠY us uf Ċ Ġ* ĠBand ung , Ġon Ġ 2 0 1 9 - 0 9 - 1 0 Ċ Ġ*/ Ċ class ĠV ouch Gallery Button Adapter ( val Ġm ViewModel : ĠV ouch Chat ViewModel , Ġprivate Ġval Ġm Listener : ĠV ouch Chat ClickListener ) Ġ: ĠRecyclerView . Adapter < V ouch Gallery Button Adapter . V ouch Gallery Button Item >() Ġ{ ĊĊĠĠĠ Ġval Ġm Data : ĠMutable List < Button Model > Ġ= Ġmutable ListOf () ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠV ouch Gallery Button Item , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( m Data [ position ], Ġm ViewModel , Ġm Listener ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠV ouch Gallery Button Item Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġview Ġ= ĠLayoutInflater . from ( parent . context ). inflate ( R . layout . item _ gallery _ element _ button , Ġnull , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn ĠV ouch Gallery Button Item ( view ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġm Data . size ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġclass ĠV ouch Gallery Button Item ( private Ġval Ġm View : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( m View ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġbind ( data : ĠButton Model , ĠviewModel : ĠV ouch Chat ViewModel , Ġlistener : ĠV ouch Chat ClickListener ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcontent Data Ġ= ĠV ouch Chat Model ( data . title . safe (), Ġ"", Ġfalse , ĠV ouch Chat Type . TYPE _ BUTTON , Ġ"", Ġpayload Ġ= Ġdata . payload ?: data . url . safe (), Ġtype Value Ġ= Ġdata . type . safe ()) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġm View . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġv ouch Button Item . text Ġ= Ġcontent Data . title ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġv ouch Button Item . setTextColor ( viewModel . load Configuration . value ?. header Bg Color . parse Color ( Color . BLACK )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġv ouch Button Item . setFont Family ( viewModel . load Configuration . value ?. font Style . safe ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġborder Button . setColor Filter ( viewModel . load Configuration . value ?. header Bg Color . parse Color ( Color . BLACK ), ĠPort er D uff . Mode . SRC _ IN ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbutton Item . setOnClickListener Ġ{ Ġlistener . onClick Chat Button ( content Data . type Value , Ġcontent Data ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} Ċ Ċ }