/* Ċ Ġ* ĠProject : Ġme te o Ċ Ġ* ĠFile : ĠSt azione Val ang he ListAdapter . kt Ċ Ġ* Ċ Ġ* ĠCreated Ġby Ġfat ta zz o Ċ Ġ* ĠCopyright ĠÂ© Ġ 2 0 1 9 ĠG ian luc a ĠF att ar si . ĠAll Ġrights Ġreserved . Ċ Ġ* Ċ Ġ* ĠMIT ĠLicense Ċ Ġ* ĠPermission Ġis Ġhereby Ġgranted , Ġfree Ġof Ġcharge , Ġto Ġany Ġperson Ġobtaining Ġa Ġcopy Ċ Ġ* Ġof Ġthis Ġsoftware Ġand Ġassociated Ġdocumentation Ġfiles Ġ( the Ġ" Software "), Ġto Ġdeal Ċ Ġ* Ġin Ġthe ĠSoftware Ġwithout Ġrestriction , Ġincluding Ġwithout Ġlimitation Ġthe Ġrights Ċ Ġ* Ġto Ġuse , Ġcopy , Ġmodify , Ġmerge , Ġpublish , Ġdistribute , Ġsublicense , Ġand / or Ġsell Ċ Ġ* Ġcopies Ġof Ġthe ĠSoftware , Ġand Ġto Ġpermit Ġpersons Ġto Ġwhom Ġthe ĠSoftware Ġis Ċ Ġ* Ġfurnished Ġto Ġdo Ġso , Ġsubject Ġto Ġthe Ġfollowing Ġconditions : Ċ Ġ* Ċ Ġ* ĠThe Ġabove Ġcopyright Ġnotice Ġand Ġthis Ġpermission Ġnotice Ġshall Ġbe Ġincluded Ġin Ġall Ċ Ġ* Ġcopies Ġor Ġsubstantial Ġportions Ġof Ġthe ĠSoftware . Ċ Ġ* Ċ Ġ* ĠTHE ĠSOFTWARE ĠIS ĠPROVIDED Ġ" AS ĠIS ", ĠWITHOUT ĠWARRANTY ĠOF ĠANY ĠKIND , ĠEXPRESS ĠOR Ċ Ġ* ĠIMPLIED , ĠINCLUDING ĠBUT ĠNOT ĠLIMITED ĠTO ĠTHE ĠWARRANTIES ĠOF ĠMERCHANTABILITY , Ċ Ġ* ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠAND ĠNONINFRINGEMENT . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE Ċ Ġ* ĠAUTHORS ĠOR ĠCOPYRIGHT ĠHOLDERS ĠBE ĠLIABLE ĠFOR ĠANY ĠCLAIM , ĠDAMAGES ĠOR ĠOTHER Ċ Ġ* ĠLIABILITY , ĠWHETHER ĠIN ĠAN ĠACTION ĠOF ĠCONTRACT , ĠTORT ĠOR ĠOTHERWISE , ĠARISING ĠFROM , Ċ Ġ* ĠOUT ĠOF ĠOR ĠIN ĠCONNECTION ĠWITH ĠTHE ĠSOFTWARE ĠOR ĠTHE ĠUSE ĠOR ĠOTHER ĠDEALINGS ĠIN ĠTHE Ċ Ġ* ĠSOFTWARE . Ċ Ġ*/ Ċ Ċ package Ġcom . gmail . fat ta zz o . me te o . activity . st azioni . val ang he . an agr af ica Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . gmail . fat ta zz o . me te o . data . db . entities . St azione Val ang he Ċ Ċ /** Ċ Ġ* Ċ Ġ* Ġ@ author Ġfat ta zz o Ċ Ġ* Ċ Ġ* Ġdate : Ġ 0 1 / feb / 2 0 1 6 Ċ Ġ*/ Ċ class ĠSt azione Val ang he ListAdapter ( var Ġdata : ĠList < St azione Val ang he >, Ġval Ġcontext : ĠContext ) Ġ: ĊĠĠĠ ĠRecyclerView . Adapter < St azione Val ang he ListAdapter . St azione ViewHolder >() Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġold Pos Ġ= Ġ 0 ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠSt azione ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( data [ position ]) ĊĊĠĠĠĠĠĠĠ Ġholder . item View . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġold Pos Ġ= Ġposition ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotify DataSet Changed () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// click Listener . onClick ( data [ position ]) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// ( holder . item View Ġas ĠSt azione Val ang he View ). setSelected View ( old Pos Ġ== Ġposition ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠSt azione ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠSt azione ViewHolder ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSt azione Val ang he View _. build ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcontext ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ= Ġdata . size ĊĊĠĠĠ Ġinner Ġclass ĠSt azione ViewHolder ( view : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( view ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġbind ( st azione Val ang he : ĠSt azione Val ang he ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( item View Ġas ĠSt azione Val ang he View ). bind ( st azione Val ang he ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠOn ClickListener Ġ{ ĊĠĠĠĠĠĠĠ Ġfun ĠonClick ( st azione Val ang he : ĠSt azione Val ang he ) ĊĠĠĠ Ġ} Ċ } Ċ