Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Last active December 3, 2021 07:32
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/85686df2f8a739a722dc8f1114b00ffa to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/85686df2f8a739a722dc8f1114b00ffa to your computer and use it in GitHub Desktop.
file addLine "override fun get(bundle: Bundle, key: String): "
addVariableType(file, propertyInfo)
file addPhrase "? {"
tabs++
when (propertyInfo.composeArgumentType) {
ComposeArgumentType.PARCELABLE -> file addLine "return bundle.getParcelable(key)"
ComposeArgumentType.PARCELABLE_ARRAY -> file addLine "return bundle.getParcelableArrayList(key)"
ComposeArgumentType.SERIALIZABLE -> {
file addLine "return bundle.getSerializable(key) as? "
addVariableType(file, propertyInfo)
}
}
tabs--
file addLine "}"
file addLine "override fun put(bundle: Bundle, key: String, value: "
addVariableType(file, propertyInfo)
file addPhrase ") {"
tabs++
when (propertyInfo.composeArgumentType) {
ComposeArgumentType.PARCELABLE -> file addLine "bundle.putParcelable(key, value)"
ComposeArgumentType.PARCELABLE_ARRAY -> file addLine "bundle.putParcelableArrayList(key, value)"
ComposeArgumentType.SERIALIZABLE -> file addLine "bundle.putSerializable(key, value)"
}
tabs--
file addLine "}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment