package Ġcom . an ang kur . movie ku . consumer . feature . main . tv Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . an ang kur . movie ku . consumer . Build Config . base ImageUrl Ċ import Ġcom . an ang kur . movie ku . consumer . R Ċ import Ġcom . an ang kur . movie ku . consumer . data . model . Result Ċ import Ġcom . an ang kur . movie ku . consumer . feature . main . Main Item Listener Ċ import Ġcom . an ang kur . movie ku . consumer . utils . Utils Ċ import Ġcom . bump tech . glide . G lide Ċ import Ġcom . bump tech . glide . load . resource . bitmap . Rounded C orners Ċ import Ġcom . bump tech . glide . request . RequestOptions Ċ import Ġkotlinx . android . synt hetic . main . item _ main _ horizontal _ land scape . view .* Ċ Ċ class ĠT v Adapter ( private Ġval Ġmain Item Listener : ĠMain Item Listener ): ĠRecyclerView . Adapter < Tv Adapter . ViewHolder >() Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġitems Ġ= ĠArrayList < Result >() ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠViewHolder ( LayoutInflater . from ( parent . context ). inflate ( R . layout . item _ main _ horizontal _ land scape , Ġparent , Ġfalse )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġitems . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( items [ position ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Recycler Data ( data : ĠList < Result > ){ ĊĠĠĠĠĠĠĠ Ġitems . clear () ĊĠĠĠĠĠĠĠ Ġitems . addAll ( data ) ĊĠĠĠĠĠĠĠ Ġnotify DataSet Changed () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinner Ġclass ĠViewHolder ( view : ĠView ): ĠRecyclerView . ViewHolder ( view ){ ĊĠĠĠĠĠĠĠ Ġfun Ġbind ( data : ĠResult ){ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . tv _ title . text Ġ= Ġdata . original _ name ?: data . original _ title ĊĠĠĠĠĠĠĠĠĠĠĠ ĠG lide . with ( item View . context ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. load ("$ base ImageUrl ${ data . backdrop _ path ?: data . poster _ path }") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply ( RequestOptions (). center Crop ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply ( RequestOptions (). transform ( Rounded C orners ( 4 8 ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply ( RequestOptions (). placeholder ( Utils . create Circular Progress Drawable ( item View . context ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply ( RequestOptions (). error ( R . drawable . ic _ broken _ image )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. into ( item View . iv _ item ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . rating . rating Ġ= ĠUtils . nom al ize Rating ( data . vote _ average ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . setOnClickListener Ġ{ Ġmain Item Listener . onClick Item ( data ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }