package Ġcom . e zi ke . to ben na . star w ars search . character _ detail . ui . adapter Ċ Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . Diff Util Ċ import Ġandroidx . recyclerview . widget . ListAdapter Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . e zi ke . to ben na . star w ars search . character _ detail . R Ċ import Ġcom . e zi ke . to ben na . star w ars search . character _ detail . databinding . Item Film Binding Ċ import Ġcom . e zi ke . to ben na . star w ars search . character _ search . model . Film Model Ċ import Ġcom . e zi ke . to ben na . star w ars search . core . ext . inflate Ċ Ċ class ĠFil m Adapter Ġ: ĠList Adapter < Film Model , ĠFil m Adapter . Film ViewHolder >( diff Util Callback ) Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠFil m ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠFil m ViewHolder ( Item Film Binding . bind ( parent . inflate ( R . layout . item _ film ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠFil m ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( getItem ( position )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠFil m ViewHolder ( private Ġval Ġbinding : ĠItem Film Binding ) Ġ: ĊĠĠĠĠĠĠĠ ĠRecyclerView . ViewHolder ( binding . root ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġbind ( film Model : ĠFil m Model ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . film Title . text Ġ= Ġfilm Model . title ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . film Opening C rawl . text Ġ= Ġfilm Model . opening C rawl ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdiff Util Callback : ĠDiff Util . Item Callback < Film Model > ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget () Ġ= Ġobject Ġ: ĠDiff Util . Item Callback < Film Model >() Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġare Items The Same ( old Item : ĠFil m Model , Ġnew Item : ĠFil m Model ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġold Item . title Ġ== Ġnew Item . title ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġare Contents The Same ( old Item : ĠFil m Model , Ġnew Item : ĠFil m Model ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġold Item Ġ== Ġnew Item ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ