package Ġcom . playground . redux . pages . user page Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . databinding . Data Binding Util Ċ import Ġandroid . os . Bundle Ċ import Ġcom . pe tn agy . k ored ux . Store Ċ import Ġcom . pe tn agy . k ored ux . Store Subscriber Ċ import Ġcom . playground . redux . BR Ċ import Ġcom . playground . redux . R Ċ import Ġcom . playground . redux . databinding . Activity Main Binding Ċ import Ġcom . playground . redux . navigation . Page Ċ import Ġcom . playground . redux . pages . user page . view model . User ViewModel Ċ import Ġcom . playground . redux . redux . actions . Load Previous Search Action Ċ import Ġcom . playground . redux . redux . app state . AppState Ċ import Ġdagger . android . support . D agger AppCompatActivity Ċ import Ġjavax . inject . Inject ĊĊ Ċ class ĠMainActivity Ġ: ĠD agger AppCompatActivity (), ĠStore Subscriber < AppState > Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġstore : ĠStore < AppState > ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel : ĠUser ViewModel ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġval Ġbinding : ĠActivity Main Binding Ġ= ĠData Binding Util . set ContentView ( this , ĠR . layout . activity _ main ) ĊĠĠĠĠĠĠĠ Ġbinding . set Variable ( BR . viewModel , ĠviewModel ) ĊĠĠĠĠĠĠĠ Ġbinding . execute Pending Bindings () ĊĠĠĠĠĠĠĠ Ġbinding . set Lifecycle Owner ( this ) ĊĠĠĠĠĠĠĠ Ġlifecycle . add Observer ( viewModel ) ĊĠĠĠĠĠĠĠ Ġstore . dispatch ( Load Previous Search Action ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonStart () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onStart () ĊĠĠĠĠĠĠĠ Ġstore . subscribe ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Stop () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Stop () ĊĠĠĠĠĠĠĠ Ġstore . unsubscribe ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠnewState ( state : ĠApp State ) Ġ{ ĊĠĠĠĠĠĠĠ Ġstate . page State . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( this . actual Page Ġ!= ĠPage . USER _ SELECT _ PAGE ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( this @ MainActivity , Ġthis . actual Page . clazz . java )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstore . unsubscribe ( this @ MainActivity ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Stop () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ