package Ġ rio . ar j . k ump aran tech test rio ar j una . ui . detail Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . annotation . Color Res Ċ import Ġandroidx . core . content . Context Compat Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġ rio . ar j . k ump aran tech test rio ar j una . BR Ċ import Ġ rio . ar j . k ump aran tech test rio ar j una . R Ċ import Ġ rio . ar j . k ump aran tech test rio ar j una . data . repository . comment . model . Comment Response Ċ import Ġ rio . ar j . k ump aran tech test rio ar j una . data . repository . comment . model . Comment Response Item Ċ import Ġ rio . ar j . k ump aran tech test rio ar j una . databinding . Item Comment Binding Ċ Ċ class ĠDetail Comment Adapter ( ĊĠ Ġprivate Ġval Ġcomment List : ĠComment Response Ċ ) Ġ: ĠRecyclerView . Adapter < Detail Comment Adapter . ViewHolder >() Ġ{ ĊĊĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠViewHolder Ġ{ ĊĠĠĠ Ġval Ġinflater Ġ= ĠLayoutInflater . from ( parent . context ) ĊĠĠĠ Ġval Ġview Data Binding Ġ= ĠItem Comment Binding . inflate ( in flater , Ġparent , Ġfalse ) ĊĠĠĠ Ġreturn ĠViewHolder ( view Data Binding ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠ Ġreturn Ġcomment List . size ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠ Ġholder . bind ( comment List [ position ]) ĊĠ Ġ} ĊĊĠ Ġclass ĠViewHolder ( private Ġval Ġbinding : ĠItem Comment Binding ) Ġ: ĊĠĠĠ ĠRecyclerView . ViewHolder ( binding . root ) Ġ{ ĊĠĠĠ Ġfun Ġbind ( model : ĠComment Response Item ) Ġ{ ĊĠĠĠĠĠ Ġbinding . set Variable ( BR . comment Model , Ġmodel ) ĊĠĠĠĠĠ Ġbinding . execute Pending Bindings () ĊĊĠĠĠĠĠ Ġif Ġ( adapter Position Ġ% Ġ 2 Ġ== Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġset BackgroundColor ( R . color . gray _ E DE DED ) ĊĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġset BackgroundColor ( R . color . white ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġset BackgroundColor (@ Color Res Ġcolor : ĠInt ) Ġ= ĊĠĠĠĠĠ Ġbinding . container Comment . set BackgroundColor ( ĊĠĠĠĠĠĠĠ ĠContext Compat . getColor ( binding . root . context , Ġcolor ) ĊĠĠĠĠĠ Ġ) ĊĠ Ġ} Ċ Ċ }