Slide 30
Slide 30 text
Saving instance state
private sealed class BaseInstanceStateProperty(
private val defaultValue: T
) : ReadWriteProperty, InstanceStateProperty {
private var value = defaultValue
final override fun getValue(thisRef: Activity, property: KProperty<*>): T {
initializeValue(thisRef, property)
return value
}
final override fun setValue(thisRef: Activity, property: KProperty<*>, value: T) {
initializeValue(thisRef, property)
this.value = value
}
}