package Ġcom . n icky . note app . ui Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view .* Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . n icky . note app . adapters . Note List Recycler Adapter Ċ import Ġcom . n icky . note app . data . DataManager Ċ import Ġcom . n icky . note app . data . POSITION _ NOT _ SET Ċ import Ġcom . n icky . note app . databinding . Fragment Note List Binding ĊĊ Ċ class ĠNote List Fragment Ġ: ĠFragment () Ġ{ ĊĠĠĠ Ġprivate Ġvar Ġ_ binding : ĠFragment Note List Binding ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval Ġbinding Ġget () Ġ= Ġ_ binding !! ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġre cyclerView : ĠRecyclerView ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġset Has Options Menu ( true ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ binding Ġ= ĠFragment Note List Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . floating ActionButton 2 . setOnClickListener { ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( Note List Fragment Directions . action Note List Fragment To Note Fragment ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPOSITION _ NOT _ SET ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ)) ĊĊĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġre cyclerView Ġ= binding . list Items ĊĠĠĠĠĠĠĠ Ġ// set Ġthe Ġlayout Ġmanager Ġof Ġthe Ġre cycler view ĊĠĠĠĠĠĠĠ Ġre cyclerView . layout Manager = Linear LayoutManager ( context ) ĊĠĠĠĠĠĠĠ Ġ// connect Ġthe Ġitem Ġview Ġto Ġthe Ġadapter ĊĠĠĠĠĠĠĠ Ġbinding . list Items . adapter = ĠNote List Recycler Adapter ( context , ĠData Manager . notes ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy View () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy View () ĊĠĠĠĠĠĠĠ Ġ_ binding = null ĊĠĠĠ Ġ} ĊĊĊ Ċ }