package Ġworld . ach ie ver . pl any our day . plan Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . ViewGroup . Margin LayoutParams Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . navigation . find Nav Controller Ċ import Ġandroidx . navigation . fragment . Nav Host Fragment Ċ import Ġandroidx . navigation . ui . AppBar Configuration Ċ import Ġandroidx . navigation . ui . navigate Up Ċ import Ġandroidx . navigation . ui . setup ActionBar With Nav Controller Ċ import Ġcom . google . android . material . app bar . AppBar Layout . On Offset Changed Listener Ċ import Ġdagger . h ilt . android . Android EntryPoint Ċ import Ġworld . ach ie ver . pl any our day . R Ċ import Ġworld . ach ie ver . pl any our day . databinding . Activity Plan Binding Ċ Ċ @ Android EntryPoint Ċ class ĠPlan Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġapp Bar Configuration : ĠApp Bar Configuration ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġval Ġview Binding Ġ= ĠActivity Plan Binding . inflate ( layout Inflater ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcontent Layout Ġ= Ġview Binding . nav Host Fragment ĊĠĠĠĠĠĠĠ Ġval Ġcontent LayoutParams Ġ= Ġcontent Layout . layout Params Ġas ĠMargin LayoutParams ĊĊĠĠĠĠĠĠĠ Ġview Binding . app Bar Layout . add On Offset Changed Listener ( On Offset Changed Listener Ġ{ Ġapp Bar Layout , Ġvertical Offset Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontent LayoutParams . set Margins ( 0 , Ġ 0 , Ġ 0 , Ġapp Bar Layout . meas ured Height Ġ+ Ġvertical Offset ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontent Layout . request Layout () ĊĠĠĠĠĠĠĠ Ġ}) ĊĊĠĠĠĠĠĠĠ ĠsetContentView ( view Binding . root ) ĊĠĠĠĠĠĠĠ Ġset Support ActionBar ( view Binding . toolbar ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnav Host Fragment Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupport FragmentManager . find Fragment ById ( R . id . nav _ host _ fragment ) Ġas ĠNav Host Fragment ĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġnav Host Fragment . nav Controller ĊĊĠĠĠĠĠĠĠ Ġapp Bar Configuration Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠApp Bar Configuration . Builder ( R . id . plan _ fragment _ dest ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup ActionBar With Nav Controller ( nav Controller , Ġapp Bar Configuration ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Support Navigate Up () Ġ= ĊĠĠĠĠĠĠĠ Ġfind Nav Controller ( R . id . nav _ host _ fragment ). navigate Up ( app Bar Configuration ) Ċ } Ċ