Assigned
Status Update
Comments
ak...@gmail.com <ak...@gmail.com> #2
This actually has nothing to do with NavHostFragment, but is the behavior of NavController's setGraph().
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
Description
Jetpack Compose version:
Refer to the latest commit in the main branch of the Compose library. The Dialog component creates a ContextThemeWrapper with a pre-defined theme internally.
In my case, my project uses Compose in a separate Fragment within a View-based project. All View-based dialogs (DialogFragment) had their dim background color customized for design purposes, which is not supported in the Compose dialog.
So what I want is a way to pass a custom theme into the Compose-based dialog.
You can see the example code I'm referring to in this link.https://github.com/akexorcist/dialog-in-view-and-compose