package Ġcom . ju ang m . star war sm vp _ kotlin . ui . characters Ċ Ċ 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 . ju ang m . star war sm vp _ kotlin . R Ċ import Ġcom . ju ang m . star war sm vp _ kotlin . data . models . Character Ċ import Ġkotlinx . android . synt hetic . main . item _ character . view .* Ċ Ċ class ĠChar acters Adapter ( var Ġcharacters : ĠList < Character >, Ġvar Ġcontext : ĠContext ?) Ġ: ĠRecyclerView . Adapter < Characters Adapter . Character ViewHolder >() Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġp 1 : ĠInt ): ĠCharacter ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġview Ġ= ĠLayoutInflater . from ( parent . context ). inflate ( R . layout . item _ character , Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn ĠCharacter ViewHolder ( view ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcharacters . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠCharacter ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind Items ( characters . get ( position )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠCharacter ViewHolder ( item View : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( item View ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġbind Items ( character Ġ: ĠCharacter ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . tv _ character _ name . text Ġ= Ġcharacter . name ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . tv _ character _ gender . text Ġ= Ġcharacter . gender ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . tv _ character _ hair . text Ġ= Ġcharacter . hair _ color ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }