Android navigation component. Show full-screen dialog with morphing navigation icon from arrow to cross

Viewed 885

I created project from sample "Navigation drawer activity". Navigation icon works fine for top level and other destination. Navigation icon morphs from "hamburger" to "arrow" and back.

enter image description here

Issue

Ok. Now I need to implement full-screen dialog as it recommended for dialogs with keyboard input.

enter image description here

I created dialog fragment destination according documentation:
ProductCountChangeFragment.kt

internal class ProductCountChangeFragment : DialogFragment(R.layout.product_count_change_fragment) {
    //...
}

navigation.xml

<dialog
    android:id="@+id/product_count_change_dialog_fragment"
    android:name="my.package.ProductCountChangeFragment"
    tools:layout="@layout/product_count_change_fragment" />

It starts as regular dialog (not full-screen). I believe, navigation component supports material design recommendations, but I'm missing a tiny detail how to enable required behaviour.

1 Answers
  1. You can hide/show toolbar when fragment attach() and show in detach()
override fun onAttach(context: Context) {
    super.onAttach(context)
    (activity as? MainActivity)?.run {
        goneBottomNavigation()
        setStatusBarColor(R.color.C_E6EBEF)    
    }   
}
  1. this : same issue with you with navigation component : How to hide toolbar in start destination.
Related