|
|
@ -38,11 +38,13 @@ import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.navigation.INTERESTS_ROUTE
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.navigation.INTERESTS_ROUTE
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARG
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.navigation.TOPIC_ID_ARG
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.navigation.TOPIC_ROUTE
|
|
|
|
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreen
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.navigation.topicScreen
|
|
|
|
|
|
|
|
import kotlinx.serialization.Serializable
|
|
|
|
|
|
|
|
|
|
|
|
private const val DETAIL_PANE_NAVHOST_ROUTE = "detail_pane_route"
|
|
|
|
|
|
|
|
|
|
|
|
@Serializable object TopicPlaceholderDestination
|
|
|
|
|
|
|
|
@Serializable object DetailPaneNavHostDestination
|
|
|
|
|
|
|
|
|
|
|
|
fun NavGraphBuilder.interestsListDetailScreen() {
|
|
|
|
fun NavGraphBuilder.interestsListDetailScreen() {
|
|
|
|
composable(
|
|
|
|
composable(
|
|
|
@ -86,7 +88,7 @@ internal fun InterestsListDetailScreen(
|
|
|
|
fun onTopicClickShowDetailPane(topicId: String) {
|
|
|
|
fun onTopicClickShowDetailPane(topicId: String) {
|
|
|
|
onTopicClick(topicId)
|
|
|
|
onTopicClick(topicId)
|
|
|
|
nestedNavController.navigateToTopic(topicId) {
|
|
|
|
nestedNavController.navigateToTopic(topicId) {
|
|
|
|
popUpTo(DETAIL_PANE_NAVHOST_ROUTE)
|
|
|
|
popUpTo<DetailPaneNavHostDestination>()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
listDetailNavigator.navigateTo(ListDetailPaneScaffoldRole.Detail)
|
|
|
|
listDetailNavigator.navigateTo(ListDetailPaneScaffoldRole.Detail)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -103,15 +105,15 @@ internal fun InterestsListDetailScreen(
|
|
|
|
detailPane = {
|
|
|
|
detailPane = {
|
|
|
|
NavHost(
|
|
|
|
NavHost(
|
|
|
|
navController = nestedNavController,
|
|
|
|
navController = nestedNavController,
|
|
|
|
startDestination = TOPIC_ROUTE,
|
|
|
|
startDestination = TopicPlaceholderDestination::class,
|
|
|
|
route = DETAIL_PANE_NAVHOST_ROUTE,
|
|
|
|
route = DetailPaneNavHostDestination::class
|
|
|
|
){
|
|
|
|
){
|
|
|
|
topicScreen(
|
|
|
|
topicScreen(
|
|
|
|
showBackButton = !listDetailNavigator.isListPaneVisible(),
|
|
|
|
showBackButton = !listDetailNavigator.isListPaneVisible(),
|
|
|
|
onBackClick = listDetailNavigator::navigateBack,
|
|
|
|
onBackClick = listDetailNavigator::navigateBack,
|
|
|
|
onTopicClick = ::onTopicClickShowDetailPane,
|
|
|
|
onTopicClick = ::onTopicClickShowDetailPane,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
composable(route = TOPIC_ROUTE) {
|
|
|
|
composable<TopicPlaceholderDestination> {
|
|
|
|
TopicDetailPlaceholder()
|
|
|
|
TopicDetailPlaceholder()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|