Created
May 10, 2020 10:39
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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