package Ġcom . f riday tech . dex . presentation . transactions . recycler Ċ Ċ import Ġandroid . view . View Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . f riday tech . dex . R Ċ import Ġcom . f riday tech . dex . presentation . transactions . model . Transaction View Item Ċ import Ġcom . f riday tech . dex . utils . Time Utils Ċ import Ġcom . f riday tech . dex . utils . setTextColor Res Ċ import Ġcom . f riday tech . dex . utils . ui . to Display Format Ċ import Ġcom . f riday tech . dex . utils . ui . to Fi at Display Format Ċ import Ġjava . math . BigDecimal Ċ import Ġkotlinx . android . extensions . Layout Container Ċ import Ġkotlinx . android . synt hetic . main . item _ transaction .* Ċ Ċ class ĠTransaction ViewHolder ( ĊĠĠĠ Ġoverride Ġval Ġcontainer View : ĠView , ĊĠĠĠ Ġprivate Ġval Ġlistener : ĠOn ClickListener Ċ ) Ġ: ĠRecyclerView . ViewHolder ( container View ), ĠLayout Container Ġ{ ĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠitemView . setOnClickListener Ġ{ Ġlistener . onClick ( adapter Position ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġon Bind ( transaction : ĠTransaction View Item ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġis Positive Ġ= Ġtransaction . coin Value Ġ> ĠBigDecimal . ZERO ĊĊĠĠĠĠĠĠĠ Ġtransaction _ amount ?. text Ġ= Ġ"${ if Ġ( is Positive ) Ġ" +" Ġelse Ġ"- "} ${ transaction . coin Value . abs (). to Display Format ()} Ġ${ transaction . coin . code }" ĊĠĠĠĠĠĠĠ Ġtransaction _ amount ?. setTextColor Res ( if Ġ( is Positive ) ĠR . color . green Ġelse ĠR . color . red ) ĊĊĠĠĠĠĠĠĠ Ġtransaction _ fi at _ amount ?. text Ġ= Ġ"$ ${ transaction . fi at Value ?. abs ()?. to Fi at Display Format () }" ĊĠĠĠĠĠĠĠ Ġtransaction _ type _ icon ?. setImage Resource ( if Ġ( is Positive ) ĠR . drawable . ic _ received Ġelse ĠR . drawable . ic _ sent ) ĊĊĠĠĠĠĠĠĠ Ġtransaction . date ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransaction _ date ?. text Ġ= ĠTime Utils . date To Short ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransaction _ time ?. text Ġ= ĠTime Utils . date To Hour ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinterface ĠOn ClickListener Ġ{ ĊĠĠĠĠĠĠĠ Ġfun ĠonClick ( position : ĠInt ) ĊĠĠĠ Ġ} Ċ } Ċ