Releases: wada811/ViewModel-SavedState-ktx
Releases · wada811/ViewModel-SavedState-ktx
3.0.0: Fix package and publish to MavenCentral
2.3.0
What's Changed
Full Changelog: 2.2.0...2.3.0
2.3.0-rc01
2.3.0-beta01
Bug Fix
- 917ec36 Fix setting default value using SavedStateAdapter
Library Updates
- Lifecycle-ViewModel-SavedState 2.3.0-beta01
2.3.0-alpha01
API changes
- none
Behavior Changes
- #4 only set the initial value when SavedStateHandle does not contain the key
Library Updates
- Lifecycle-ViewModel-SavedState 2.3.0-alpha01
2.2.0
API changes
- A way of using SavedStateHandle
- Deprecated delegated property methods of
SavedStateViewModel
andSavedStateAndroidViewModel
- Add SavedStateHandle's extension methods
- Deprecated delegated property methods of
- Enum and custom type support
- Deprecated extension methods of
Intent
andBundle
- Add
SavedStateAdapter
- Deprecated extension methods of
Other changes
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0
1.0.0-beta01
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")