|
|
@ -21,23 +21,20 @@ import androidx.navigation.NavType
|
|
|
|
import androidx.navigation.compose.composable
|
|
|
|
import androidx.navigation.compose.composable
|
|
|
|
import androidx.navigation.navArgument
|
|
|
|
import androidx.navigation.navArgument
|
|
|
|
import com.google.samples.apps.nowinandroid.core.navigation.NiaNavigationDestination
|
|
|
|
import com.google.samples.apps.nowinandroid.core.navigation.NiaNavigationDestination
|
|
|
|
import com.google.samples.apps.nowinandroid.core.navigation.NiaNavigationWithArguments
|
|
|
|
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.author.AuthorRoute
|
|
|
|
import com.google.samples.apps.nowinandroid.feature.author.AuthorRoute
|
|
|
|
|
|
|
|
|
|
|
|
object AuthorDestination : NiaNavigationDestination, NiaNavigationWithArguments {
|
|
|
|
object AuthorDestination : NiaNavigationDestination {
|
|
|
|
override val route = "author_route"
|
|
|
|
override val route = "author_route"
|
|
|
|
override val destination = "author_destination"
|
|
|
|
override val destination = "author_destination"
|
|
|
|
const val authorIdArg = "authorId"
|
|
|
|
const val authorIdArg = "authorId"
|
|
|
|
|
|
|
|
val routeWithArgs = "$route/{$authorIdArg}"
|
|
|
|
override val routeWithArguments: String
|
|
|
|
|
|
|
|
get() = route.plus("/{$authorIdArg}")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun NavGraphBuilder.authorGraph(
|
|
|
|
fun NavGraphBuilder.authorGraph(
|
|
|
|
onBackClick: () -> Unit
|
|
|
|
onBackClick: () -> Unit
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
composable(
|
|
|
|
composable(
|
|
|
|
route = AuthorDestination.routeWithArguments,
|
|
|
|
route = AuthorDestination.routeWithArgs,
|
|
|
|
arguments = listOf(
|
|
|
|
arguments = listOf(
|
|
|
|
navArgument(AuthorDestination.authorIdArg) {
|
|
|
|
navArgument(AuthorDestination.authorIdArg) {
|
|
|
|
type = NavType.StringType
|
|
|
|
type = NavType.StringType
|
|
|
|