/* Ċ Ġ* ĠMIT ĠLicense Ċ Ġ* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 2 0 ĠG i org os ĠNe ok le ous Ċ Ġ* Ċ Ġ* ĠPermission Ġis Ġhereby Ġgranted , Ġfree Ġof Ġcharge , Ġto Ġany Ġperson Ġobtaining Ġa Ġcopy Ċ Ġ* Ġof Ġthis Ġsoftware Ġand Ġassociated Ġdocumentation Ġfiles Ġ( the Ġ" Software "), Ġto Ġdeal Ċ Ġ* Ġin Ġthe ĠSoftware Ġwithout Ġrestriction , Ġincluding Ġwithout Ġlimitation Ġthe Ġrights Ċ Ġ* Ġto Ġuse , Ġcopy , Ġmodify , Ġmerge , Ġpublish , Ġdistribute , Ġsublicense , Ġand / or Ġsell Ċ Ġ* Ġcopies Ġof Ġthe ĠSoftware , Ġand Ġto Ġpermit Ġpersons Ġto Ġwhom Ġthe ĠSoftware Ġis Ċ Ġ* Ġfurnished Ġto Ġdo Ġso , Ġsubject Ġto Ġthe Ġfollowing Ġconditions : Ċ Ġ* Ċ Ġ* ĠThe Ġabove Ġcopyright Ġnotice Ġand Ġthis Ġpermission Ġnotice Ġshall Ġbe Ġincluded Ġin Ġall Ċ Ġ* Ġcopies Ġor Ġsubstantial Ġportions Ġof Ġthe ĠSoftware . Ċ Ġ* Ċ Ġ* ĠTHE ĠSOFTWARE ĠIS ĠPROVIDED Ġ" AS ĠIS ", ĠWITHOUT ĠWARRANTY ĠOF ĠANY ĠKIND , ĠEXPRESS ĠOR Ċ Ġ* ĠIMPLIED , ĠINCLUDING ĠBUT ĠNOT ĠLIMITED ĠTO ĠTHE ĠWARRANTIES ĠOF ĠMERCHANTABILITY , Ċ Ġ* ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠAND ĠNONINFRINGEMENT . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE Ċ Ġ* ĠAUTHORS ĠOR ĠCOPYRIGHT ĠHOLDERS ĠBE ĠLIABLE ĠFOR ĠANY ĠCLAIM , ĠDAMAGES ĠOR ĠOTHER Ċ Ġ* ĠLIABILITY , ĠWHETHER ĠIN ĠAN ĠACTION ĠOF ĠCONTRACT , ĠTORT ĠOR ĠOTHERWISE , ĠARISING ĠFROM , Ċ Ġ* ĠOUT ĠOF ĠOR ĠIN ĠCONNECTION ĠWITH ĠTHE ĠSOFTWARE ĠOR ĠTHE ĠUSE ĠOR ĠOTHER ĠDEALINGS ĠIN ĠTHE Ċ Ġ* ĠSOFTWARE . Ċ Ġ*/ Ċ Ċ package Ġcom . gi org os ne ok le ous . fullscreen intent example Ċ Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroid . os . Bundle Ċ Ċ import Ġorg . jetbrains . ank o . do Async Ċ import Ġorg . jetbrains . ank o . toast Ċ import Ġorg . jetbrains . ank o . ui Thread Ċ import Ġorg . json . JSONObject Ċ import Ġjava . net . URL ĊĊ Ċ import Ġandroid . util . Log Ċ import Ġandroid . widget . TextView Ċ import Ġkotlinx . android . synt hetic . main . activity _ full _ screen .* Ċ import Ġkotlinx . android . synt hetic . main . activity _ main .* Ċ import Ġme . re lex . circle indicator . Circle Indicator 3 Ċ import Ġorg . json . JSONArray ĊĊ Ċ class ĠFull Screen Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĠĠĠ Ġvar Ġteam 1 List = Ġmutable ListOf < String >(" Af gh an istan " Ġ Ġ, Ġ" A ustralia " Ġ Ġ, Ġ" Can ada " Ġ, Ġ" In dia " Ġ, Ġ" H ong ĠK ong ") ĊĠĠĠ Ġvar Ġteam 2 List = Ġmutable ListOf < String >(" P ak istan " Ġ, Ġ" South ĠA frica " Ġ, Ġ" S ri ĠL ank a " Ġ, Ġ" Engl and " Ġ, Ġ" New ĠZe al and ") ĊĠĠĠ Ġvar ĠB at ting Team Ġ= Ġmutable ListOf < String >(" P ak istan " Ġ, Ġ" South ĠA frica Ġ", Ġ" Can ada " Ġ, Ġ" In dia " Ġ, Ġ" New ĠZe el and ") ĊĠĠĠ Ġvar ĠB ol ling Team Ġ= Ġmutable ListOf < String >(" Af gh an istan "," A ustralia " Ġ," S ri ĠL ank a " Ġ," Engl and ", Ġ" H ong ĠK ong " Ġ) ĊĠĠĠ Ġvar Ġimages 1 List = Ġmutable ListOf < String >(" https :// api . api - cr icket . com / logo / 7 8 _ af gh an istan . png "," https :// api . api - cr icket . com / logo / 5 _ au str alia . png "," https :// api . api - cr icket . com / logo / 2 5 0 _ can ada . png ", Ġ" https :// api . api - cr icket . com / logo / 3 0 _ ind ia . png " Ġ," https :// api . api - cr icket . com / logo / 2 3 2 _ h ong - k ong . png ") ĊĠĠĠ Ġvar Ġimages 2 List Ġ= Ġmutable ListOf < String >(" https :// api . api - cr icket . com / logo / 1 0 _ pak istan . png "," https :// api . api - cr icket . com / logo / 9 _ south - af ric a . png " Ġ, Ġ" https :// api . api - cr icket . com / logo / 6 _ s ri - l ank a . png "," https :// api . api - cr icket . com / logo / 3 4 _ eng land . png "," https :// api . api - cr icket . com / logo / 2 9 _ new - ze al and . png ") ĊĠĠĠ Ġvar Ġmy data Ġ= JSONArray () ĊĠĠĠ Ġvar Ġtimes Ġ= Ġmutable ListOf < String >(" 1 3 : 4 5 "," 1 2 : 0 0 " Ġ, Ġ" 9 : 5 "," 2 : 0 0 " Ġ," 7 : 3 5 ") ĊĠĠĠ Ġvar Ġstatus = Ġmutable ListOf < String >(" 2 9 . 3 : ĠSan deep ĠL am ich h ane Ġto ĠJ ask aran ĠM alho tra , Ġ 2 Ġruns , Ġplayed Ġtowards Ġthird Ġman ." Ġ, Ġ" 2 8 . 2 : ĠS ush an ĠB h ari Ġto ĠJ ask aran ĠM alho tra , ĠNo Ġrun , Ġplayed Ġtowards Ġfine Ġleg ." Ġ," 2 7 . 3 : ĠSan deep ĠL am ich h ane Ġto ĠJ ask aran ĠM alho tra , Ġ 1 Ġrun , Ġplayed Ġtowards Ġpoint ." Ġ," 2 6 . 5 : ĠS omp al ĠK ami Ġto ĠJ ask aran ĠM alho tra , Ġ 1 Ġrun , Ġplayed Ġtowards Ġcovers ." Ġ," 2 6 . 1 : ĠS omp al ĠK ami Ġto ĠMon ank ĠP ate l , ĠNo Ġrun , Ġplayed Ġtowards Ġmid Ġoff .") ĊĠĠĠ Ġvar Ġscore 1 Ġ Ġ= Ġmutable ListOf < String >(" 1 7 5 / 4 ", Ġ" 1 3 6 " Ġ, Ġ" 1 7 7 / 4 " Ġ, Ġ" 1 9 1 / 5 " Ġ," 1 2 0 ") ĊĠĠĠ Ġvar Ġscore 2 Ġ Ġ= Ġmutable ListOf < String >(" 1 4 1 ", Ġ" 1 8 0 / 5 " Ġ, Ġ" 1 1 0 " Ġ, Ġ" 9 8 / 2 " Ġ," 9 2 ") ĊĠĠĠ Ġvar Ġrun rate = Ġmutable ListOf < String >(" 1 4 . 9 " Ġ," None " Ġ, Ġ" None " Ġ," 8 . 9 " Ġ, Ġ" None ") ĊĠĠĠ Ġvar Ġreq run rate = Ġmutable ListOf < String >(" 0 . 3 " Ġ," None " Ġ, Ġ" None " Ġ," None " Ġ, Ġ" None ") ĊĠĠĠ Ġvar ĠT score 1 Ġ= Ġmutable ListOf < String >(" 3 5 0 / 1 Ġ( 6 5 . 4 ) "," 2 2 0 / 5 Ġ"," 2 7 8 / 7 Ġ( 2 3 . 2 ) "," 2 1 3 / 1 Ġ( 6 5 . 4 ) "," 1 0 2 / 4 Ġ( 3 0 . 9 )") ĊĠĠĠ Ġvar ĠT score 2 Ġ= Ġmutable ListOf < String >(" 7 1 0 / 2 Ġ"," 2 6 8 / 1 Ġ( 1 3 . 7 ) Ġ"," 2 7 8 / 7 Ġ"," 1 8 5 / 8 Ġ( 2 0 5 . 4 ) "," 4 5 ") ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ full _ screen ) ĊĠĠĠĠĠĠĠ Ġturn Screen On And Key guard Off () ĊĊĠĠĠĠĠĠĠ Ġdo Async Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRun Request () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġui Thread Ġ{ Ġtoast (" Request ĠPer formed ") Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġpost ToList () ĊĊĊĊĠĠĠĠĠĠĠ Ġview _ pager 2 . adapter Ġ= ĠAdapter ( team 1 List , Ġteam 2 List Ġ, Ġimages 1 List Ġ, Ġimages 2 List Ġ, Ġtimes Ġ, ĠB ol ling Team Ġ, ĠB at ting Team Ġ, Ġstatus Ġ, Ġscore 1 Ġ, Ġscore 2 Ġ, Ġrun rate Ġ, Ġreq run rate Ġ, ĠT score 1 Ġ, ĠT score 2 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġindicator : ĠCircle Indicator 3 Ġ= ĠfindViewById < Circle Indicator 3 >( R . id . indicator ) ĊĊĠĠĠĠĠĠĠ Ġindicator . set ViewPager ( view _ pager 2 ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġfun ĠRun Request () ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcity Name : String Ġ= Ġ" Del hi " ĊĠĠĠĠĠĠĠ Ġ// Add Ġyour Ġpreferred Ġlocation Ġand ĠAPI Ġkey Ġobtained Ġfrom ĠOpen Weather Map . org ĊĠĠĠĠĠĠĠ Ġval Ġurl Ġ= Ġ" https :// api . open weather map . org / data / 2 . 5 / weather ? q = del hi , in & units = metric & appid = 2 8 2 e 3 7 2 8 fc 3 bce de 6 0 ff 4 bf 2 4 1 9 0 3 3 5 3 " ĊĠĠĠĠĠĠĠ Ġval Ġresult Json Ġ= ĠURL ( url ). read Text () ĊĠĠĠĠĠĠĠ Ġprintln ( result Json ) ĊĠĠĠĠĠĠĠ ĠLog . d (" Weather ĠReport ", result Json ) ĊĊĠĠĠĠĠĠĠ Ġval Ġjson Obj Ġ= ĠJSONObject ( result Json ) ĊĠĠĠĠĠĠĠ Ġval Ġmain Ġ= Ġjson Obj . getJSONObject (" main ") ĊĠĠĠĠĠĠĠ Ġval Ġtemp Ġ= Ġmain . getString (" temp ") +" Â° C " ĊĠĠĠĠĠĠĠ Ġval Ġmin max Temp Ġ= Ġmain . getString (" temp _ min ") +" Â° C /"+ main . getString (" temp _ max ") +" Â° C " ĊĠĠĠĠĠĠĠ Ġval Ġcity Name Text Ġ= ĠfindViewById < TextView >( R . id . textView 2 ) Ġas ĠTextView ĊĠĠĠĠĠĠĠ Ġval Ġtemp Text Ġ= ĠfindViewById < TextView >( R . id . textView ) Ġas ĠTextView ĊĠĠĠĠĠĠĠ Ġval Ġmin max Temp Text Ġ= ĠfindViewById < TextView >( R . id . textView 3 ) Ġas ĠTextView ĊĠĠĠĠĠĠĠ Ġcity Name Text . text Ġ= Ġcity Name ĊĠĠĠĠĠĠĠ Ġtemp Text . text Ġ= Ġtemp ĊĠĠĠĠĠĠĠ Ġmin max Temp Text . text Ġ= Ġmin max Temp ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy () ĊĠĠĠĠĠĠĠ Ġturn Screen Off And Key guard On () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġadd ToList ( team 1 : ĠString , Ġteam 2 : ĠString Ġ, Ġimage 1 Ġ: ĠString Ġ, Ġ Ġimage 2 Ġ: ĠString Ġ, Ġtime Ġ: ĠString Ġ, ĠB ol ling Ġ: ĠString Ġ, ĠB at ting Ġ: String Ġ, Ġstat u Ġ: ĠString Ġ Ġ, Ġteams core 1 Ġ: ĠString Ġ, Ġteams core 2 Ġ: ĠString Ġ, Ġmatch run rate Ġ: ĠString Ġ, Ġmatch req run rate Ġ: ĠString Ġ, Ġt score 1 Ġ: String Ġ, Ġt score 2 Ġ: String ){ ĊĠĠĠĠĠĠĠ Ġteam 1 List . add ( team 1 ) ĊĠĠĠĠĠĠĠ Ġteam 2 List . add ( team 2 ) ĊĠĠĠĠĠĠĠ Ġimages 1 List . add ( image 1 ) ĊĠĠĠĠĠĠĠ Ġimages 2 List . add ( image 2 ) ĊĠĠĠĠĠĠĠ Ġtimes . add ( time ) ĊĠĠĠĠĠĠĠ ĠB ol ling Team . add ( B ol ling ) ĊĠĠĠĠĠĠĠ ĠB at ting Team . add ( B at ting ) ĊĠĠĠĠĠĠĠ Ġstatus . add ( stat u ) ĊĠĠĠĠĠĠĠ Ġscore 1 . add ( teams core 1 ) ĊĠĠĠĠĠĠĠ Ġscore 2 . add ( teams core 2 ) ĊĠĠĠĠĠĠĠ Ġrun rate . add ( match run rate ) ĊĠĠĠĠĠĠĠ Ġreq run rate . add ( match req run rate ) ĊĠĠĠĠĠĠĠ ĠT score 2 . add ( ts core 2 ) ĊĠĠĠĠĠĠĠ ĠT score 1 . add ( ts core 1 ) ĊĊĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġfun Ġpost ToList (){ ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( Ġi Ġin Ġ 0 .. - 1 ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd ToList ( team 1 List [ i ] Ġ, team 2 List [ i ], Ġ" hak im ", Ġ" hak im " Ġ, Ġtimes [ i ] Ġ, ĠB ol ling Team [ i ] Ġ, ĠB at ting Team [ i ] Ġ, Ġstatus [ i ] Ġ, Ġscore 1 [ i ] Ġ, Ġscore 2 [ i ] Ġ, Ġrun rate [ i ] Ġ, Ġreq run rate [ i ] Ġ, ĠT score 1 [ i ] Ġ, ĠT score 2 [ i ]) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊ Ċ } Ċ