package Ġcom . berg amin . mar vel characters . feature . character . view Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . lifecycle . ViewModel Providers Ċ import Ġcom . berg amin . mar vel characters . Mar vel Application Ċ import Ġcom . berg amin . mar vel characters . R Ċ import Ġcom . berg amin . mar vel characters . databinding . Activity Character Binding Ċ import Ġcom . berg amin . mar vel characters . domain . model . Character Ċ import Ġcom . berg amin . mar vel characters . feature . character . view model . Character ViewModel Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠCharacter Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġlateinit Ġvar Ġbinding : ĠActivity Character Binding ĊĠĠĠ Ġprivate Ġval Ġcharacter Arg : ĠCharacter Ġby Ġlazy Ġ{ Ġintent . get Parcelable Extra < Character >( CHARACTER _ ARG ) Ġ} ĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel Factory : ĠViewModel Provider . Factory ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠCHARACTER _ ARG Ġ= Ġ" CHARACTER _ ARG " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġinject () ĊĠĠĠĠĠĠĠ Ġsetup Binding () ĊĠĠĠĠĠĠĠ Ġsetup ViewModel () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġcharacter Arg . id ?. let Ġ{ id Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . viewModel ?. load Data ( id ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Binding () Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠData Binding Util . set ContentView ( this , ĠR . layout . activity _ character ) ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠViewModel Providers . of ( this , ĠviewModel Factory )[ Character ViewModel :: class . java ] ĊĠĠĠĠĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġthis ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinject () Ġ{ ĊĠĠĠĠĠĠĠ ĠMar vel Application . app Component . inject ( this ) ĊĠĠĠ Ġ} Ċ } Ċ