package Ġes . u am . eps . tf g . menu Planner . user Profile Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . util . Log Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġes . u am . eps . tf g . menu Planner . Menu Application Ċ import Ġes . u am . eps . tf g . menu Planner . R Ċ import Ġes . u am . eps . tf g . menu Planner . database . Recipe Ċ import Ġes . u am . eps . tf g . menu Planner . databinding . Fragment MainMenu Binding Ċ import Ġes . u am . eps . tf g . menu Planner . util . Recipe ListAdapter Ċ Ċ class ĠSaved Recipes Fragment Ġ: ĠFragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar ĠviewModel : ĠProfile ViewModel ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠviewModel Ġ= ĠViewModel Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthis , ĠProfile ViewModel . FACTORY ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( require Context (). application Context Ġas ĠMenu Application ). repository ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get ( Profile ViewModel :: class . java ) ĊĠĠĠ Ġ} ĊĊĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbinding : ĠFragment MainMenu Binding Ġ= ĠData Binding Util . inflate ( in flater , ĠR . layout . fragment _ main _ menu , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĊĠĠĠĠĠĠĠ Ġval Ġadapter Ġ= ĠRecipe ListAdapter ( Recipe ListAdapter . OnClickListener Ġ{ Ġrecipe : ĠRecipe Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġaction Ġ= ĠProfile Fragment Directions . action Profile Fragment To Recipe Fragment ( recipe . id _ recipe ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( action ) ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġbinding . menu RecyclerView . adapter Ġ= Ġadapter ĊĊĠĠĠĠĠĠĠ ĠviewModel . saved Recipes . observe ( view Lifecycle Owner , ĠObserver Ġ{ Ġrecipes Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLog . d (" Menu "," L as Ġrec et as Ġde Ġho y Ġson Ġ$ recipes ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter . submit List ( recipes ) ĊĠĠĠĠĠĠĠ Ġ}) ĊĊĠĠĠĠĠĠĠ Ġbinding . set Lifecycle Owner ( this ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġcompanion Ġobject ĠFactory Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance () Ġ= ĠSaved Recipes Fragment () ĊĠĠĠ Ġ} Ċ }