Skip to content

1.0.0-beta01

Compare
Choose a tag to compare
@wada811 wada811 released this 12 Oct 14:45
· 109 commits to master since this release
8fd07f0

Library version update

  • androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-beta01

Feature update

  • support enum
  • support custom delegate

Support enum

Intent

intent.putExtraEnum("key", YourEnum.ENUM_VALUE)

Bundle

bundle.putEnum("key", YourEnum.ENUM_VALUE)

ViewModel

Property

var yourEnum: YourEnum by savedStateProperty("key")

LiveData

val yourEnum: MutableLiveData<YourEnum> by savedStateLiveData("key")

Support custom delegate

Property

var yourClass: YourClass by savedStateProperty<String, YourClass>({ Json.parse(YourClass.serializer(), it) }, { Json.stringify(YourClass.serializer(), it) }, "key")

LiveData

val yourClass: MutableLiveData<YourClass> by savedStateLiveData<String, YourClass>({ Json.parse(YourClass.serializer(), it) }, { Json.stringify(YourClass.serializer(), it) }, "key")