package Ġorg . ant on ko z len ko . l unch near by . ui Ċ Ċ import Ġandroid . arch . lifecycle . ViewModel Ċ import Ġandroid . arch . lifecycle . ViewModel Provider Ċ import Ġorg . ant on ko z len ko . l unch near by . data . Google Places Repository Ċ import Ġorg . ant on ko z len ko . l unch near by . location . Location Service Ċ Ċ /** Ċ Ġ* ĠFactory Ġfor ĠView Models Ċ Ġ*/ Ċ class ĠApp ViewModel Factory ( private Ġval Ġrepository : ĠGoogle Places Repository , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġlocation Service : ĠLocation Service ) Ġ: ĠViewModel Provider . Factory Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠViewModel > Ġcreate ( model Class : ĠClass < T >): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( model Class . isAssignableFrom ( Rest aurants ViewModel :: class . java )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ Suppress (" UN CHECK ED _ CAST ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠRest aurants ViewModel ( repository , Ġlocation Service ) Ġas ĠT ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Unknown ĠViewModel Ġclass ") ĊĠĠĠ Ġ} Ċ }