Skip to content

Instantly share code, notes, and snippets.

@le0nidas
Created March 20, 2022 11:02
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 le0nidas/96e0206fff110b91a8e3f13ebe4e82ab to your computer and use it in GitHub Desktop.
Save le0nidas/96e0206fff110b91a8e3f13ebe4e82ab to your computer and use it in GitHub Desktop.
companion object : Parceler<Task> {
override fun create(parcel: Parcel): Task {
return Task(
parcel.readInt(),
Description(parcel.readString()!!),
Priority.valueOf(parcel.readString()!!),
parcel.readParcelable(Status::class.java.classLoader)!!,
parcel.readParcelable(Attachment::class.java.classLoader)
)
}
override fun Task.write(parcel: Parcel, flags: Int) {
with(parcel) {
writeInt(id)
writeString(description.value)
writeString(priority.name)
writeParcelable(status, flags)
writeParcelable(attachment, flags)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment