package Ġeu . dar ken . android kotlin starter . main . ui Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . Menu Ċ import Ġandroid . view . MenuItem Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġbutter knife . B utter Kn ife Ċ import Ġeu . dar ken . android kotlin starter . R Ċ import Ġeu . dar ken . android kotlin starter . main . ui . fragment . Example Fragment Ċ import Ġeu . dar ken . mv pb ak ery . base . M VP B ak ery Ċ import Ġeu . dar ken . mv pb ak ery . base . ViewModel Ret ainer Ċ import Ġeu . dar ken . mv pb ak ery . injection . Component Source Ċ import Ġeu . dar ken . mv pb ak ery . injection . Inject ed Presenter Ċ import Ġeu . dar ken . mv pb ak ery . injection . Manual Injector Ċ import Ġeu . dar ken . mv pb ak ery . injection . Presenter Injection Callback Ċ import Ġeu . dar ken . mv pb ak ery . injection . fragment . Has Manual Fragment Injector Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity (), ĠMainActivity Presenter . View , ĠHas Manual Fragment Injector Ġ{ ĊĊĠĠĠ Ġ@ Inject Ġlateinit Ġvar Ġfragment Injector : ĠComponent Source < android x . fragment . app . Fragment > ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġset Theme ( R . style . Base App Theme _ No ActionBar ) ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ ĠM VP B ak ery . builder < MainActivity Presenter . View , ĠMainActivity Presenter >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. presenter Factory ( Inject ed Presenter ( this )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. presenter Ret ainer ( ViewModel Ret ainer ( this )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Presenter Callback ( Presenter Injection Callback ( this )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. attach ( this ) ĊĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . main _ activity ) ĊĠĠĠĠĠĠĠ ĠB utter Kn ife . bind ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate Options Menu ( menu : ĠMenu ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġmenu Inflater . inflate ( R . menu . menu _ main , Ġmenu ) ĊĠĠĠĠĠĠĠ Ġreturn Ġtrue ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Options ItemSelected ( item : ĠMenuItem ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( item . itemId ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠR . id . action _ settings Ġ-> Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġsuper . on Options ItemSelected ( item ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġsupport Fragment Injector (): ĠManual Injector < android x . fragment . app . Fragment > Ġ= Ġfragment Injector ĊĊĠĠĠ Ġoverride Ġfun Ġshow Example Fragment () Ġ{ ĊĠĠĠĠĠĠĠ Ġvar Ġfragment Ġ= Ġsupport FragmentManager . find Fragment ById ( R . id . content _ frame ) ĊĠĠĠĠĠĠĠ Ġif Ġ( fragment Ġ== Ġnull ) Ġfragment Ġ= ĠExample Fragment . newInstance () ĊĠĠĠĠĠĠĠ Ġsupport FragmentManager . beginTransaction (). replace ( R . id . content _ frame , Ġfragment ). commit Allow ing State Loss () ĊĠĠĠ Ġ} Ċ } Ċ