SavedStateRegistryController



An API for SavedStateRegistryOwner implementations to control SavedStateRegistry.

A SavedStateRegistryOwner should call performRestore to restore the state of the SavedStateRegistry, and performSave to gather the saved state from it.

Summary

Public functions

Unit

Performs the initial, one-time attachment necessary to configure this SavedStateRegistry.

Cmn
Unit

Restores the saved state for the owner of this SavedStateRegistry.

Cmn
Unit

Saves the state for the owner of this SavedStateRegistry.

Cmn

Public properties

SavedStateRegistry

The SavedStateRegistry controlled by this controller.

Cmn

Public companion functions

create

fun create(owner: SavedStateRegistryOwner): SavedStateRegistryController

Creates a SavedStateRegistryController.

Call this during construction of the SavedStateRegistryOwner.

Public functions

performAttach

@MainThread
fun performAttach(): Unit

Performs the initial, one-time attachment necessary to configure this SavedStateRegistry.

Call this when the owner's Lifecycle is Lifecycle.State.INITIALIZED and before calling performRestore.

performRestore

@MainThread
fun performRestore(savedState: SavedState?): Unit

Restores the saved state for the owner of this SavedStateRegistry.

Parameters
savedState: SavedState?

The restored state.

performSave

@MainThread
fun performSave(outBundle: SavedState): Unit

Saves the state for the owner of this SavedStateRegistry.

This calls all registered providers and merges their states with the unconsumed state.

Parameters
outBundle: SavedState

The SavedState in which to place the saved state.

Public properties

savedStateRegistry

val savedStateRegistrySavedStateRegistry

The SavedStateRegistry controlled by this controller.