package Ġde . nic id ien ase . chaos flix . touch . browse . streaming ĊĊ Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . util . Log Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . squareup . pic asso . Pic asso Ċ import Ġde . nic id ien ase . chaos flix . common . entities . streaming . Live Conference Ċ import Ġde . nic id ien ase . chaos flix . databinding . Item Live event Card view Binding Ċ Ċ class ĠLiv est ream Adapter ( val Ġlistener : ĠLiv est ream List Fragment . Interaction Listener Ġ, Ġlive Con fer ences : ĠList < Live Conference > Ġ= Ġempty List ()) Ġ: ĠRecyclerView . Adapter < Liv est ream Adapter . ViewHolder > (){ ĊĊ ĉ late init Ġvar Ġitems : ĠMutable List < Streaming Item > ĊĊ ĉ init Ġ{ Ċĉ ĉ setContent ( live Con fer ences ) Ċ ĉ } ĊĊ ĉ private Ġfun ĠconvertTo Streaming ItemList ( live Con fer ences : ĠList < Live Conference >) Ġ{ Ċĉ ĉ live Con fer ences . map Ġ{ Ġlive Conference Ġ-> Ċĉĉ ĉ live Conference . groups . map Ġ{ Ġgroup Ġ-> Ċĉĉĉ ĉ group . rooms . map Ġ{ Ġroom Ġ-> Ċĉĉĉĉ ĉ items . add ( Streaming Item ( live Conference , Ġgroup , Ġroom )) Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġval ĠTAG Ġ= ĠLiv est ream Adapter :: class . simple Name ĊĊ ĉ fun Ġset Content ( live Con fer ences : ĠList < Live Conference > ){ Ċĉ ĉ items Ġ= ĠArrayList < Streaming Item >() Ċĉ ĉ convertTo Streaming ItemList ( live Con fer ences ) Ċĉ ĉ Log . d ( TAG ," Size :" Ġ+ Ġitems . size ) Ċĉ ĉ notify DataSet Changed () Ċ ĉ } ĊĊ ĉ override Ġfun ĠgetItem Count (): ĠInt Ġ{ Ċĉ ĉ return Ġitems . size Ċ ĉ } ĊĊ ĉ override Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup ?, Ġview Type : ĠInt ): ĠViewHolder Ġ{ Ċĉ ĉ val Ġbinding Ġ= Ċĉĉĉ ĉ Item Live event Card view Binding . inflate ( LayoutInflater . from ( parent ?. context ), parent , false ) Ċĉ ĉ return ĠViewHolder ( binding ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Bind ViewHolder ( holder : ĠViewHolder ?, Ġposition : ĠInt ) Ġ{ Ċĉ ĉ val Ġitem Ġ= Ġitems [ position ] ĊĊĉ ĉ holder !!. binding . item Ġ= Ġitem Ċĉ ĉ Pic asso . with ( holder ?. binding ?. root ?. context ) Ċĉĉĉ ĉ . load ( item . room . thumb ) Ċĉĉĉ ĉ . no Fade () Ċĉĉĉ ĉ . fit () Ċĉĉĉ ĉ . center Inside () Ċĉĉĉ ĉ . into ( holder ?. binding ?. imageView ) ĊĊĉ ĉ holder . binding . root . setOnClickListener ( View . OnClickListener Ġ{ Ċĉĉ ĉ listener . on Stream Selected ( item ) Ċĉ ĉ }) Ċ ĉ } ĊĊĊ ĉ inner Ġclass ĠViewHolder ( val Ġbinding : ĠItem Live event Card view Binding ) Ġ: ĠRecyclerView . ViewHolder ( binding . root ) Ċ Ċ } Ċ