|
|
@ -33,6 +33,7 @@ import androidx.navigation.NavGraphBuilder
|
|
|
|
import androidx.navigation.compose.NavHost
|
|
|
|
import androidx.navigation.compose.NavHost
|
|
|
|
import androidx.navigation.compose.composable
|
|
|
|
import androidx.navigation.compose.composable
|
|
|
|
import androidx.navigation.compose.rememberNavController
|
|
|
|
import androidx.navigation.compose.rememberNavController
|
|
|
|
|
|
|
|
import androidx.navigation.toRoute
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.navigation.InterestsDestination
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.interests.navigation.InterestsDestination
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.topic.TopicDetailPlaceholder
|
|
|
@ -45,20 +46,13 @@ import kotlinx.serialization.Serializable
|
|
|
|
@Serializable object DetailPaneNavHostDestination
|
|
|
|
@Serializable object DetailPaneNavHostDestination
|
|
|
|
|
|
|
|
|
|
|
|
fun NavGraphBuilder.interestsListDetailScreen() {
|
|
|
|
fun NavGraphBuilder.interestsListDetailScreen() {
|
|
|
|
composable<InterestsDestination> {
|
|
|
|
composable<InterestsDestination> { backStackEntry ->
|
|
|
|
InterestsListDetailScreen()
|
|
|
|
val topicIdArgument = backStackEntry.toRoute<InterestsDestination>().topicId
|
|
|
|
|
|
|
|
var topicId: String? by rememberSaveable { mutableStateOf(topicIdArgument) }
|
|
|
|
|
|
|
|
InterestsListDetailScreen(selectedTopicId = topicId, onTopicClick = { topicId = it })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
|
|
|
internal fun InterestsListDetailScreen() {
|
|
|
|
|
|
|
|
var selectedTopicId: String? by rememberSaveable { mutableStateOf(null) }
|
|
|
|
|
|
|
|
InterestsListDetailScreen(
|
|
|
|
|
|
|
|
selectedTopicId = selectedTopicId,
|
|
|
|
|
|
|
|
onTopicClick = { topicId -> selectedTopicId = topicId },
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
|
|
|
|
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
internal fun InterestsListDetailScreen(
|
|
|
|
internal fun InterestsListDetailScreen(
|
|
|
|