Skip to content

Instantly share code, notes, and snippets.

@fornewid
Created March 10, 2019 06:42
Show Gist options
  • Save fornewid/e2c5772c26913ea25b6291869614aa30 to your computer and use it in GitHub Desktop.
Save fornewid/e2c5772c26913ea25b6291869614aa30 to your computer and use it in GitHub Desktop.
Navigation 훑어보기_1
// Generated by Navigation Architecture Components.
class SecondFragmentDirections private constructor() {
private data class ActionToThird(val label: String?) : NavDirections {
override fun getActionId(): Int = R.id.action_to_third
@Suppress("CAST_NEVER_SUCCEEDS")
override fun getArguments(): Bundle {
val result = Bundle()
if (Parcelable::class.java.isAssignableFrom(String::class.java)) {
result.putParcelable("label", this.label as Parcelable?)
} else if (Serializable::class.java.isAssignableFrom(String::class.java)) {
result.putSerializable("label", this.label as Serializable?)
} else {
throw UnsupportedOperationException(String::class.java.name +" 생략.")
}
return result
}
}
companion object {
fun actionToThird(label: String?): NavDirections =
ActionToThird(label)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment