ShellPreferencesRepository

Where ShellSettings live.

ShellHost takes an implementation from the app, so an app that keeps its settings elsewhere adapts that store instead of keeping two, and tests pass an InMemoryShellPreferencesRepository. Without one, ShellHost uses ShellPreferencesRepository (context, defaults), a DataStore of its own.

An implementation provides settings and update; every setter below is written on update. A setting nobody chose reads as defaults.

Inheritors

Properties

Link copied to clipboard

The app's defaults: what a setting nobody chose reads as, and what resetDeveloperOptions returns to. The Toolkit's own defaults unless the app declared its own.

Link copied to clipboard

The settings last read in this process, if any, so an activity recreated by a rotation starts from them instead of waiting a frame for the store.

Link copied to clipboard
abstract val settings: Flow<ShellSettings>

The current settings, then every change.

Functions

Link copied to clipboard
open suspend fun resetDeveloperOptions()

Forgets every developer option, so the shell is again as the app declares it in defaults. Every ShellSettings value is a developer option; the person's own preferences live elsewhere and are not touched.

Link copied to clipboard
open suspend fun setAccessoryMode(value: AccessoryMode)
Link copied to clipboard
open suspend fun setAnimationSpeed(value: AnimationSpeed)
Link copied to clipboard
open suspend fun setBackEdgeStyle(value: BackEdgeStyle)
Link copied to clipboard
open suspend fun setEntranceReplay(value: EntranceReplay)
Link copied to clipboard
open suspend fun setEntranceStyle(value: EntranceStyle)
Link copied to clipboard
open suspend fun setHideBottomBarOnScroll(value: Boolean)
Link copied to clipboard
open suspend fun setHideTopBarOnScroll(value: Boolean)
Link copied to clipboard
open suspend fun setLayoutMode(value: ShellLayoutMode)
Link copied to clipboard
open suspend fun setLimitContentWidth(value: Boolean)
Link copied to clipboard
open suspend fun setMotionTempo(value: MotionTempo)
Link copied to clipboard
open suspend fun setNavigationBarStyle(value: NavigationBarStyle)
Link copied to clipboard
open suspend fun setNavigationTint(value: NavigationTint)
Link copied to clipboard
open suspend fun setStartOverride(value: Int)
Link copied to clipboard
open suspend fun setTabTransition(value: TabTransitionStyle)
Link copied to clipboard
open suspend fun setTopBarOverride(value: TopBarOverride)
Link copied to clipboard
abstract suspend fun update(transform: (ShellSettings) -> ShellSettings)

Replaces the settings with transform applied to the current ones, atomically.