[go: nahoru, domu]

Move startDestination param before route

Since route is optional and the startDestination is not,
startDestination should come before the route in the NavHost parameter
list.

Also added documentation for the KEY_ROUTE constant.

RelNote: "startDestination now comes before the route in the list of a
parameters for a NavHost"

Test: ./gradlew checkApi
Fixes: 171831935
Change-Id: Ie620e9208948db572ab70ee6be09f3dafb605bd7
diff --git a/navigation/navigation-compose/api/current.txt b/navigation/navigation-compose/api/current.txt
index ba0d38f..7a62bba 100644
--- a/navigation/navigation-compose/api/current.txt
+++ b/navigation/navigation-compose/api/current.txt
@@ -32,7 +32,7 @@
   }
 
   public final class NavHostKt {
-    method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, optional String? route, String startDestination, kotlin.jvm.functions.Function1<? super androidx.navigation.NavGraphBuilder,kotlin.Unit> builder);
+    method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, String startDestination, optional String? route, kotlin.jvm.functions.Function1<? super androidx.navigation.NavGraphBuilder,kotlin.Unit> builder);
     method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, androidx.navigation.NavGraph graph);
   }
 
diff --git a/navigation/navigation-compose/api/public_plus_experimental_current.txt b/navigation/navigation-compose/api/public_plus_experimental_current.txt
index ba0d38f..7a62bba 100644
--- a/navigation/navigation-compose/api/public_plus_experimental_current.txt
+++ b/navigation/navigation-compose/api/public_plus_experimental_current.txt
@@ -32,7 +32,7 @@
   }
 
   public final class NavHostKt {
-    method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, optional String? route, String startDestination, kotlin.jvm.functions.Function1<? super androidx.navigation.NavGraphBuilder,kotlin.Unit> builder);
+    method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, String startDestination, optional String? route, kotlin.jvm.functions.Function1<? super androidx.navigation.NavGraphBuilder,kotlin.Unit> builder);
     method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, androidx.navigation.NavGraph graph);
   }
 
diff --git a/navigation/navigation-compose/api/restricted_current.txt b/navigation/navigation-compose/api/restricted_current.txt
index ba0d38f..7a62bba 100644
--- a/navigation/navigation-compose/api/restricted_current.txt
+++ b/navigation/navigation-compose/api/restricted_current.txt
@@ -32,7 +32,7 @@
   }
 
   public final class NavHostKt {
-    method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, optional String? route, String startDestination, kotlin.jvm.functions.Function1<? super androidx.navigation.NavGraphBuilder,kotlin.Unit> builder);
+    method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, String startDestination, optional String? route, kotlin.jvm.functions.Function1<? super androidx.navigation.NavGraphBuilder,kotlin.Unit> builder);
     method @androidx.compose.runtime.Composable public static void NavHost(androidx.navigation.NavHostController navController, androidx.navigation.NavGraph graph);
   }
 
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
index 3044711..e86802b 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
@@ -44,15 +44,16 @@
  *
  * @sample androidx.navigation.compose.samples.BasicNav
  *
- * @param route the route for the graph
+ * @param navController the navController for this host
  * @param startDestination the route for the start destination
+ * @param route the route for the graph
  * @param builder the builder used to construct the graph
  */
 @Composable
 public fun NavHost(
     navController: NavHostController,
-    route: String? = null,
     startDestination: String,
+    route: String? = null,
     builder: NavGraphBuilder.() -> Unit
 ) {
     NavHost(
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
index ea344ba..cbe9bd4 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
@@ -36,6 +36,9 @@
 import androidx.navigation.NavHostController
 import androidx.navigation.navigation
 
+/**
+ * The route linked to the current destination.
+ */
 const val KEY_ROUTE = "android-support-nav:controller:route"
 
 /**