Last active
May 10, 2020 10:48
-
-
Save akexorcist/e8dc10c0e51ed86bb84a26a19ef7eaf0 to your computer and use it in GitHub Desktop.
Using AbsSavedState instead of BaseSavedState in base 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
abstract class BasePostView : FrameLayout { | |
... | |
internal class SavedState : AbsSavedState { | |
var title: String? = null | |
var description: String? = null | |
constructor(superState: Parcelable) : super(superState) | |
constructor(source: Parcel, loader: ClassLoader?) : super(source, loader) { | |
title = source.readString() | |
description = source.readString() | |
} | |
override fun writeToParcel(out: Parcel, flags: Int) { | |
super.writeToParcel(out, flags) | |
out.writeString(title) | |
out.writeString(description) | |
} | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment