package Ġcom . binary br icks . co iny . components Ċ Ċ import Ġandroid . animation . Value Animator Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . binary br icks . co iny . R Ċ import Ġcom . binary br icks . co iny . data . database . entities . W atched Coin Ċ import Ġcom . binary br icks . co iny . network . BASE _ CRYPTO COMPARE _ IMAGE _ URL Ċ import Ġcom . binary br icks . co iny . network . models . Coin Price Ċ import Ġcom . binary br icks . co iny . stories . coin details . Coin Details Pager Activity Ċ import Ġcom . binary br icks . co iny . utils . Format ters Ċ import Ġcom . binary br icks . co iny . utils . chart Animation Duration Ċ import Ġcom . binary br icks . co iny . utils . getDefault Exchange Text Ċ import Ġcom . squareup . pic asso . Pic asso Ċ import Ġjp . was ab eef . pic asso . transform ations . Crop Circle Transformation Ċ import Ġjp . was ab eef . pic asso . transform ations . Gray scale Transformation Ċ import Ġkotlinx . android . synt hetic . main . dashboard _ coin _ module . view .* Ċ import Ġjava . util .* Ċ Ċ /** Ċ Ġ* ĠCreated Ġby ĠPr an ay ĠAir an Ċ Ġ*/ Ċ Ċ class ĠDashboard Coin Module ( private Ġval Ġto Currency : ĠString ) Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġpic asso : ĠPic asso ĊĊĠĠĠ Ġprivate Ġval Ġcurrency Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠCurrency . getInstance ( to Currency ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġformatter Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠFormat ters () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġcrop Circle Transformation Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠC rop Circle Transformation () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġgray scale Transformation Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠGray scale Transformation () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinit ( layout Inflater : ĠLayoutInflater , Ġparent : ĠViewGroup ?): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinfl ated View Ġ= Ġlayout Inflater . inflate ( R . layout . dashboard _ coin _ module , Ġparent , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġpic asso Ġ= ĠPic asso . with ( in fl ated View . context ) ĊĠĠĠĠĠĠĠ Ġreturn Ġinfl ated View ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġshow Coin Info ( in fl ated View : ĠView , Ġdashboard Coin Module Data : ĠDashboard Coin Module Data ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġcoin Ġ= Ġdashboard Coin Module Data . w atched Coin . coin ĊĠĠĠĠĠĠĠ Ġval Ġcoin Price Ġ= Ġdashboard Coin Module Data . coin Price ĊĊĠĠĠĠĠĠĠ Ġval ĠimageUrl Ġ= ĠBASE _ CRYPTO COMPARE _ IMAGE _ URL Ġ+ Ġ"${ coin . imageUrl }? width = 6 0 " ĊĊĠĠĠĠĠĠĠ Ġpic asso . load ( imageUrl ). error ( R . mip map . ic _ launcher _ round ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. transform ( crop Circle Transformation ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. transform ( gray scale Transformation ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. into ( in fl ated View . iv Coin ) ĊĊĠĠĠĠĠĠĠ Ġinfl ated View . tv Coin Name . text Ġ= Ġcoin . coin Name ĊĊĠĠĠĠĠĠĠ Ġif Ġ( dashboard Coin Module Data . w atched Coin . purchase d ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġdo Ġa Ġdifferent Ġflow ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . tv Exchange Name . visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . tv Exchange Name . visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . tv Exchange Name . text Ġ= ĠgetDefault Exchange Text ( dashboard Coin Module Data . w atched Coin . exchange , Ġinfl ated View . context ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġif Ġ( coin Price Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . pb Loading . hide () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġanimate Coin Price ( in fl ated View , Ġcoin Price . price ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . tv Coin Pair . text Ġ= Ġ"${ coin Price . from Symbol }/${ coin Price . to Symbol }" ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġadjust Ġcolor Ġlogic Ġhere Ġfor Ġtext ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . coin Card . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . context . startActivity ( Coin Details Pager Activity . build Launch Intent ( in fl ated View . context , Ġdashboard Coin Module Data . w atched Coin )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdata Ġclass ĠDashboard Coin Module Data ( val Ġw atched Coin : ĠW atched Coin , Ġvar Ġcoin Price : ĠCoin Price ?) ĊĊĊĠĠĠ Ġprivate Ġfun Ġanimate Coin Price ( in fl ated View : ĠView , Ġamount : ĠString ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( amount Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchart Coin Price Animation Ġ= ĠValue Animator . of Float ( 0 f , Ġamount . toFloat ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġchart Coin Price Animation . duration Ġ= Ġchart Animation Duration ĊĠĠĠĠĠĠĠĠĠĠĠ Ġchart Coin Price Animation . add Update Listener ({ Ġupdated Animation Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġanimated Value Ġ= Ġupdated Animation . animated Value Ġas ĠFloat ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . tv Coin Price . text Ġ= Ġformatter . format Amount ( animated Value . toString (), Ġcurrency ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinfl ated View . tv Coin Price . tag Ġ= Ġanimated Value ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġchart Coin Price Animation . start () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }