Skip to content

Instantly share code, notes, and snippets.

@NewtronLabs
Created June 28, 2020 22:09
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 NewtronLabs/c9fab6579c9c7cf643de5dd75136b2a2 to your computer and use it in GitHub Desktop.
Save NewtronLabs/c9fab6579c9c7cf643de5dd75136b2a2 to your computer and use it in GitHub Desktop.
IpcEventBus-conclusion.kt
class EventExample : EventIpcSimple {
private var mData: IData? = null
constructor(data: IData?) {
mData = data
}
internal constructor(`in`: Parcel) {
readFromParcel(`in`)
}
override fun readFromParcel(parcel: Parcel) {
// Must be done for every object in the event.
mData =
ParcelHelper.getInstance().createFromParcel<IData>(parcel, IData::class.java) as IData
}
override fun writeToParcel(dest: Parcel, flags: Int) {
// Must be done for every object in the event.
ParcelHelper.getInstance().writeToParcel(dest, flags, mData)
}
val data: IData?
get() = mData
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment