Move JankStats metric gathering further down

This isn't the thing a developer should be focusing on when first
opening the file. So moving it further down in the composable.
pull/145/head
Ben Weiss 3 years ago
parent e949749073
commit 42878c5e86
No known key found for this signature in database
GPG Key ID: 8424F9C1E763A74C

@ -64,17 +64,6 @@ import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination
fun NiaApp(windowSizeClass: WindowSizeClass) {
NiaTheme {
val navController = rememberNavController()
JankMetricDisposableEffect(navController) { metricsHolder ->
val listener = NavController.OnDestinationChangedListener { _, destination, _ ->
metricsHolder.state?.addState("Navigation", destination.route.toString())
}
navController.addOnDestinationChangedListener(listener)
onDispose {
navController.removeOnDestinationChangedListener(listener)
}
}
val niaTopLevelNavigation = remember(navController) {
NiaTopLevelNavigation(navController)
@ -124,6 +113,17 @@ fun NiaApp(windowSizeClass: WindowSizeClass) {
}
}
}
JankMetricDisposableEffect(navController) { metricsHolder ->
val listener = NavController.OnDestinationChangedListener { _, destination, _ ->
metricsHolder.state?.addState("Navigation", destination.route.toString())
}
navController.addOnDestinationChangedListener(listener)
onDispose {
navController.removeOnDestinationChangedListener(listener)
}
}
}
}

Loading…
Cancel
Save