package Ġcom . do ili om ats in he . dc characters . adapter ĊĊ Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . paging . Paging Data Adapter Ċ import Ġandroidx . recyclerview . widget . Diff Util Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . do ili om ats in he . dc characters . model . Character Ċ Ċ class ĠCharacter Adapter Ġ( private Ġval Ġclick Listener : ĠCharacter ClickListener ) Ġ: ĊĠĠĠ ĠP aging Data Adapter < Character , ĠRecyclerView . ViewHolder >( Character Diff Util Callback ()) Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠRecyclerView . ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠĠ Ġ( holder Ġas ĠCharacter ViewHolder ). bind ( getItem ( position ), Ġclick Listener ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠRecyclerView . ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠCharacter ViewHolder . from ( parent ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ class ĠCharacter Diff Util Callback Ġ: ĠDiff Util . Item Callback < Character >() Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġare Items The Same ( old Item : ĠCharacter , Ġnew Item : ĠCharacter ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġold Item . id Ġ== Ġnew Item . id ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġare Contents The Same ( old Item : ĠCharacter , Ġnew Item : ĠCharacter ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġold Item Ġ== Ġnew Item ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠCharacter ClickListener Ġ( val Ġclick Listener : Ġ( character : ĠCharacter ) Ġ-> ĠUnit ) Ġ{ ĊĠĠĠ Ġfun ĠonClick ( character : ĠCharacter ) Ġ= Ġclick Listener ( character ) Ċ }