package Ġsim ra . android test . g he is ary . tw test . film . list Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . content . Context Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . bump tech . glide . G lide Ċ import Ġcom . bump tech . glide . load . resource . drawable . Drawable Transition Options Ċ import Ġio . reactivex . Observable Ċ import Ġio . reactivex . subjects . Publish Subject Ċ import Ġir . co bal . data . network . model . SearchResult Ċ import Ġkotlinx . android . synt hetic . main . item _ film _ list . view .* Ċ import Ġsim ra . android test . g he is ary . tw test . R Ċ Ċ class ĠFil m ListAdapter ( Ġval Ġcontext : ĠContext ) Ġ: ĠRecyclerView . Adapter < Film ListView Holder >() Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġclick Subject Ġ= ĠPublish Subject . create < String >() ĊĠĠĠ Ġval Ġclick Event Ġ: ĠObservable < String > Ġ= Ġclick Subject ĊĠĠĠ Ġvar Ġitems Ġ= ĠSearch Result ( Search Ġ= ĠArrayList ()) ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠFil m ListView Holder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġview Ġ= ĠLayoutInflater . from ( context ). inflate ( R . layout . item _ film _ list , Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn ĠFil m ListView Holder ( view ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress Lint (" SetText I 1 8 n ", Ġ" Resource As Color ") ĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠFil m ListView Holder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . item Film List Title TextView . text Ġ= Ġitems . Search [ position ]. Title ĊĊĠĠĠĠĠĠĠ ĠG lide . with ( context ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. load ( items . Search [ position ]. Post er ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. transition ( Drawable Transition Options . with Cross Fade ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. into ( holder . item Film List Post er ImageView ) ĊĊĠĠĠĠĠĠĠ Ġholder . item Film List Constraint Layout . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclick Subject . onNext ( items . Search [ position ]. imdb ID ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġitems . Search . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠsetData ( items Ġ: ĠSearch Result ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . items Ġ= Ġitems ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠFil m ListView Holder Ġ( view : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( view ) Ġ{ ĊĠĠĠ Ġval Ġitem Film List Post er ImageView Ġ= Ġview . item Film List Post er ImageView !! ĊĠĠĠ Ġval Ġitem Film List Title TextView Ġ= Ġview . item Film List Title TextView !! ĊĠĠĠ Ġval Ġitem Film List Constraint Layout Ġ= Ġview . item Film List Constraint Layout !! Ċ } ĊĊĊĊ