package Ġcom . g ost soft . gift iv us . views Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . util . Log Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . g ost soft . gift iv us . databinding . Single Recipient Binding Ċ import Ġcom . g ost soft . gift iv us . models . Recipient Ċ Ċ class ĠRe cipient Adapter Ġ( private Ġval Ġrecipients : ĠList < Recipient >, Ġprivate Ġval Ġcontext : ĠContext ): ĠRecyclerView . Adapter < Recipient Adapter . Recipient ViewHolder > Ġ() Ġ{ ĊĠĠĠ Ġprivate Ġval ĠTAG Ġ= ĠRe cipient Adapter :: class . simple Name ĊĠĠĠ Ġclass ĠRe cipient ViewHolder ( val Ġsingle Recipient Binding : ĠSingle Recipient Binding ): ĠRecyclerView . ViewHolder ( single Recipient Binding . root ) ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠRe cipient ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbinder Ġ= ĠSingle Recipient Binding . inflate ( LayoutInflater . from ( parent . context ), Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ ĠLog . d ( TAG , Ġ" view Ġholder Ġcreated .. ") ĊĠĠĠĠĠĠĠ Ġreturn ĠRe cipient ViewHolder ( binder ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠRe cipient ViewHolder , Ġindex : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Ġ= Ġrecipients [ index ] ĊĠĠĠĠĠĠĠ Ġval Ġcard Ġ= Ġholder . single Recipient Binding ĊĠĠĠĠĠĠĠ Ġcard . root . setOnClickListener Ġ{ Ġopen Gift List ( index )} ĊĠĠĠĠĠĠĠ Ġcard . recipient Img . setImage Bitmap ( recipient . image ) ĊĠĠĠĠĠĠĠ Ġcard . recipient Name . text Ġ= Ġrecipient . toString () Ġ// ĠCon cats Ġfirst Ġand Ġlast Ġname ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġopen Gift List ( index : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= ĠIntent ( context , ĠG ift ListView :: class . java ). putExtra ( EXTRA _ ID , Ġindex ) ĊĠĠĠĠĠĠĠ Ġcontext . startActivity ( intent ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count () Ġ= Ġrecipients . size Ċ Ċ }