I am using motion layout in my mainactivity. It is working proplerly. However when I move to other activities and navigate back to my mainactivity sometimes the activity is
class ExtMotionLayout : MotionLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
override fun onSaveInstanceState(): Parcelable? {
return SavedState(progress, super.onSaveInstanceState())
}
override fun onRestoreInstanceState(state: Parcelable?) {
if (state is SavedState) {
progress = state.progress
super.onRestoreInstanceState(state.superState)
} else super.onRestoreInstanceState(state)
}
class SavedState : BaseSavedState {
val progress: Float
constructor(progress: Float, source: Parcelable?) : super(source) {
this.progress = progress
}
constructor(superState: Parcel) : super(superState) {
progress = superState.readFloat()
}
override fun writeToParcel(out: Parcel, flags: Int) {
super.writeToParcel(out, flags)
out.writeFloat(progress)
}
}
}