package Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . fragments . list _ categories . view Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġcom . s yle im an . ging erm oney . R Ċ import Ġcom . s yle im an . ging erm oney . application . App Ċ import Ġcom . s yle im an . ging erm oney . databinding . Fragment Add Edit Payment List Categories Binding Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . common . view _ commands . Move ToAdd Category Command Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . common . view _ commands . MoveTo Edit Category Command Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . fragments . list _ categories . dependency _ injection . List Categories Fragment Component Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . fragments . list _ categories . dto . Category ListItem Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . fragments . list _ categories . model . List Categories Model Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . fragments . list _ categories . view . list . List Categories Adapter Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . fragments . list _ categories . view _ model . List Categories ViewModel Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . headers . list _ categories . List Categories Header Link Ċ import Ġcom . s yle im an . ging erm oney . ui . activities . add _ edit _ payment . navigation . Navigation Helper Ċ import Ġcom . s yle im an . ging erm oney . ui . common . mv vm . Fragment Base Ċ import Ġcom . s yle im an . ging erm oney . ui . common . mv vm . view _ commands . View Command Ċ import Ġkotlinx . android . synt hetic . main . fragment _ add _ edit _ payment _ list _ categories .* Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠList Categories Fragment Ġ: ĊĠĠĠ ĠFragment Base < Fragment Add Edit Payment List Categories Binding , ĠList Categories Model , ĠList Categories ViewModel >(), ĊĠĠĠ ĠList Category Fragment Header Link Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcategories ListAdapter : ĠList Categories Adapter ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcategories List LayoutManager : ĠLinearLayoutManager ĊĠĠĠ Ġprivate Ġvar Ġis List Initialized Ġ= Ġfalse ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġinternal Ġlateinit Ġvar Ġnavigation : ĠNavigation Helper ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġlink To Header : ĠList Categories Header Link ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġlink To Header . attach Fragment ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġprovide ViewModel Type (): ĠClass < List Categories ViewModel > Ġ= ĠList Categories ViewModel :: class . java ĊĊĠĠĠ Ġoverride Ġfun Ġprovide Layout (): ĠInt Ġ= ĠR . layout . fragment _ add _ edit _ payment _ list _ categories ĊĊĠĠĠ Ġoverride Ġfun Ġinject () Ġ= ĠApp . injection s . get < List Categories Fragment Component >(). inject ( this ) ĊĊĠĠĠ Ġoverride Ġfun Ġrelease Injection () Ġ{ ĊĠĠĠĠĠĠĠ ĠApp . injection s . release < List Categories Fragment Component >() ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġlink ViewModel ( binding : ĠFragment Add Edit Payment List Categories Binding , ĠviewModel : ĠList Categories ViewModel ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġobserve ViewModel ( viewModel : ĠList Categories ViewModel ) Ġ{ ĊĠĠĠĠĠĠĠ Ġis List Initialized Ġ= Ġfalse ĊĊĠĠĠĠĠĠĠ ĠviewModel . categories List . observe ({ this . view Lifecycle Owner . lifecycle }) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġupdate Categories List ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠĠĠĠĠ ĠviewModel . on View Active () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Add Button Click () Ġ= ĠviewModel . on Add Category Click () ĊĊĠĠĠ Ġoverride Ġfun Ġprocess View Command ( command : ĠView Command ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhen ( command ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠMove ToAdd Category Command Ġ-> Ġnavigation . moveTo Add Category ( this ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠMove To Edit Category Command Ġ-> Ġnavigation . moveTo Edit Category ( this , Ġcommand . category Db Id ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġupdate Categories List ( categories : ĠList < Category ListItem >) Ġ{ ĊĠĠĠĠĠĠĠ Ġif (! is List Initialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories List LayoutManager Ġ= ĠLinearLayoutManager ( context ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories ListAdapter Ġ= ĠList Categories Adapter ( viewModel ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories ListAdapter . set Has Stable Ids ( true ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories List . is Save Enabled Ġ= Ġfalse ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories List . item Animator Ġ= Ġnull ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories List . layout Manager Ġ= Ġcategories List LayoutManager ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcategories List . adapter Ġ= Ġcategories ListAdapter ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġis List Initialized Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġcategories ListAdapter . update ( categories ) ĊĠĠĠĠĠĠĠ Ġcategories List . scrollTo Position ( 0 ) ĊĠĠĠ Ġ} Ċ } ĊĊ