package Ġcom . div ij . credit tracker . adapter Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . div ij . credit tracker . R Ċ import Ġcom . div ij . credit tracker . databinding . Card Main Binding Ċ import Ġcom . div ij . credit tracker . model . Transaction Ċ import Ġcom . div ij . credit tracker . util . Utils Ċ Ċ class ĠTransactions Adapter () Ġ: ĊĠĠĠ ĠRecyclerView . Adapter < Transaction ViewHolder >() Ġ{ ĊĠĠĠ Ġprivate Ġval Ġtransactions List Ġ= ĠArrayList < Transaction >(); ĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠTransaction ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlayout Inflater Ġ= ĠLayoutInflater . from ( parent . context ) ĊĠĠĠĠĠĠĠ Ġval Ġbinding : ĠCard Main Binding Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠData Binding Util . inflate ( layout Inflater , ĠR . layout . card _ main , Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn ĠTransaction ViewHolder ( binding ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠTransaction ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . bind ( transactions List [ position ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset List ( transactions : ĠArrayList < Transaction >) Ġ{ ĊĠĠĠĠĠĠĠ Ġtransactions List . clear () ĊĠĠĠĠĠĠĠ Ġtransactions List . addAll ( transactions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count () Ġ= Ġtransactions List . size Ċ } Ċ Ċ class ĠTransaction ViewHolder ( private Ġval Ġbinding : ĠCard Main Binding ) Ġ: ĊĠĠĠ ĠRecyclerView . ViewHolder ( binding . root ) Ġ{ ĊĠĠĠ Ġfun Ġbind ( transaction : ĠTransaction ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . tv Date . text Ġ= ĠUtils . date For Transaction ( transaction . time ) ĊĠĠĠĠĠĠĠ Ġbinding . tv Desc . text Ġ= Ġtransaction . description ĊĠĠĠĠĠĠĠ Ġbinding . tv Amount . text Ġ= Ġ" âĤ ¹ " Ġ+ Ġtransaction . amount . toString () ĊĠĠĠ Ġ} Ċ Ċ }