package Ġcom . yo es uv . inf omal ang bat u . utils . bindings Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġcom . yo es uv . inf omal ang bat u . menu . gallery . models . Gallery Model Ċ import Ġcom . yo es uv . inf omal ang bat u . menu . gallery . view models . Fragment Detail Gallery ViewModel Ċ import Ġcom . yo es uv . inf omal ang bat u . menu . list place . models . Place Model Ċ import Ġcom . yo es uv . inf omal ang bat u . menu . list place . view models . Fragment Detail List Place ViewModel Ċ Ċ /** ĠREFERENCES Ċ Ġ* Ġhttps :// stackoverflow . com / a / 5 0 3 7 4 0 8 8 Ċ Ġ*/ Ċ class ĠViewModel Fragment Factory ( private Ġval Ġparams : ĠAny ): ĠViewModel Provider . New Instance Factory () Ġ{ ĊĊĠĠĠ Ġ@ Suppress (" UN CHECK ED _ CAST ") ĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠViewModel ?> Ġcreate ( model Class : ĠClass < T >): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( model Class Ġ== ĠFragment Detail Gallery ViewModel :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠFragment Detail Gallery ViewModel ( params Ġas ĠGallery Model ) Ġas ĠT ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġif Ġ( model Class Ġ== ĠFragment Detail List Place ViewModel :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠFragment Detail List Place ViewModel ( params Ġas ĠPlace Model ) Ġas ĠT ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġsuper . create ( model Class ) ĊĠĠĠ Ġ} Ċ Ċ }