package Ġcom . berg amin . mar vel characters . feature . character . view model Ċ Ċ import Ġandroidx . databinding . Observable Field Ċ import Ġandroidx . lifecycle . Mediator LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġcom . berg amin . mar vel characters . R Ċ import Ġcom . berg amin . mar vel characters . common . provider . Resource Provider Ċ import Ġcom . berg amin . mar vel characters . domain . model . Character Ċ import Ġcom . berg amin . mar vel characters . domain . repository . Mar vel Repository Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠCharacter ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġrepository : ĠMar vel Repository , ĊĠĠĠ Ġprivate Ġval Ġresource Provider : ĠResource Provider Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġcharacter LiveData Ġ= ĠMutable LiveData < Character >() ĊĠĠĠ Ġval Ġlive Data Mediator Ġ= ĠMed iator LiveData < Character >() ĊĠĠĠ Ġval Ġdescription Ġ= ĠObservable Field < String >() ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġsetup Format ters () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Format ters () Ġ{ ĊĠĠĠĠĠĠĠ Ġlive Data Mediator . add Source ( character LiveData ) Ġ{ Ġcharacter Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlive Data Mediator . value Ġ= Ġcharacter ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdescription . set ( resource Provider . getString ( R . string . description , Ġcharacter ?. description Ġ?: Ġ"- ")) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġload Data ( id : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrepository . get Character ( id , Ġcharacter LiveData ) ĊĠĠĠ Ġ} Ċ } Ċ