package Ġcom . mer x ury . block er . ui . home Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . core . view . View Compat Ċ import Ġandroidx . core . view . Window Compat Ċ import Ġandroidx . core . view . Window Insets Compat Ċ import Ġandroidx . core . view . update LayoutParams Ċ import Ġandroidx . navigation . Nav Controller Ċ import Ġandroidx . navigation . fragment . Nav Host Fragment Ċ import Ġandroidx . navigation . ui . AppBar Configuration Ċ import Ġandroidx . navigation . ui . setup With Nav Controller Ċ import Ġcom . google . android . material . bottomnavigation . Bottom Navigation View Ċ import Ġcom . mer x ury . block er . R Ċ import Ġcom . mer x ury . block er . databinding . Activity Home Binding ĊĊ Ċ class ĠHome Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnav Controller : ĠNav Controller ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġapp Bar Configuration : ĠApp Bar Configuration ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠActivity Home Binding ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠActivity Home Binding . inflate ( layout Inflater ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( binding . root ) ĊĠĠĠĠĠĠĠ Ġset Support ActionBar ( binding . toolbar ) ĊĠĠĠĠĠĠĠ Ġinit Edge To Edge () ĊĠĠĠĠĠĠĠ Ġval Ġnav Host Fragment Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupport FragmentManager . find Fragment ById ( R . id . nav _ host _ fragment ) Ġas ĠNav Host Fragment ĊĠĠĠĠĠĠĠ Ġnav Controller Ġ= Ġnav Host Fragment . nav Controller ĊĠĠĠĠĠĠĠ Ġapp Bar Configuration Ġ= ĠApp Bar Configuration ( nav Controller . graph ) ĊĠĠĠĠĠĠĠ ĠfindViewById < Bottom Navigation View >( R . id . bottom _ nav ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setup With Nav Controller ( nav Controller ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Support Navigate Up (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġnav Controller . navigate Up () Ġ|| Ġsuper . on Support Navigate Up () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit Edge To Edge () Ġ{ ĊĠĠĠĠĠĠĠ ĠWindow Compat . set Decor Fits System Windows ( window , Ġfalse ) ĊĠĠĠĠĠĠĠ ĠView Compat . setOn Apply Window Insets Listener ( binding . root ) Ġ{ Ġview , Ġwindow Insets Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġin sets Ġ= Ġwindow Insets . get Insets ( Window Insets Compat . Type . system Bars ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview . update LayoutParams < ViewGroup . Margin LayoutParams > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġleft Margin Ġ= Ġin sets . left ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġright Margin Ġ= Ġin sets . right ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwindow Insets ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ