package Ġxyz . ime i . health care . activities Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . v 7 . widget . Linear LayoutManager Ċ import Ġandroid . widget . Toast Ċ import Ġkotlinx . android . synt hetic . main . activity _ main .* Ċ import Ġorg . green robot . event bus . EventBus Ċ import Ġorg . green robot . event bus . Subscribe Ċ import Ġorg . green robot . event bus . Thread Mode Ċ import Ġorg . mm text view . MM Font Utils Ċ import Ġxyz . ime i . health care . R Ċ import Ġxyz . ime i . health care . adapters . Health Care Adapter Ċ import Ġxyz . ime i . health care . data . models . Health Care Model Ċ import Ġxyz . ime i . health care . deleg ates . Health Care Delegate Ċ import Ġxyz . ime i . health care . events . Data Event Ċ import Ġxyz . ime i . health care . events . Error Api Event Ċ import Ġxyz . ime i . health care . utils . HC Info Constants Ċ Ċ class ĠMainActivity Ġ: ĠBase Activity (), ĠHealth Care Delegate Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġadapter : ĠHealth Care Adapter ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ) ĊĠĠĠĠĠĠĠ Ġset Support ActionBar ( toolbar ) ĊĊĠĠĠĠĠĠĠ ĠMM Font Utils . init MM TextView ( this ) ĊĊĠĠĠĠĠĠĠ Ġsupport ActionBar !!. title Ġ= Ġresources . getString ( R . string . app _ name ) ĊĊĠĠĠĠĠĠĠ Ġrv Health Care Info . layout Manager Ġ= ĠLinearLayoutManager ( application Context , ĠLinearLayoutManager . VERTICAL , Ġfalse ) ĊĊĠĠĠĠĠĠĠ Ġadapter Ġ= ĠHealth Care Adapter ( this ) ĊĊĠĠĠĠĠĠĠ Ġrv Health Care Info . adapter Ġ= Ġadapter ĊĊĠĠĠĠĠĠĠ ĠHealth Care Model . getInstance (). get Health Care Infos ( HC Info Constants . ACCESS _ TOKEN ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonClick () Ġ{ ĊĠĠĠĠĠĠĠ ĠToast . makeText ( application Context Ġ, Ġ" Click " Ġ, ĠToast . LENGTH _ SHORT ). show () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonStart () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onStart () ĊĠĠĠĠĠĠĠ Ġif Ġ(! EventBus . getDefault (). is Registered ( this )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠEvent Bus . getDefault (). register ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Stop () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Stop () ĊĠĠĠĠĠĠĠ Ġif Ġ( EventBus . getDefault (). is Registered ( this )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠEvent Bus . getDefault (). unregister ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Subscribe ( thread Mode Ġ= ĠThread Mode . MAIN ) ĊĠĠĠ Ġfun ĠonSuccess Get Info ( success Get Infos : ĠData Event . Success Get Health Care Info ) Ġ{ ĊĠĠĠĠĠĠĠ Ġadapter . setData ( success Get Infos . infos ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Subscribe ( thread Mode Ġ= ĠThread Mode . MAIN ) ĊĠĠĠ Ġfun Ġon Empty Get Info ( empty Get Infos : ĠData Event . Empty Get Health Care Info ) Ġ{ ĊĠĠĠĠĠĠĠ ĠToast . makeText ( application Context , Ġempty Get Infos . message , ĠToast . LENGTH _ SHORT ). show () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Subscribe ( thread Mode Ġ= ĠThread Mode . MAIN ) ĊĠĠĠ Ġfun ĠonError Get Info ( error Get Infos : ĠError Api Event . ApiError Event ) Ġ{ ĊĠĠĠĠĠĠĠ ĠToast . makeText ( application Context , Ġerror Get Infos . getMessage (), ĠToast . LENGTH _ SHORT ). show () ĊĠĠĠ Ġ} Ċ Ċ } Ċ