package Ġcom . air bnb . mv rx . dog s Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . View Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġcom . air bnb . mv rx . M aver icks View Ċ import Ġcom . air bnb . mv rx . activity ViewModel Ċ import Ġcom . air bnb . mv rx . dog s . data . Dog Ċ import Ġcom . air bnb . mv rx . dog s . databinding . Dog s Fragment Binding Ċ import Ġcom . air bnb . mv rx . dog s . views . Dog s Fragment Handler Ċ import Ġcom . air bnb . mv rx . view binding . view Binding Ċ import Ġcom . air bnb . mv rx . with State Ċ Ċ class ĠDog s Fragment Ġ: ĠFragment ( R . layout . dog s _ fragment ), ĠM aver icks View , ĠDog s Fragment Handler Ġ{ ĊĠĠĠ Ġprivate Ġval Ġbinding : ĠDog s Fragment Binding Ġby Ġview Binding () ĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠDog ViewModel Ġby Ġactivity ViewModel () ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . handler Ġ= Ġthis ĊĠĠĠĠĠĠĠ Ġbinding . dog s RecyclerView . adapter Ġ= ĠDog Adapter ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Dog Clicked ( dog : ĠDog ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( R . id . action _ dog s _ to _ dog Detail , ĠDog Detail Fragment . arg ( dog . id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġadopt L oved Dog () Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel . ad opt L oved Dog () ĊĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( R . id . action _ dog s _ to _ ad option ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġinvalidate () Ġ= Ġwith State ( viewModel ) Ġ{ Ġstate Ġ-> ĊĠĠĠĠĠĠĠ Ġbinding . state Ġ= Ġstate ĊĠĠĠ Ġ} Ċ } Ċ