https://kotlinlang.org logo
y

yschimke

10/13/2021, 7:03 AM
With Wear Navigation, what's the guidance for making a single large navigation graph with deeplinks, vs linking out to different distinct Activity's? Would something like settings be best as a separate Activity? Or does it cause any noticeable UX difference (backstack, ui transitions?).
j

John Nichol

10/13/2021, 8:03 AM
@Steve Bower [G] - you are probably best placed to comment on this
i

Ian Lake

10/13/2021, 1:47 PM
The Single Activity talk from a few years ago is even more relevant now:

https://youtu.be/2k8x8V77CrU

👍🏻 1
None of the legit use cases for multiple activities covered in that talk apply to Wear, FWIW
s

Steve Bower [G]

10/13/2021, 2:12 PM
Thanks Ian - just to add, the Wear Compose Navigation library is a thin layer over androidx.navigation - and in most important respects can follow the example of Compose. As an example, a test app we use has 70 destinations within a nav graph 3 levels deep - handles ok within a single activity.
👍🏻 1
a

Alex Vanyo

10/13/2021, 4:44 PM
This specifically applies to Wear Compose Navigation, and not necessarily “normal” Fragment-based navigation on Wear OS, right?
cc @codingjeremy
c

codingjeremy

10/15/2021, 6:09 PM
+1 - We still recommend only having one or two user journeys on Wear OS and also recommend using multiple Activities. You can still use Fragments if you want, but you have to disable the system swipe-to-dismiss gesture and handle that yourself (along with Ambient Mode work as well [see link]).
i

Ian Lake

10/15/2021, 6:57 PM
You no longer need to disable the system level swipe to dismiss when using Wear Compose's
SwipeToDismissBox
or
SwipeDismissableNavHost
- they all work out of the box as of alpha08: https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0-alpha08
❤️ 1
For a fragment based Wear app, you'd need to make sure that each fragment has its own
SwipeDismissFrameLayout
, but it is almost easier to just move over to Wear Compose 😛
c

codingjeremy

10/15/2021, 7:24 PM
ha ha, yes! Sorry, I was only talking about views when I said +1... I should have clarified that ^_^;; Yes, Compose takes care of all that. I updated Compose navigation sample for Wear to show that off.
5 Views