package Ġnet . db jor ge . st itch os aur . ui Ċ Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġnet . db jor ge . st itch os aur . St itch os aur Application Ċ import Ġnet . db jor ge . st itch os aur . data . Project Dao Ċ Ċ class ĠProject Based ViewModel Factory ( fragment : ĠFragment ) Ġ: ĠViewModel Provider . Factory Ġ{ ĊĠĠĠ Ġprivate Ġval Ġproject Repository : ĠProject Dao Ġ= ĊĠĠĠĠĠĠĠ Ġ( fragment . activity ?. application Ġas ĠSt itch os aur Application ). database . project Dao (); ĊĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠViewModel > Ġcreate ( model Class : ĠClass < T >): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġmodel Class . getDeclared Constructor ( Project Dao :: class . java ). newInstance ( project Repository ) ĊĠĠĠ Ġ} Ċ } Ċ