diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/ListsScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/ListsScreen.kt index c28fee9..9f9a899 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/ListsScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/ListsScreen.kt @@ -685,8 +685,9 @@ private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) { modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.onPrimaryContainer, trackColor = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.22f), + wavelength = TodayWavelength, // A still wave when motion is reduced or the system removed animations (#157). - waveSpeed = if (rememberLoopingMotion()) WavyProgressIndicatorDefaults.CircularWavelength else 0.dp, + waveSpeed = if (rememberLoopingMotion()) TodayWavelength else 0.dp, ) Text(stringResource(R.string.progress_fraction_compact, done, total), style = MaterialTheme.typography.titleMedium) } @@ -695,6 +696,8 @@ private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) { } } +private val TodayWavelength = WavyProgressIndicatorDefaults.CircularWavelength + /** Overdue + All as a 2-up row of the existing tonal tiles. */ @Composable private fun SmartPairRow(counts: List, onOpenFilter: (TaskFilter) -> Unit) { diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/AppearanceScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/AppearanceScreen.kt index e4b3371..a877665 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/AppearanceScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/AppearanceScreen.kt @@ -2,13 +2,8 @@ package de.jeanlucmakiola.agendula.ui.settings import android.os.Build import android.text.format.DateFormat -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.selection.selectableGroup import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Add import androidx.compose.material.icons.rounded.Badge @@ -49,7 +44,6 @@ import de.jeanlucmakiola.floret.components.CollapsingScaffold import de.jeanlucmakiola.floret.components.ConnectedChoiceRow import de.jeanlucmakiola.floret.components.FullScreenPicker import de.jeanlucmakiola.floret.components.GroupedHint -import de.jeanlucmakiola.floret.components.GroupedListInset import de.jeanlucmakiola.floret.components.GroupedRow import de.jeanlucmakiola.floret.components.GroupedSectionHeader import de.jeanlucmakiola.floret.components.GroupedSwitchRow @@ -57,7 +51,7 @@ import de.jeanlucmakiola.floret.components.LauncherMark import de.jeanlucmakiola.floret.components.LauncherNameChooser import de.jeanlucmakiola.floret.components.OptionPicker import de.jeanlucmakiola.floret.components.Position -import de.jeanlucmakiola.floret.components.PreviewOptionCard +import de.jeanlucmakiola.floret.components.PreviewOptionRow import de.jeanlucmakiola.floret.locale.currentLocale import de.jeanlucmakiola.floret.prefs.ActionStyle import de.jeanlucmakiola.floret.prefs.LayoutDensity @@ -87,7 +81,7 @@ internal fun AppearanceScreen( predictiveBack = true, visible = visible, ) { - GroupedSectionHeader(stringResource(R.string.settings_theme)) + GroupedSectionHeader(stringResource(R.string.settings_group_colours)) GroupedRow( title = stringResource(R.string.settings_theme), summary = stringResource(themeLabel(state.settings.themeMode)), @@ -133,20 +127,13 @@ internal fun AppearanceScreen( Spacer(Modifier.height(8.dp)) GroupedSectionHeader(stringResource(R.string.settings_buttons)) - Row( - modifier = Modifier.fillMaxWidth().padding(horizontal = GroupedListInset).selectableGroup(), - horizontalArrangement = Arrangement.spacedBy(8.dp), - ) { - ActionStyle.entries.forEach { style -> - PreviewOptionCard( - label = stringResource(actionStyleLabel(style)), - selected = state.settings.actionStyle == style, - onClick = { viewModel.setActionStyle(style) }, - preview = { ActionStylePreview(PreviewActions, shaped = style == ActionStyle.SHAPES) }, - modifier = Modifier.weight(1f), - ) - } - } + PreviewOptionRow( + options = ActionStyle.entries, + selected = state.settings.actionStyle, + label = { stringResource(actionStyleLabel(it)) }, + onSelect = viewModel::setActionStyle, + preview = { ActionStylePreview(PreviewActions, shaped = it == ActionStyle.SHAPES) }, + ) Spacer(Modifier.height(8.dp)) GroupedSectionHeader(stringResource(R.string.settings_motion)) @@ -300,12 +287,13 @@ private fun actionStyleLabel(style: ActionStyle): Int = when (style) { } /** The home top bar's own actions, as the Buttons choice previews them. */ -private val PreviewActions: List> - get() = listOf( +private val PreviewActions: List> by lazy { + listOf( Icons.Rounded.Search to ActionShapes.Search, Icons.Rounded.Settings to ActionShapes.Settings, Icons.Rounded.Add to ActionShapes.AddList, ) +} private fun themeLabel(mode: ThemeMode): Int = when (mode) { ThemeMode.SYSTEM -> R.string.settings_theme_system diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a797d54..e9714b0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -535,6 +535,7 @@ Motion Reduce motion Stops looping animations like the progress wave. The system “Remove animations” setting always wins. + Colours Date & time Launcher Notifications diff --git a/app/src/test/java/de/jeanlucmakiola/agendula/data/prefs/AppearanceSettingsTest.kt b/app/src/test/java/de/jeanlucmakiola/agendula/data/prefs/AppearanceSettingsTest.kt index 1ae24a8..e4662a6 100644 --- a/app/src/test/java/de/jeanlucmakiola/agendula/data/prefs/AppearanceSettingsTest.kt +++ b/app/src/test/java/de/jeanlucmakiola/agendula/data/prefs/AppearanceSettingsTest.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking import org.junit.jupiter.api.Test -/** Density, button style and reduce motion: their defaults, and that a choice sticks. */ +/** Density, button style and reduce motion as [Settings] carries them; the stored keys are floret-kit's to test. */ class AppearanceSettingsTest { private class MemoryDataStore(initial: Preferences = emptyPreferences()) : DataStore { @@ -66,23 +66,4 @@ class AppearanceSettingsTest { assertThat(Triple(settings.density, settings.actionStyle, settings.reduceMotion)) .isEqualTo(Triple(LayoutDensity.COMPACT, ActionStyle.SHAPES, true)) } - - @Test - fun `the choices are stored under the keys floret-kit shares`() = runBlocking { - val dataStore = MemoryDataStore() - val prefs = prefs(dataStore) - - prefs.setDensity(LayoutDensity.COMPACT) - prefs.setActionStyle(ActionStyle.SHAPES) - prefs.setReduceMotion(true) - - val stored = dataStore.data.value - assertThat( - listOf( - stored[stringPreferencesKey("layout_density")], - stored[stringPreferencesKey("action_style")], - stored[booleanPreferencesKey("reduce_motion")], - ), - ).containsExactly("COMPACT", "SHAPES", true).inOrder() - } } diff --git a/floret-kit b/floret-kit index 3e7d342..4d9c014 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 3e7d342737d5265398fb6b618ed101979e87a334 +Subproject commit 4d9c014eff7dd42c7d3df3694d28ed9b46557851