package Ġio . github . gus and rian os . fox for reddit . utilities Ċ Ċ import Ġandroid . text . format . Date Utils Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . TextView Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġio . github . gus and rian os . fox for reddit . R Ċ import Ġio . github . gus and rian os . fox for reddit . data . models . Thing Ċ import Ġio . not ies . mark won . Mark won Ċ import Ġorg . apache . commons . text . String Escape Utils Ċ Ċ class ĠCon versation Adapter ( ĊĠĠĠ Ġprivate Ġval Ġthing : ĠThing , ĊĠĠĠ Ġprivate Ġval Ġlistener : ĠUser Clicked Listener , ĊĠĠĠ Ġprivate Ġval Ġmark won : ĠMark won Ċ ) Ġ: ĠRecyclerView . Adapter < Conversation Adapter . ViewHolder >() Ġ{ ĊĊĠĠĠ Ġinner Ġclass ĠViewHolder ( view : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( view ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġtxt User : ĠTextView Ġ= Ġview . findViewById ( R . id . txt _ messages _ with _ user _ item _ username ) ĊĠĠĠĠĠĠĠ Ġval Ġtxt Time Sent : ĠTextView Ġ= Ġview . findViewById ( R . id . txt _ messages _ with _ user _ item _ time _ sent ) ĊĠĠĠĠĠĠĠ Ġval Ġtxt Body : ĠTextView Ġ= Ġview . findViewById ( R . id . txt _ messages _ with _ user _ item _ body ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠViewHolder ( LayoutInflater . from ( parent . context ). inflate ( R . layout . item _ messages _ with _ user , Ġparent , Ġfalse )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġthing . data ?. children ! ![ position ]. data !! ĊĠĠĠĠĠĠĠ Ġholder . txt User . text Ġ= Ġdata . author ĊĠĠĠĠĠĠĠ Ġholder . txt Time Sent . text Ġ= ĠDate Utils . get Relative TimeSpan String ( data . created Utc . times ( 1 0 0 0 )). toString () ĊĠĠĠĠĠĠĠ Ġmark won . set Markdown ( holder . txt Body , ĠString Escape Utils . un escape Xml ( data . body )) ĊĠĠĠĠĠĠĠ Ġholder . txt User . setOnClickListener Ġ{ Ġlistener . on User Clicked ( holder . txt User . text . toString ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġthing . data ?. children ?. size !! ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠUser Clicked Listener Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġon User Clicked ( user : ĠString ?) ĊĠĠĠ Ġ} Ċ } Ċ