package Ġcom . li vin . android . book store Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . ImageView Ċ import Ġandroid . widget . TextView Ċ import Ġcom . squareup . pic asso . Pic asso Ċ Ċ /* Ċ Ġ* ĠCreated Ġby ĠLiv in ĠMat he w Ġ< li vin @ ac ou st ike . com > Ġon Ġ 1 8 / 1 0 / 1 7 . Ċ Ġ*/ Ċ Ċ class ĠBooks Array Adapter ( private Ġvar Ġcontext : ĠContext , Ġprivate Ġval Ġbooks : ĠArrayList < Book >): ĠRecyclerView . Adapter < Books Array Adapter . ViewHolder > (){ ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠViewHolder ?, Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ ĠPic asso . with ( context ). load ( books [ position ]. cover ). into ( holder !!. cover ImageView ) ĊĠĠĠĠĠĠĠ Ġholder . title TextView . text Ġ= Ġbooks [ position ]. title ĊĠĠĠĠĠĠĠ Ġholder . author TextView . text Ġ= Ġbooks [ position ]. author ĊĠĠĠĠĠĠĠ Ġholder . year TextView . text Ġ= Ġbooks [ position ]. published Year . toString () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup ?, Ġview Type : ĠInt ): ĠViewHolder ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlayout Inflater : ĠLayoutInflater Ġ= Ġcontext . getSystem Service ( Context . LAYOUT _ IN FL ATER _ SERVICE ) Ġas ĠLayoutInflater ĊĠĠĠĠĠĠĠ Ġreturn ĠViewHolder ( layout Inflater . inflate ( R . layout . list _ item , Ġparent , Ġfalse )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ= Ġbooks . size ĊĊĠĠĠ Ġclass ĠViewHolder ( item View : ĠView ?) Ġ: ĠRecyclerView . ViewHolder ( item View ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcover ImageView Ġ= ĠitemView !!. findViewById < ImageView >( R . id . book Cover ) !! ĊĠĠĠĠĠĠĠ Ġval Ġtitle TextView Ġ= ĠitemView !!. findViewById < TextView >( R . id . title TextView ) !! ĊĠĠĠĠĠĠĠ Ġval Ġauthor TextView Ġ= ĠitemView !!. findViewById < TextView >( R . id . author TextView ) !! ĊĠĠĠĠĠĠĠ Ġval Ġyear TextView Ġ= ĠitemView !!. findViewById < TextView >( R . id . year TextView ) !! ĊĊĠĠĠ Ġ} Ċ }