diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt index d1ead05dd..2b2082df8 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt @@ -104,19 +104,17 @@ internal fun InterestsListDetailScreen( fun onTopicClickShowDetailPane(topicId: String) { onTopicClick(topicId) - - // TODO (merge): Fix this - //if (listDetailNavigator.isDetailPaneVisible()) { + if (listDetailNavigator.isDetailPaneVisible()) { // If the detail pane was visible, then use the nestedNavController navigate call // directly nestedNavController.navigateToTopic(topicId) { popUpTo() } - /*} else { + } else { // Otherwise, recreate the NavHost entirely, and start at the new destination nestedNavHostStartDestination = TopicDestination(id = topicId) nestedNavKey = UUID.randomUUID() - }*/ + } listDetailNavigator.navigateTo(ListDetailPaneScaffoldRole.Detail) } @@ -124,22 +122,19 @@ internal fun InterestsListDetailScreen( value = listDetailNavigator.scaffoldValue, directive = listDetailNavigator.scaffoldDirective, listPane = { - // TODO (merge): Fix this - //AnimatedPane { + AnimatedPane { InterestsRoute( onTopicClick = ::onTopicClickShowDetailPane, highlightSelectedTopic = listDetailNavigator.isDetailPaneVisible(), ) - //} + } }, detailPane = { - // TODO (merge): Fix this - //AnimatedPane { - // key(nestedNavKey) { + AnimatedPane { + key(nestedNavKey) { NavHost( navController = nestedNavController, - startDestination = nestedNavHostStartDestination, - route = DetailPaneNavHostDestination::class, + startDestination = nestedNavHostStartDestination ) { topicScreen( showBackButton = !listDetailNavigator.isListPaneVisible(), @@ -150,17 +145,10 @@ internal fun InterestsListDetailScreen( TopicDetailPlaceholder() } } - // } - //} + } + } }, ) - // TODO (merge): Remove - LaunchedEffect(Unit) { - if (selectedTopicId != null) { - // Initial topic ID was provided when navigating to Interests, so show its details. - onTopicClickShowDetailPane(selectedTopicId) - } - } } @OptIn(ExperimentalMaterial3AdaptiveApi::class) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9be369689..b52bd4af8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ androidxBrowser = "1.8.0" androidxComposeBom = "2024.02.02" androidxComposeCompiler = "1.5.8" androidxComposeUiTest = "1.7.0-alpha06" -androidxComposeMaterial3Adaptive = "1.0.0-alpha10" +androidxComposeMaterial3Adaptive = "1.0.0-alpha12" androidxComposeRuntimeTracing = "1.0.0-beta01" androidxCore = "1.12.0" androidxCoreSplashscreen = "1.0.1"