Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
I think it makes a lot of sense for NavigationUI to ignore onDestinationChanged callbacks when the destination is a floating window like for <dialog> destinations. We'll look into what the best way of doing this is.
As a workaround, you can add any dialog destinations you open from your start destination to your AppBarConfiguration as an additional top level destination:https://developer.android.com/guide/navigation/navigation-ui#appbarconfiguration - the title will still change (if you have an android:label set on your dialog destination, something you could remove as well), but the Up button won't appear on top level destinations.
As a workaround, you can add any dialog destinations you open from your start destination to your AppBarConfiguration as an additional top level destination:
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b17330acca92cd173e0535ac83cbec50fc95a24c
Author: jbwoods <jbwoods@google.com>
Date: Fri May 31 16:16:44 2019
Ensure ActionBar is not updated when destination is floating window
When showing a dialog destination, the actionbar updates to show an up
arrow. This behavior is unexpected and it is not possible to use the
back button. The action bar should remain the same when interacting with
any floating window.
This change adds a marker inferface, FloatingWindow, that should be
implemented by classes considered to be floating windows.
AbstractAppBarOnDestinationChangeListener checks if the destination is an
instance of FloatingWindow to determine if the AppBar should be
updated.
Added label for dialog destination in integration app for testing.
Test: Tested in integration app. ./gradlew checkApi
BUG: 133600763
Change-Id: Ie4efab6c265eca13583bd21615f8d571c2236443
M navigation/common/api/2.1.0-alpha06.txt
M navigation/common/api/current.txt
A navigation/common/src/main/java/androidx/navigation/FloatingWindow.java
M navigation/fragment/api/2.1.0-alpha06.txt
M navigation/fragment/api/current.txt
M navigation/fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.java
M navigation/integration-tests/testapp/src/main/res/navigation/nav_main.xml
M navigation/ui/src/main/java/androidx/navigation/ui/AbstractAppBarOnDestinationChangedListener.java
M navigation/ui/src/main/java/androidx/navigation/ui/NavigationUI.java
https://android-review.googlesource.com/973528
https://goto.google.com/android-sha1/b17330acca92cd173e0535ac83cbec50fc95a24c
Branch: androidx-master-dev
commit b17330acca92cd173e0535ac83cbec50fc95a24c
Author: jbwoods <jbwoods@google.com>
Date: Fri May 31 16:16:44 2019
Ensure ActionBar is not updated when destination is floating window
When showing a dialog destination, the actionbar updates to show an up
arrow. This behavior is unexpected and it is not possible to use the
back button. The action bar should remain the same when interacting with
any floating window.
This change adds a marker inferface, FloatingWindow, that should be
implemented by classes considered to be floating windows.
AbstractAppBarOnDestinationChangeListener checks if the destination is an
instance of FloatingWindow to determine if the AppBar should be
updated.
Added label for dialog destination in integration app for testing.
Test: Tested in integration app. ./gradlew checkApi
BUG: 133600763
Change-Id: Ie4efab6c265eca13583bd21615f8d571c2236443
M navigation/common/api/2.1.0-alpha06.txt
M navigation/common/api/current.txt
A navigation/common/src/main/java/androidx/navigation/FloatingWindow.java
M navigation/fragment/api/2.1.0-alpha06.txt
M navigation/fragment/api/current.txt
M navigation/fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.java
M navigation/integration-tests/testapp/src/main/res/navigation/nav_main.xml
M navigation/ui/src/main/java/androidx/navigation/ui/AbstractAppBarOnDestinationChangedListener.java
M navigation/ui/src/main/java/androidx/navigation/ui/NavigationUI.java
jb...@google.com <jb...@google.com> #4
We have fixed the underlying issue internally and it will be available in the Navigation 2.1.0-alpha06 release.
Description
Version used: 2.1.0-alpha03
Devices/Android versions reproduced on: Any
When I show dialog from any fragment in Navigation Component, background fragment will create a back button in it's toolbar. Is there any option to not show back button in background fragment when dialog is popped. Or any possible workaround?
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).