package Ġcom . my company . myapp . ui . main Ċ Ċ import Ġandroid . databinding . Data Binding Util Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . design . widget . Snackbar Ċ import Ġcom . my company . myapp . R Ċ import Ġcom . my company . myapp . ui . Base Activity Ċ import Ġcom . my company . myapp . ui . main . Main Component . Main Module Ċ import Ġcom . my company . myapp . ui . main . Main Fragment . Main Fragment Host Ċ import Ġcom . my company . myapp . ui . main . Main Presenter . Main View Contract Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠMainActivity Ġ: ĠBase Activity (), ĠMain View Contract , ĠMain Fragment Host Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcomponent : ĠMain Component ĊĠĠĠ Ġ@ Inject Ġlateinit Ġvar Ġpresenter : ĠMain Presenter ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠMainActivity Binding ĊĊĠĠĠ Ġpublic Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġcomponent Ġ= Ġapp Component . main Component ( Main Module ( this )) ĊĠĠĠĠĠĠĠ Ġcomponent . inject ( this ) ĊĊĠĠĠĠĠĠĠ Ġpresenter . view Ġ= Ġthis ĊĠĠĠĠĠĠĠ Ġlifecycle . add Observer ( presenter ) ĊĠĠĠĠĠĠĠ Ġpresenter . restore State ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠData Binding Util . set ContentView ( this , ĠR . layout . activity _ main ) ĊĠĠĠĠĠĠĠ Ġbinding . presenter Ġ= Ġpresenter ĊĠĠĠĠĠĠĠ Ġbinding . execute Pending Bindings () ĊĊĠĠĠĠĠĠĠ Ġset Support ActionBar ( binding . toolbar ) ĊĠĠĠĠĠĠĠ Ġsupport ActionBar !!. title Ġ= Ġapplication Context . packageName ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Save InstanceState ( out State ) ĊĠĠĠĠĠĠĠ Ġpresenter . save State ( out State ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġinject ( fragment : ĠMain Fragment ) Ġ= Ġcomponent . inject ( fragment ) ĊĊĠĠĠ Ġoverride Ġfun Ġdisplay Error ( message : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ ĠSn ackbar . make ( binding . root Layout , Ġmessage , ĠSn ackbar . LENGTH _ LONG ). show () ĊĠĠĠ Ġ} Ċ }