Fixed
Status Update
Comments
st...@google.com <st...@google.com> #2
Hi - thanks for raising this, I'll dig into our SwipeDismissableNavHost and try to find out why we didn't support the back button already. Will report back on this thread.
st...@google.com <st...@google.com> #3
An early draft of SwipeDismissableNavHost did implement back button support, but it was thought not to be required - we will submit a change to add the support back again.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 78d498661680a95d2705d5e6dbb1c0438c50fa30
Author: stevebower <stevebower@google.com>
Date: Tue Dec 14 13:42:48 2021
Support back button in SwipeDismissableNavHost.
Added back button handling for navigation to
SwipeDismissableNavHost, using the implementation
from Compose Material NavHost. This enables use
of the emulator's back button for local testing,
as well as in any devices that support a hardware back button.
Test: Run tests for wear.compose.navigation.
Bug: 210205624
Relnote: "We have added a back button handler to
SwipeDismissableNavHost, so that pressing
back navigates to the previous level
in the navigation hierarchy."
Change-Id: I5b08689b1651c1aae5f038f058956007df398909
M wear/compose/compose-navigation/build.gradle
M wear/compose/compose-navigation/src/androidTest/kotlin/androidx/wear/compose/navigation/SwipeDismissableNavHostTest.kt
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
https://android-review.googlesource.com/1922537
Branch: androidx-main
commit 78d498661680a95d2705d5e6dbb1c0438c50fa30
Author: stevebower <stevebower@google.com>
Date: Tue Dec 14 13:42:48 2021
Support back button in SwipeDismissableNavHost.
Added back button handling for navigation to
SwipeDismissableNavHost, using the implementation
from Compose Material NavHost. This enables use
of the emulator's back button for local testing,
as well as in any devices that support a hardware back button.
Test: Run tests for wear.compose.navigation.
Bug: 210205624
Relnote: "We have added a back button handler to
SwipeDismissableNavHost, so that pressing
back navigates to the previous level
in the navigation hierarchy."
Change-Id: I5b08689b1651c1aae5f038f058956007df398909
M wear/compose/compose-navigation/build.gradle
M wear/compose/compose-navigation/src/androidTest/kotlin/androidx/wear/compose/navigation/SwipeDismissableNavHostTest.kt
M wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
Description
Version used: 1.0.0-alpha12
Devices/Android versions reproduced on: Galaxy Watch 4 Classic
By default,
rememberSwipeDismissableNavController()
does not seem to support back button on watches that have it (for example Galaxy Watch 4). When user presses back button, whole activity will exit.Workaround is to manually add BackHandler after creating the nav controller: