Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Created December 9, 2021 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dilrajsingh1997/661e5109e651db5e1e2f80b7f202700c to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/661e5109e651db5e1e2f80b7f202700c to your computer and use it in GitHub Desktop.
class UserPageDestination {
data class UserPageArgs (
val id: kotlin.Int,
val names: kotlin.collections.ArrayList<kotlin.String>,
)
companion object {
fun parseArguments(backStackEntry: NavBackStackEntry): UserPageArgs {
return UserPageArgs(
id = backStackEntry.arguments?.getInt("id") ?: 0,
names = backStackEntry.arguments?.getSerializable("names") as? kotlin.collections.ArrayList<kotlin.String> ?: throw NullPointerException("parcel value not found"),
)
}
val argumentList: MutableList<NamedNavArgument>
get() = mutableListOf(
navArgument("id") {
type = NavType.IntType
},
navArgument("names") {
type = UserPage_NamesNavType
},
)
fun getDestination(id: kotlin.Int, names: kotlin.collections.ArrayList<kotlin.String>, ): String {
return "UserPage?" +
"id=$id," +
"names=${Uri.encode(gson.toJson(names))}" +
""
}
val route = "UserPage?id={id},names={names}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment