package Ġdev . sert an . android . paper . ui . home Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġandroidx . recyclerview . widget . Item Touch Helper Ċ import Ġdagger . h ilt . android . Android EntryPoint Ċ import Ġdev . sert an . android . paper . data . model . Note Ċ import Ġdev . sert an . android . paper . databinding . Fragment Home Binding Ċ import Ġdev . sert an . android . paper . ui . main . MainActivity Ċ Ċ @ Android EntryPoint Ċ internal Ġclass ĠHome Fragment Ġ: ĠFragment (), ĠNote Adapter . Note Listener Ġ{ ĊĠĠĠ Ġprivate Ġvar Ġ_ binding : ĠFragment Home Binding ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval Ġbinding Ġget () Ġ= Ġ_ binding !! ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= ĠFragment Home Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġview Lifecycle Owner ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġval ĠviewModel : ĠHome ViewModel Ġby Ġview Models () ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĠĠĠĠĠĠĠ ĠsetUp RecyclerView () ĊĊĠĠĠĠĠĠĠ Ġ( require Activity () Ġas ? ĠMainActivity )?. on Fab Clicked Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdirection Ġ= ĠHome Fragment Directions . action Home ToAdd Note () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( direction ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Note Clicked ( note : ĠNote ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdirection Ġ= ĠHome Fragment Directions . action Home To Note ( note ) ĊĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( direction ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Note Sw ip ed To Left ( position : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . viewModel ?. delete ( require View (), Ġposition ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠsetUp RecyclerView () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnote Adapter Ġ= ĠNote Adapter ( this ) ĊĠĠĠĠĠĠĠ Ġval Ġnote Swipe ToDelete Callback Ġ= ĠNote Swipe Callback ( this ) ĊĊĠĠĠĠĠĠĠ Ġbinding . re cyclerView Notes . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter Ġ= Ġnote Adapter ĊĠĠĠĠĠĠĠĠĠĠĠ ĠItem Touch Helper ( note Swipe ToDelete Callback ). attach To RecyclerView ( this ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy View () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy View () ĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= Ġnull ĊĠĠĠ Ġ} Ċ Ċ } Ċ