package Ġcom . sar aha . p aws . View . Char ity Views . View Char ities Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view .* Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġcom . sar aha . p aws . Model . Char ity Ċ import Ġcom . sar aha . p aws . R Ċ import Ġcom . sar aha . p aws . View . Account Views . Edit Profile . Edit Profile Activity Ċ import Ġcom . sar aha . p aws . View . Home . Home . Home Activity Ċ import Ġcom . sar aha . p aws . databinding . Fragment View Char ities Binding ĊĊ Ċ class ĠView Char ities Fragment Ġ: ĠFragment () Ġ{ ĊĠĠĠ Ġ// View Ġmodel Ġand Ġbinding Ġlateinit Ġproperty ĊĠĠĠ Ġprivate Ġlateinit Ġvar ĠviewModel : ĠView Char ities ViewModel ĊĠĠĠ Ġlateinit Ġvar Ġbinding : ĠFragment View Char ities Binding ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠFragment View Char ities Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĊĠĠĠĠĠĠĠ ĠviewModel Ġ= ĠViewModel Provider ( require Activity () Ġas ĠHome Activity )[ View Char ities ViewModel :: class . java ] ĊĊĠĠĠĠĠĠĠ Ġset Has Options Menu ( true ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ ĠgetAll Char ities () ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Function Ġfor Ġan Ġtoolbar Ġcontent Ġand Ġhandler ĊĠĠĠ Ġoverride Ġfun ĠonCreate Options Menu ( menu : ĠMenu , Ġinflater : ĠMenu Inflater ) Ġ{ ĊĠĠĠĠĠĠĠ Ġmenu . clear () ĊĠĠĠĠĠĠĠ Ġsuper . onCreate Options Menu ( menu , in flater ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Function Ġto Ġget Ġall Ġchar ities Ġfrom ĠFire store ĊĠĠĠ Ġprivate Ġfun ĠgetAll Char ities (){ ĊĠĠĠĠĠĠĠ ĠviewModel . getAll Char ities From Firebase () ĊĠĠĠĠĠĠĠ ĠviewModel . listOf Char ities LiveData . observe ( view Lifecycle Owner ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( it . isNotEmpty ()){ Ġset RecyclerView WithData ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Function Ġto Ġset Ġdata Ġinto Ġre cycler view ĊĠĠĠ Ġprivate Ġfun Ġset RecyclerView WithData ( char ities : ĠList < Char ity > ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġre cyclerView Ġ= Ġbinding . re cyclerView Char ity List ĊĠĠĠĠĠĠĠ Ġre cyclerView . layout Manager Ġ= ĠLinearLayoutManager ( this . context ) ĊĠĠĠĠĠĠĠ Ġre cyclerView . adapter Ġ= ĠChar ity View Adapter ( this . context !! , char ities !! ) ĊĠĠĠ Ġ} Ċ Ċ }