/* Ċ Ġ* ĠCopyright Ġ 2 0 1 8 ĠK eval ĠP ate l . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 . Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġcom . ke val p ate l 2 1 0 6 . ci . green build . ci Selector Ċ Ċ import Ġandroid . arch . lifecycle . Observer Ċ import Ġandroid . arch . lifecycle . ViewModel Provider Ċ import Ġandroid . arch . lifecycle . ViewModel Providers Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . v 7 . app . AppCompatActivity Ċ import Ġandroid . support . v 7 . widget . Default Item Animator Ċ import Ġandroid . support . v 7 . widget . Linear LayoutManager Ċ import Ġandroid . view . MenuItem Ċ import Ġcom . ke val p ate l 2 1 0 6 . ci . green build . R Ċ import Ġcom . ke val p ate l 2 1 0 6 . ci . green build . base . application . Base Application Ċ import Ġcom . ke val p ate l 2 1 0 6 . ci . green build . base . view . Divider Item Decoration Ċ import Ġcom . ke val p ate l 2 1 0 6 . ci . green build . di . D agger Di Component Ċ import Ġkotlinx . android . synt hetic . main . activity _ c iselect or _ activ ty .* Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠCi Selector Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġinternal Ġlateinit Ġvar ĠviewModel Factory : ĠViewModel Provider . Factory ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġmodel : ĠCi Selector ViewModel ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ c iselect or _ activ ty ) ĊĊĠĠĠĠĠĠĠ Ġsupport ActionBar ?. set Display Home As Up Enabled ( true ) ĊĠĠĠĠĠĠĠ Ġsupport ActionBar ?. set Display Show Home Enabled ( true ) ĊĠĠĠĠĠĠĠ Ġsupport ActionBar ?. title Ġ= ĠgetString ( R . string . title _ activity _ ci _ selector ) ĊĊĠĠĠĠĠĠĠ ĠD agger Di Component . builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. application Component ( Base Application . get ( this ). getApplication Component ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. inject ( this @ Ci Selector Activity ) ĊĊĠĠĠĠĠĠĠ Ġmodel Ġ= ĠViewModel Providers . of ( this , ĠviewModel Factory ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. get ( Ci Selector ViewModel :: class . java ) ĊĠĠĠĠĠĠĠ Ġmodel . load Ci Server List ( this @ Ci Selector Activity ) ĊĊĠĠĠĠĠĠĠ Ġci _ selector _ list . layout Manager Ġ= ĠLinearLayoutManager ( this @ Ci Selector Activity ) ĊĠĠĠĠĠĠĠ Ġci _ selector _ list . item Animator Ġ= ĠDefault Item Animator () ĊĠĠĠĠĠĠĠ Ġci _ selector _ list . addItem Decoration ( Divider Item Decoration ( this @ Ci Selector Activity )) ĊĠĠĠĠĠĠĠ Ġci _ selector _ list . adapter Ġ= ĠCi Selector Adapter ( this , Ġmodel . ci Servers . value !! ) ĊĊĠĠĠĠĠĠĠ Ġmodel . ci Servers . observe ( this @ Ci Selector Activity , ĠObserver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( ci _ selector _ list . adapter Ġas ĠCi Selector Adapter ). notify DataSet Changed () ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Options ItemSelected ( item : ĠMenuItem ?): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġsupport Finish After Transition () ĊĠĠĠĠĠĠĠ Ġreturn Ġsuper . on Options ItemSelected ( item ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠĠĠĠĠ Ġinternal Ġfun Ġlaunch ( context : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . startActivity ( Intent ( context , ĠCi Selector Activity :: class . java )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ