package Ġcy . ag or ise . bits y bit shares wallet . fragments Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . lifecycle . ViewModel Providers Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġcy . ag or ise . bits y bit shares wallet . adapters . Balances Adapter Ċ import Ġcy . ag or ise . bits y bit shares wallet . database . join s . Balance Detail Ċ import Ġcy . ag or ise . bits y bit shares wallet . databinding . Fragment Balances Binding Ċ import Ġcy . ag or ise . bits y bit shares wallet . view models . Balance Detail ViewModel Ċ Ċ class ĠBal ances Fragment Ġ: ĠFragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġ_ binding : ĠFragment Balances Binding ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval Ġbinding Ġget () Ġ= Ġ_ binding !! ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm Balance Detail ViewModel : ĠBalance Detail ViewModel ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġset Has Options Menu ( true ) ĊĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= ĠFragment Balances Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy View () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy View () ĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= Ġnull ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠConfigure ĠBalance Detail ViewModel Ġto Ġshow Ġthe Ġcurrent Ġbalances ĊĠĠĠĠĠĠĠ Ġm Balance Detail ViewModel Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠViewModel Providers . of ( this ). get ( Balance Detail ViewModel :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġbalances Adapter Ġ= ĠBal ances Adapter ( context !! ) ĊĠĠĠĠĠĠĠ Ġbinding . rv Balances . adapter Ġ= Ġbalances Adapter ĊĠĠĠĠĠĠĠ Ġbinding . rv Balances . layout Manager Ġ= ĠLinearLayoutManager ( context !! ) ĊĠĠĠĠĠĠĠ Ġbinding . rv Balances . addItem Decoration ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDiv ider Item Decoration ( context !! , ĠDiv ider Item Decoration . VERTICAL ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġm Balance Detail ViewModel . getAll () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe ( this , ĠObserver < List < Balance Detail >> Ġ{ Ġbalances Details Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbalances Adapter . replaceAll ( balances Details ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} Ċ } Ċ