package Ġcom . hu awei . code labs . hi health . happy sport . view models Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġcom . hu awei . code labs . hi health . happy sport . data . Walk ing Repository Ċ Ċ class ĠHistory ViewModel Factory ( ĊĠĠĠ Ġprivate Ġval Ġrepository : ĠWalk ing Repository Ċ ) Ġ: ĠViewModel Provider . New Instance Factory () Ġ{ ĊĊĠĠĠ Ġ@ Suppress (" UN CHECK ED _ CAST ") ĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠViewModel > Ġcreate ( model Class : ĠClass < T >): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠHistory ViewModel ( repository ) Ġas ĠT ĊĠĠĠ Ġ} Ċ }