Please give a brief summary of your issue: PdfViewCtrlTabHostFragment2 toolbar overrides actionbar of the entire app
Please describe your issue and provide steps to reproduce it:
The action bar of the entire app is overridden when navigating back from the PdfViewCtrlTabHostFragment2.
Reproduction steps:
Open the app provided.
Notice that each page in the app displays the page name in the toolbar on the top without the back navigation icon.
Go to the notifications bottom tab
Tap on the “Go to PDFTron Viewer” button
Notice that the PDFTron fragment displays its own toolbar.
Hit the back button
Result: Notice that the toolbar (actionbar) of the app on every page now has the navigation back arrow + no longer indicates the name of the page it’s on
Expected Result: Navigation toolbar is not overridden and continues to show page titles correctly and if on the base level does not show the navigation icon as if in a deeper page.
Please provide a link to a minimal sample where the issue is reproducible:
Thank you for your quick response. I did try your suggestion and it works in the sample app but not in our huge app with dozens and dozens of pages. It seems as though the PdfViewCtrlTabHostFragment2 has completely ruined the connection of our navController with the toolbar. Adding this to our app didn’t work in our actual app:
You can see in the attached image that the toolbar still has the icon and title of the opened .pdf when navigating back. The PdfViewCtrlTabHostFragment2 even messed with the theming of the TabLayout .
The AppBarConfiguration registers the root level destinations and the setupActionBarWithNavController registers the navigation.xml that the navController uses with the supportActionBar (toolbar). This automatically updates the navigation icon and title of the page in the toolbar upon navigation based on the fragment’s label determined in the navigation.xml (it’s mobile_navigation.xml in the sample app).
Something with the PDFTron Fragment code is messing with the Support Action Bar of the Activity instead of just its own fragment. This is then making the androidx navigation no longer be hooked up to the supportActionBar. We manage two very big apps with dozens of pages in both. It would be very tedious and undesirable to have to re implement a “hacky” workaround navigation just because of replacing a FrameLayout with the PdfViewCtrlTabHostFragment2 in a couple places in the app…
Are there any other options to disable the navigation of the PdfViewCtrlTabHostFragment2? I’ve even tried using the PdfViewCtrlTabHostFragment2.TabHostListener's override fun onNavButtonPressed() but that didn’t work either