package Ġcom . is mail hak ki ay din . foot ball . ui . team . team _ detail . player Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . Adapter View Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . is mail hak ki ay din . foot ball . R Ċ import Ġcom . is mail hak ki ay din . foot ball . databinding . Item Player Binding Ċ import Ġcom . is mail hak ki ay din . foot ball . model . player . Player Ċ Ċ class ĠPlayer Adapter ( val Ġplayer List : ĠList < Player >, Ġval Ġon Item Click : Ġ( Player )-> Unit ): RecyclerView . Adapter < Player Adapter . Player ViewHolder >() Ġ{ ĊĠĠĠ Ġclass ĠPlayer ViewHolder ( var Ġview : ĠItem Player Binding ): RecyclerView . ViewHolder ( view . root ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġbind ( player Ġ: ĠPlayer , Ġon Item Click : Ġ( Player ) Ġ-> ĠUnit ){ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠitemView . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġon Item Click ( player ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠPlayer ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinf late Ġ= ĠLayoutInflater . from ( parent . context ) ĊĠĠĠĠĠĠĠ Ġval Ġview Ġ= ĠData Binding Util . inflate < Item Player Binding >( inflate , ĠR . layout . item _ player , Ġparent , false ) ĊĠĠĠĠĠĠĠ Ġreturn ĠPlayer ViewHolder ( view ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ= player List . size ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠPlayer ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . view . player Ġ= Ġplayer List [ position ] ĊĠĠĠĠĠĠĠ Ġholder . bind ( player List [ position ], on Item Click ) ĊĠĠĠ Ġ} Ċ }