package Ġcom . ably . tracking . example . publisher Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . ably . tracking . publisher . Track able Ċ import Ġkotlinx . android . synt hetic . main . item _ track able . view .* Ċ Ċ type alias ĠOn Track able Item Clicked Callback Ġ= Ġ( Track able ) Ġ-> ĠUnit Ċ Ċ class ĠTrack ables Adapter Ġ: ĠRecyclerView . Adapter < Track able ViewHolder >() Ġ{ ĊĠĠĠ Ġvar Ġtrack ables : ĠList < Track able > Ġ= Ġempty List () ĊĠĠĠĠĠĠĠ Ġset ( value ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfield Ġ= Ġvalue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotify DataSet Changed () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġvar Ġon Item Clicked Callback : ĠOn Track able Item Clicked Callback ? Ġ= Ġnull ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠTrack able ViewHolder Ġ= ĊĠĠĠĠĠĠĠ ĠTrack able ViewHolder ( LayoutInflater . from ( parent . context ). inflate ( R . layout . item _ track able , Ġparent , Ġfalse )) ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠTrack able ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( track ables [ position ], Ġon Item Clicked Callback ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ= Ġtrack ables . size Ċ } Ċ Ċ class ĠTrack able ViewHolder ( view : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( view ) Ġ{ ĊĠĠĠ Ġfun Ġbind ( track able : ĠTrack able , Ġon Item Clicked Callback : ĠOn Track able Item Clicked Callback ?) Ġ{ ĊĠĠĠĠĠĠĠ ĠitemView . track able Id TextView . text Ġ= Ġtrack able . id ĊĠĠĠĠĠĠĠ Ġon Item Clicked Callback ?. let Ġ{ Ġcallback Ġ-> ĠitemView . setOnClickListener Ġ{ Ġcallback ( track able ) Ġ} Ġ} ĊĠĠĠ Ġ} Ċ } Ċ