package Ġcom . b _ lam . resp l ash . ui . user Ċ Ċ import Ġandroidx . lifecycle . observe Ċ import Ġcom . b _ lam . resp l ash . ui . photo . Photo Adapter Ċ import Ġcom . b _ lam . resp l ash . ui . photo . Photo Fragment Ċ import Ġkotlinx . android . synt hetic . main . fragment _ swipe _ recycler _ view .* Ċ import Ġorg . k oin . android x . view model . ext . android . shared ViewModel Ċ Ċ class ĠUser Photo Fragment Ġ: ĠPhoto Fragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġshared ViewModel : ĠUser ViewModel Ġby Ġshared ViewModel () ĊĊĠĠĠ Ġoverride Ġval Ġpage d ListAdapter Ġ= ĊĠĠĠĠĠĠĠ ĠPhoto Adapter ( item Event Callback , Ġfalse , Ġshared Preferences Repository ) ĊĊĠĠĠ Ġoverride Ġfun Ġobserve Events () Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( shared ViewModel ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġswipe _ refresh _ layout . setOn Refresh Listener Ġ{ Ġrefresh Photos () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġphotos Refresh State LiveData . observe ( view Lifecycle Owner ) Ġ{ Ġupdate Refresh State ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġphotos Network State LiveData . observe ( view Lifecycle Owner ) Ġ{ Ġupdate Network State ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġphotos LiveData . observe ( view Lifecycle Owner ) Ġ{ Ġupdate Paged List ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġnew Instance () Ġ= ĠUser Photo Fragment () ĊĠĠĠ Ġ} Ċ }