Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Created May 10, 2020 10:39
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 akexorcist/cf20c0e2d9ee1d93df28b6f082d1559e to your computer and use it in GitHub Desktop.
Save akexorcist/cf20c0e2d9ee1d93df28b6f082d1559e to your computer and use it in GitHub Desktop.
Using AbsSavedState instead of BaseSavedState in derived class to support inherited custom view
class RegularPostView : BasePostView {
...
internal class SavedState : AbsSavedState {
var dividerColorResId: Int = 0
constructor(superState: Parcelable) : super(superState)
constructor(source: Parcel, loader: ClassLoader?) : super(source, loader) {
dividerColorResId = source.readInt()
}
override fun writeToParcel(out: Parcel, flags: Int) {
super.writeToParcel(out, flags)
out.writeInt(dividerColorResId)
}
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment