'Android NavigationGraph and Toolbar for Login flow

If I have a single Activity, containing multiple fragments, what is the best way to handle the Toolbar for a typical Login flow.

In my flow, the Activity NavigationGraph start is the Login Fragment with the DrawerLayout not visible and locked. The User then log's in, and the DrawerLayout is both visible and locked. The User can navigate back and forth between fragments.

So far, the only solution I've found is

toolbar.setNavigationIcon(null)
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)

Which works for hiding the Drawerlayout on the login screen, but it seems like a bit fo a 'hack' to set the Navigation Icon to null. Also, how do I unhide it?

Has anyone had a better solution using the NavigationComponent and NavigationGraph to implement this flow?

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source