package Ġcom . project se oul . stock market test . adapters Ċ Ċ import Ġandroidx . databinding . Binding Adapter Ċ import Ġcom . google . android . material . text view . Material TextView Ċ import Ġcom . project se oul . stock market test . R Ċ import Ġcom . project se oul . stock market test . models . E Unit Ċ import Ġjava . text . NumberFormat Ċ import Ġjava . util .* Ċ Ċ /** Ċ Ġ* ĠCreated Ġby ĠK ING ĠJ IN HO Ġon Ġ 9 / 1 8 / 2 0 2 1 Ċ Ġ*/ Ċ @ Binding Adapter (" diff ") Ċ fun Ġdiff ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġval ĠnewValue Ġ= Ġif Ġ(! value . contains ("- ")) Ġ"+ $ value " Ġelse Ġvalue ĊĠĠĠ Ġview . text Ġ= ĠnewValue ĊĠĠĠ Ġset TextColor ( view , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" diff Ratio ") Ċ fun Ġdiff In Ratio ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġval ĠnewValue Ġ= Ġif Ġ(! value . contains ("- ")) Ġ"+ $ value %" Ġelse Ġ"$ value %" ĊĠĠĠ Ġview . text Ġ= ĠnewValue ĊĠĠĠ Ġset TextColor ( view , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" market Cap ", Ġ" unit ", Ġrequire All Ġ= Ġtrue ) Ċ fun Ġmarket Cap ( view : ĠMaterial TextView , Ġvalue : ĠString , Ġunit : ĠE Unit ) Ġ{ ĊĠĠĠ Ġval Ġnf Ġ= ĠNumber Format . getInstance ( Locale . US ) ĊĠĠĠ Ġval Ġnumber Ġ= Ġnf . parse ( value ) !!. to Long () ĊĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( ĊĠĠĠĠĠĠĠ Ġif Ġ( unit Ġ== ĠE Unit . TH O US AND _ B IL ) ĠR . string . all _ money _ unit _ 1 0 0 0 bil Ġelse ĠR . string . all _ money _ unit _ mil , ĊĠĠĠĠĠĠĠ Ġif Ġ( unit Ġ== ĠE Unit . TH O US AND _ B IL ) Ġnumber Ġ/ Ġunit . value Ġelse Ġvalue ĊĠĠĠ Ġ) Ċ } Ċ Ċ @ Binding Adapter (" weight ") Ċ fun Ġweight ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ weight , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" shares Own ") Ċ fun Ġshares Own ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ shares _ own , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" volume ") Ċ fun Ġvolume ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ transaction _ in _ volume , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" block Deal Volume ") Ċ fun Ġblock Deal Volume ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ block _ deal _ transaction _ in _ volume , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" total Shares ") Ċ fun Ġtotal Shares ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ total _ shares , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" turn over ") Ċ fun Ġturn over ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ turn over _ ratio , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" amount ") Ċ fun Ġamount ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ transaction _ in _ amount , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" opening ") Ċ fun Ġopening ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ stock _ opening _ price , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" high ") Ċ fun Ġhigh ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ stock _ high _ price , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" low ") Ċ fun Ġlow ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ stock _ low _ price , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" year High ") Ċ fun Ġyear High ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ stock _ year _ high _ price , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" year Low ") Ċ fun Ġyear Low ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ stock _ year _ low _ price , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" foreign er Ratio ") Ċ fun Ġforeign er Ratio ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . all _ stock _ foreign er _ ratio , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" trade Sur plus ") Ċ fun Ġtrade Sur plus ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . monthly _ trading _ sur plus , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" export Volume ") Ċ fun Ġexport Volume ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . monthly _ trading _ export _ volume , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" export Amount ") Ċ fun Ġexport Amount ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . monthly _ trading _ export _ amount , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" import Volume ") Ċ fun Ġimport Volume ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . monthly _ trading _ import _ volume , Ġvalue ) Ċ } Ċ Ċ @ Binding Adapter (" import Amount ") Ċ fun Ġimport Amount ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . text Ġ= Ġview . context . getString ( R . string . monthly _ trading _ import _ amount , Ġvalue ) Ċ } ĊĊ Ċ fun Ġset TextColor ( view : ĠMaterial TextView , Ġvalue : ĠString ) Ġ{ ĊĠĠĠ Ġview . setTextColor ( ĊĠĠĠĠĠĠĠ Ġview . context . getColor ( if Ġ( value . contains ("- ")) ĠR . color . de creasing Ġelse ĠR . color . in creasing ) ĊĠĠĠ Ġ) Ċ }