feat(ui): complete app experience redesign

This commit is contained in:
2026-08-27 11:45:30 +08:00
parent 816606234b
commit 54aa74126f
70 changed files with 4510 additions and 985 deletions
@@ -64,6 +64,16 @@ class DataStoreUiPreferencesRepository internal constructor(
navigationPresentation = preferences[NAVIGATION]?.enumOrDefault(NavigationPresentation.STANDARD)
?: NavigationPresentation.STANDARD,
hapticsEnabled = preferences[HAPTICS] ?: true,
interfaceScale = preferences[INTERFACE_SCALE]?.enumOrDefault(InterfaceScale.STANDARD)
?: InterfaceScale.STANDARD,
accentPreference = preferences[ACCENT]?.enumOrDefault(AccentPreference.BLUE)
?: AccentPreference.BLUE,
colorStyle = preferences[COLOR_STYLE]?.enumOrDefault(ColorStyle.TONAL_SPOT)
?: ColorStyle.TONAL_SPOT,
colorStandard = preferences[COLOR_STANDARD]?.enumOrDefault(ColorStandard.SPEC_2021)
?: ColorStandard.SPEC_2021,
liquidGlassEnabled = preferences[LIQUID_GLASS] ?: false,
predictiveBackEnabled = preferences[PREDICTIVE_BACK] ?: false,
)
private fun MutablePreferences.putAll(preferences: UiPreferences) {
@@ -73,6 +83,12 @@ class DataStoreUiPreferencesRepository internal constructor(
this[BLUR] = preferences.blurEnabled
this[NAVIGATION] = preferences.navigationPresentation.name
this[HAPTICS] = preferences.hapticsEnabled
this[INTERFACE_SCALE] = preferences.interfaceScale.name
this[ACCENT] = preferences.accentPreference.name
this[COLOR_STYLE] = preferences.colorStyle.name
this[COLOR_STANDARD] = preferences.colorStandard.name
this[LIQUID_GLASS] = preferences.liquidGlassEnabled
this[PREDICTIVE_BACK] = preferences.predictiveBackEnabled
}
private inline fun <reified T : Enum<T>> String.enumOrDefault(default: T): T =
@@ -89,5 +105,11 @@ class DataStoreUiPreferencesRepository internal constructor(
val BLUR = booleanPreferencesKey("blur")
val NAVIGATION = stringPreferencesKey("navigation")
val HAPTICS = booleanPreferencesKey("haptics")
val INTERFACE_SCALE = stringPreferencesKey("interface_scale")
val ACCENT = stringPreferencesKey("accent")
val COLOR_STYLE = stringPreferencesKey("color_style")
val COLOR_STANDARD = stringPreferencesKey("color_standard")
val LIQUID_GLASS = booleanPreferencesKey("liquid_glass")
val PREDICTIVE_BACK = booleanPreferencesKey("predictive_back")
}
}
@@ -16,6 +16,31 @@ enum class NavigationPresentation {
FLOATING,
}
enum class InterfaceScale(val percent: Int) {
COMPACT(85),
STANDARD(100),
LARGE(115),
}
enum class AccentPreference {
BLUE,
GREEN,
AMBER,
ROSE,
VIOLET,
}
enum class ColorStyle {
TONAL_SPOT,
EXPRESSIVE,
FIDELITY,
}
enum class ColorStandard {
SPEC_2021,
SPEC_2025,
}
enum class PreferenceField {
RENDERER,
THEME_MODE,
@@ -23,6 +48,12 @@ enum class PreferenceField {
BLUR,
NAVIGATION,
HAPTICS,
INTERFACE_SCALE,
ACCENT,
COLOR_STYLE,
COLOR_STANDARD,
LIQUID_GLASS,
PREDICTIVE_BACK,
}
data class UiPreferences(
@@ -32,4 +63,10 @@ data class UiPreferences(
val blurEnabled: Boolean = false,
val navigationPresentation: NavigationPresentation = NavigationPresentation.STANDARD,
val hapticsEnabled: Boolean = true,
val interfaceScale: InterfaceScale = InterfaceScale.STANDARD,
val accentPreference: AccentPreference = AccentPreference.BLUE,
val colorStyle: ColorStyle = ColorStyle.TONAL_SPOT,
val colorStandard: ColorStandard = ColorStandard.SPEC_2021,
val liquidGlassEnabled: Boolean = false,
val predictiveBackEnabled: Boolean = false,
)
@@ -45,6 +45,24 @@ class DataStoreUiPreferencesRepositoryTest {
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(hapticsEnabled = false)
})
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(interfaceScale = InterfaceScale.LARGE)
})
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(accentPreference = AccentPreference.GREEN)
})
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(colorStyle = ColorStyle.EXPRESSIVE)
})
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(colorStandard = ColorStandard.SPEC_2025)
})
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(liquidGlassEnabled = true)
})
assertEquals(UiPreferencesWriteResult.Success, repository.update {
it.copy(predictiveBackEnabled = false)
})
assertEquals(
UiPreferences(
@@ -54,6 +72,12 @@ class DataStoreUiPreferencesRepositoryTest {
blurEnabled = true,
navigationPresentation = NavigationPresentation.FLOATING,
hapticsEnabled = false,
interfaceScale = InterfaceScale.LARGE,
accentPreference = AccentPreference.GREEN,
colorStyle = ColorStyle.EXPRESSIVE,
colorStandard = ColorStandard.SPEC_2025,
liquidGlassEnabled = true,
predictiveBackEnabled = false,
),
repository.observe().first(),
)