package Ġcom . google . samples . apps . sun flower . mv vm . g arden . g arden _ plant ing Ċ Ċ import Ġandroidx . databinding . Observable Field Ċ import Ġandroidx . databinding . Observable Int Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġcom . google . samples . apps . sun flower . data . source . local . Plant And G arden Plant ings Ċ import Ġjava . text . SimpleDateFormat Ċ import Ġjava . util .* Ċ Ċ class ĠPl ant And G arden Plant ings ViewModel ( plant ings : ĠPl ant And G arden Plant ings ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġplant Ġ= ĠcheckNotNull ( plant ings . plant ) ĊĠĠĠ Ġprivate Ġval Ġg arden Plant ing Ġ= Ġplant ings . g arden Plant ings [ 0 ] ĊĠĠĠ Ġprivate Ġval ĠdateFormat Ġby Ġlazy Ġ{ ĠSimpleDateFormat (" MMM Ġd , Ġy yyy ", ĠLocale . US ) Ġ} ĊĊĠĠĠ Ġval Ġwater DateString Ġ= ĊĠĠĠĠĠĠĠ ĠObservable Field < String >( date Format . format ( g arden Plant ing . last Water ing Date . time )) ĊĠĠĠ Ġval Ġwater ing Interval Ġ= ĠObservable Int ( plant . water ing Interval ) ĊĠĠĠ Ġval ĠimageUrl Ġ= ĠObservable Field ( plant . imageUrl ) ĊĠĠĠ Ġval Ġplant Name Ġ= ĠObservable Field ( plant . name ) ĊĠĠĠ Ġval Ġplant DateString Ġ= ĠObservable Field < String >( date Format . format ( g arden Plant ing . plant Date . time )) Ċ }