[go: nahoru, domu]

Change to using screen routes in all samples

Test: tested in demo app
Change-Id: Ia691bde2cd89ae7db6687fd0e2e0602c7d52ed75
diff --git a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
index b59307c..50d3aab 100644
--- a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
+++ b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
@@ -35,6 +35,7 @@
 import androidx.navigation.compose.rememberNavController
 import androidx.navigation.compose.samples.Dashboard
 import androidx.navigation.compose.samples.Profile
+import androidx.navigation.compose.samples.Screen
 import androidx.navigation.compose.samples.Scrollable
 
 @Composable
@@ -43,9 +44,9 @@
 
     var selectedItem by remember { mutableStateOf(0) }
     val items = listOf(
-        stringResource(R.string.profile) to "profile",
-        stringResource(R.string.dashboard) to "dashboard",
-        stringResource(R.string.scrollable) to "scrollable"
+        stringResource(R.string.profile) to Screen.Profile.route,
+        stringResource(R.string.dashboard) to Screen.Dashboard.route,
+        stringResource(R.string.scrollable) to Screen.Scrollable.route
     )
 
     Scaffold(
@@ -65,10 +66,10 @@
             }
         }
     ) {
-        NavHost(navController, startDestination = "profile") {
-            composable("profile") { Profile(navController) }
-            composable("dashboard") { Dashboard(navController) }
-            composable("scrollable") { Scrollable(navController) }
+        NavHost(navController, startDestination = Screen.Profile.route) {
+            composable(Screen.Profile.route) { Profile(navController) }
+            composable(Screen.Dashboard.route) { Dashboard(navController) }
+            composable(Screen.Scrollable.route) { Scrollable(navController) }
         }
     }
 }
diff --git a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavByDeepLinkDemo.kt b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavByDeepLinkDemo.kt
index 719f6d2..e40c0c9 100644
--- a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavByDeepLinkDemo.kt
+++ b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavByDeepLinkDemo.kt
@@ -47,10 +47,10 @@
 fun NavByDeepLinkDemo() {
     val navController = rememberNavController()
     val uri = "https://example.com/dashboard?args="
-    NavHost(navController, startDestination = "profile") {
-        composable("profile") { ProfileWithDeepLink(navController, uri) }
+    NavHost(navController, startDestination = Screen.Profile.route) {
+        composable(Screen.Profile.route) { ProfileWithDeepLink(navController, uri) }
         composable(
-            "dashboard",
+            Screen.Dashboard.route,
             arguments = listOf(navArgument("args") { defaultValue = "no value given" }),
             deepLinks = listOf(navDeepLink { uriPattern = "$uri{args}" })
         ) { backStackEntry ->
diff --git a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
index 2641bfd..996f3b9 100644
--- a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
+++ b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
@@ -42,9 +42,9 @@
 @Composable
 fun NavWithArgsDemo() {
     val navController = rememberNavController()
-    NavHost(navController, startDestination = "profile") {
-        composable("profile") { ProfileWithArgs(navController) }
-        composable("dashboard?args={args}") { backStackEntry ->
+    NavHost(navController, startDestination = Screen.Profile.route) {
+        composable(Screen.Profile.route) { ProfileWithArgs(navController) }
+        composable(Screen.Dashboard.route + "?args={args}") { backStackEntry ->
             Dashboard(navController, backStackEntry.arguments?.get("args") as? String)
         }
     }
diff --git a/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt b/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
index ca421aa..ed3cc58 100644
--- a/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
+++ b/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
@@ -52,10 +52,10 @@
 @Composable
 fun BasicNav() {
     val navController = rememberNavController()
-    NavHost(navController, startDestination = "profile") {
-        composable("profile") { Profile(navController) }
-        composable("dashboard") { Dashboard(navController) }
-        composable("scrollable") { Scrollable(navController) }
+    NavHost(navController, startDestination = Screen.Profile.route) {
+        composable(Screen.Profile.route) { Profile(navController) }
+        composable(Screen.Dashboard.route) { Dashboard(navController) }
+        composable(Screen.Scrollable.route) { Scrollable(navController) }
     }
 }