From a94ad7560a8440daa4fc0d90bc2b0f0735f1a24f Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:16:34 +0100 Subject: [PATCH 01/13] Store density, button style and reduce motion in floret-kit's appearance prefs (#118, #157) --- app/build.gradle.kts | 1 + .../jeanlucmakiola/agendula/MainActivity.kt | 5 ++ .../agendula/data/prefs/SettingsPrefs.kt | 17 ++++ ...{ShapedActionButton.kt => ActionShapes.kt} | 0 .../agendula/ui/settings/SettingsViewModel.kt | 5 ++ .../jeanlucmakiola/agendula/ui/theme/Theme.kt | 6 ++ .../widget/TaskWidgetConfigActivity.kt | 5 ++ .../data/prefs/AppearanceSettingsTest.kt | 88 +++++++++++++++++++ floret-kit | 2 +- gradle/libs.versions.toml | 1 + 10 files changed, 129 insertions(+), 1 deletion(-) rename app/src/main/java/de/jeanlucmakiola/agendula/ui/common/{ShapedActionButton.kt => ActionShapes.kt} (100%) create mode 100644 app/src/test/java/de/jeanlucmakiola/agendula/data/prefs/AppearanceSettingsTest.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index cc3a000..d5bb8e2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -259,6 +259,7 @@ dependencies { implementation(libs.floret.core.reminders) implementation(libs.floret.core.locale) implementation(libs.floret.core.crash) + implementation(libs.floret.core.prefs) implementation(libs.floret.identity) implementation(libs.floret.components) implementation(libs.floret.glance) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt b/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt index cc3aff0..6809646 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt @@ -39,6 +39,8 @@ import de.jeanlucmakiola.agendula.ui.theme.SystemTheme import de.jeanlucmakiola.floret.crash.CrashReportDialog import de.jeanlucmakiola.floret.crash.CrashReporter import de.jeanlucmakiola.floret.crash.submitCrashReport +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.LayoutDensity import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch @@ -109,6 +111,9 @@ class MainActivity : ComponentActivity() { darkTheme = darkTheme, dynamicColor = ui.settings.dynamicColor, pureBlack = ui.settings.themeMode.isPureBlack, + compactLayout = ui.settings.density == LayoutDensity.COMPACT, + shapedActions = ui.settings.actionStyle == ActionStyle.SHAPES, + reduceMotion = ui.settings.reduceMotion, ) { CompositionLocalProvider( LocalUse24HourFormat provides use24Hour, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt b/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt index e505b46..ebdbada 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt @@ -32,6 +32,11 @@ import de.jeanlucmakiola.agendula.domain.TaskSortOrder import de.jeanlucmakiola.agendula.domain.SmartList import de.jeanlucmakiola.agendula.domain.UpcomingRange import de.jeanlucmakiola.agendula.domain.withinUpcoming +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.AppearancePrefs +import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.get +import de.jeanlucmakiola.floret.prefs.set import de.jeanlucmakiola.floret.reminders.ReminderLead import de.jeanlucmakiola.floret.reminders.ReminderOverride import de.jeanlucmakiola.floret.reminders.ReminderOverrideCodec @@ -100,6 +105,12 @@ const val DEFAULT_ALL_DAY_REMINDER_MINUTE = 9 * 60 data class Settings( val themeMode: ThemeMode = ThemeMode.SYSTEM, val dynamicColor: Boolean = true, + /** How tightly rows and tiles pack. */ + val density: LayoutDensity = LayoutDensity.COMFORTABLE, + /** Plain icons or expressive shapes for header and top-bar actions (#118). */ + val actionStyle: ActionStyle = ActionStyle.ICONS, + /** Stops looping animations; the system "Remove animations" does so regardless (#157). */ + val reduceMotion: Boolean = false, /** The list a new task defaults to; `null` = first available. */ val defaultListId: Long? = null, /** Default reminders (0 before due = at due time); empty = none. */ @@ -280,6 +291,9 @@ class SettingsPrefs @Inject constructor( themeMode = p[THEME_MODE]?.let { runCatching { ThemeMode.valueOf(it) }.getOrNull() } ?: ThemeMode.SYSTEM, dynamicColor = p[DYNAMIC_COLOR] ?: true, + density = p[AppearancePrefs.density], + actionStyle = p[AppearancePrefs.actionStyle], + reduceMotion = p[AppearancePrefs.reduceMotion], defaultListId = p[DEFAULT_LIST_ID]?.takeIf { it > 0 }, // The single lead of earlier versions carries over until a list is saved. defaultReminders = p[DEFAULT_REMINDERS]?.let(::parseLeads) @@ -442,6 +456,9 @@ class SettingsPrefs @Inject constructor( suspend fun setThemeMode(mode: ThemeMode) = dataStore.edit { it[THEME_MODE] = mode.name } suspend fun setDynamicColor(enabled: Boolean) = dataStore.edit { it[DYNAMIC_COLOR] = enabled } + suspend fun setDensity(density: LayoutDensity) = dataStore.edit { it[AppearancePrefs.density] = density } + suspend fun setActionStyle(style: ActionStyle) = dataStore.edit { it[AppearancePrefs.actionStyle] = style } + suspend fun setReduceMotion(enabled: Boolean) = dataStore.edit { it[AppearancePrefs.reduceMotion] = enabled } suspend fun setDefaultListId(id: Long?) = dataStore.edit { if (id == null) it.remove(DEFAULT_LIST_ID) else it[DEFAULT_LIST_ID] = id } diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ShapedActionButton.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt similarity index 100% rename from app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ShapedActionButton.kt rename to app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt index 6c697f9..4ced0fc 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt @@ -28,6 +28,8 @@ import de.jeanlucmakiola.agendula.domain.DefaultDueDate import de.jeanlucmakiola.agendula.domain.DefaultStartDate import de.jeanlucmakiola.agendula.domain.TaskFormField import de.jeanlucmakiola.agendula.domain.TaskList +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.LayoutDensity import de.jeanlucmakiola.floret.reminders.ReminderLead import de.jeanlucmakiola.floret.reminders.ReminderOverride import kotlinx.coroutines.CoroutineDispatcher @@ -242,6 +244,9 @@ class SettingsViewModel @Inject constructor( fun setThemeMode(mode: ThemeMode) = viewModelScope.launch { prefs.setThemeMode(mode) } fun setDynamicColor(enabled: Boolean) = viewModelScope.launch { prefs.setDynamicColor(enabled) } + fun setDensity(density: LayoutDensity) = viewModelScope.launch { prefs.setDensity(density) } + fun setActionStyle(style: ActionStyle) = viewModelScope.launch { prefs.setActionStyle(style) } + fun setReduceMotion(enabled: Boolean) = viewModelScope.launch { prefs.setReduceMotion(enabled) } fun setDefaultList(id: Long?) = viewModelScope.launch { prefs.setDefaultListId(id) } fun setDefaultReminders(leads: List) = viewModelScope.launch { prefs.setDefaultReminders(leads) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt index 6e02f5f..3addeca 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt @@ -16,6 +16,9 @@ fun AgendulaTheme( darkTheme: Boolean = isSystemInDarkTheme(), dynamicColor: Boolean = true, pureBlack: Boolean = false, + compactLayout: Boolean = false, + shapedActions: Boolean = false, + reduceMotion: Boolean = false, content: @Composable () -> Unit, ) { FloretExpressiveTheme( @@ -25,6 +28,9 @@ fun AgendulaTheme( dynamicColor = dynamicColor, pureBlack = pureBlack, typography = AgendulaTypography, + compactLayout = compactLayout, + shapedActions = shapedActions, + reduceMotion = reduceMotion, content = content, ) } diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt b/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt index 504720c..373e760 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt @@ -55,6 +55,8 @@ import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.floret.glance.WidgetBackground import de.jeanlucmakiola.floret.glance.WidgetThemeMode +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.LayoutDensity import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.launch @@ -139,6 +141,9 @@ class TaskWidgetConfigActivity : ComponentActivity() { darkTheme = dark, dynamicColor = settings.dynamicColor, pureBlack = settings.themeMode.isPureBlack, + compactLayout = settings.density == LayoutDensity.COMPACT, + shapedActions = settings.actionStyle == ActionStyle.SHAPES, + reduceMotion = settings.reduceMotion, ) { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.surface) {} WidgetFilterPicker( 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 new file mode 100644 index 0000000..1ae24a8 --- /dev/null +++ b/app/src/test/java/de/jeanlucmakiola/agendula/data/prefs/AppearanceSettingsTest.kt @@ -0,0 +1,88 @@ +package de.jeanlucmakiola.agendula.data.prefs + +import androidx.datastore.core.DataStore +import androidx.datastore.preferences.core.Preferences +import androidx.datastore.preferences.core.booleanPreferencesKey +import androidx.datastore.preferences.core.emptyPreferences +import androidx.datastore.preferences.core.mutablePreferencesOf +import androidx.datastore.preferences.core.stringPreferencesKey +import com.google.common.truth.Truth.assertThat +import de.jeanlucmakiola.agendula.data.tasks.ProviderEnvironment +import de.jeanlucmakiola.agendula.data.tasks.ProviderResolver +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.LayoutDensity +import kotlinx.coroutines.flow.MutableStateFlow +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. */ +class AppearanceSettingsTest { + + private class MemoryDataStore(initial: Preferences = emptyPreferences()) : DataStore { + override val data = MutableStateFlow(initial) + override suspend fun updateData(transform: suspend (t: Preferences) -> Preferences) = + transform(data.value).also { data.value = it } + } + + private object NoProviders : ProviderEnvironment { + override fun packageDeclaring(authority: String): String? = null + override fun isGranted(permission: String) = false + override fun appLabel(packageName: String): String? = null + } + + private fun prefs(dataStore: DataStore = MemoryDataStore()) = + SettingsPrefs(dataStore, ProviderResolver(NoProviders)) + + @Test + fun `a fresh install is comfortable, icons only, with motion on`() = runBlocking { + val settings = prefs().settings.first() + + assertThat(Triple(settings.density, settings.actionStyle, settings.reduceMotion)) + .isEqualTo(Triple(LayoutDensity.COMFORTABLE, ActionStyle.ICONS, false)) + } + + @Test + fun `an existing install gets icons only too`() = runBlocking { + val upgraded = MemoryDataStore( + mutablePreferencesOf( + stringPreferencesKey("theme_mode") to "DARK", + booleanPreferencesKey("dynamic_color") to false, + ), + ) + + assertThat(prefs(upgraded).settings.first().actionStyle).isEqualTo(ActionStyle.ICONS) + } + + @Test + fun `the choices are kept`() = runBlocking { + val prefs = prefs() + + prefs.setDensity(LayoutDensity.COMPACT) + prefs.setActionStyle(ActionStyle.SHAPES) + prefs.setReduceMotion(true) + + val settings = prefs.settings.first() + 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 0c8f536..3e7d342 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 0c8f5367f5d4e2e611cc6d4e9761e4b41428dd02 +Subproject commit 3e7d342737d5265398fb6b618ed101979e87a334 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 92afa2b..f910a54 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -174,6 +174,7 @@ floret-core-time = { group = "de.jeanlucmakiola.floret", name = "core-time" } floret-core-reminders = { group = "de.jeanlucmakiola.floret", name = "core-reminders" } floret-core-locale = { group = "de.jeanlucmakiola.floret", name = "core-locale" } floret-core-crash = { group = "de.jeanlucmakiola.floret", name = "core-crash" } +floret-core-prefs = { group = "de.jeanlucmakiola.floret", name = "core-prefs" } floret-identity = { group = "de.jeanlucmakiola.floret", name = "identity" } floret-components = { group = "de.jeanlucmakiola.floret", name = "components" } floret-glance = { group = "de.jeanlucmakiola.floret", name = "glance" } From aeaa17535880ec724dd9e8dd67178d3c57bb2813 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:16:34 +0100 Subject: [PATCH 02/13] Home actions follow the button style, plain icons by default (#118) --- .../agendula/ui/common/ActionShapes.kt | 176 +----------------- .../agendula/ui/lists/ListsScreen.kt | 8 +- 2 files changed, 7 insertions(+), 177 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt index 779e37a..8734939 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt @@ -1,184 +1,14 @@ package de.jeanlucmakiola.agendula.ui.common -import androidx.compose.animation.core.Spring -import androidx.compose.animation.core.animateFloatAsState -import androidx.compose.animation.core.spring -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.interaction.collectIsPressedAsState -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.size import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi -import androidx.compose.material3.Icon import androidx.compose.material3.MaterialShapes -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Surface -import androidx.compose.material3.toPath -import androidx.compose.material3.toShape -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.rotate -import androidx.compose.ui.draw.scale -import androidx.compose.ui.geometry.Size -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.Matrix -import androidx.compose.ui.graphics.Outline -import androidx.compose.ui.graphics.Path -import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.unit.Density -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.LayoutDirection -import androidx.compose.ui.unit.dp -import androidx.graphics.shapes.Morph import androidx.graphics.shapes.RoundedPolygon -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch - -/** - * A top-bar action whose icon sits in a tonal container clipped to one of the - * M3 Expressive [MaterialShapes] (cookie, clover, sunny, …) — Agendula's playful - * take on a plain [androidx.compose.material3.IconButton]. Each action passes - * its own [shape] and [containerColor], so a row of them reads as a set of - * distinct little tokens rather than identical grey glyphs. - * - * Pressing springs the whole shape down and gives it a turn — the scalloped - * container is what dips and spins, while the glyph inside stays upright (a - * spinning magnifier or list icon would just read as wrong). [spinIcon] opts a - * glyph into turning too, for icons that read well mid-spin like the gear. - * - * With [morphTo] set the press is a different gesture altogether: no turn and no - * dip — the container morphs into [morphTo] and pops slightly larger on a bouncy - * spring, for an action that should not feel like its neighbours. A tap holds - * the popped state for a beat before [onClick] fires, so the gesture is seen. - */ -@OptIn(ExperimentalMaterial3ExpressiveApi::class) -@Composable -fun ShapedActionButton( - shape: RoundedPolygon, - icon: ImageVector, - contentDescription: String?, - onClick: () -> Unit, - modifier: Modifier = Modifier, - containerColor: Color = MaterialTheme.colorScheme.tertiaryContainer, - contentColor: Color = MaterialTheme.colorScheme.onTertiaryContainer, - size: Dp = 40.dp, - iconSize: Dp = 22.dp, - spinIcon: Boolean = false, - morphTo: RoundedPolygon? = null, -) { - val interaction = remember { MutableInteractionSource() } - val pressed by interaction.collectIsPressedAsState() - if (morphTo != null) { - MorphPopButton(shape, morphTo, icon, contentDescription, onClick, modifier, containerColor, contentColor, size, iconSize, interaction, pressed) - return - } - // The shape (the scalloped cookie) turns and dips on press. - val shapeRotation by animateFloatAsState(if (pressed) 40f else 0f, label = "shapeRotation") - val scale by animateFloatAsState(if (pressed) 0.82f else 1f, label = "shapeScale") - // The glyph's *net* turn: 0 keeps it upright, spinIcon gives it a quarter turn. - val iconRotation by animateFloatAsState( - if (pressed && spinIcon) 90f else 0f, - label = "iconRotation", - ) - - Surface( - onClick = onClick, - modifier = modifier - .size(size) - .scale(scale) - .rotate(shapeRotation), - shape = shape.toShape(), - color = containerColor, - contentColor = contentColor, - interactionSource = interaction, - ) { - Box(contentAlignment = Alignment.Center) { - Icon( - imageVector = icon, - contentDescription = contentDescription, - // Counter the container's turn so the glyph's net rotation is just - // [iconRotation] — upright by default, a quarter turn for the gear. - modifier = Modifier - .size(iconSize) - .rotate(iconRotation - shapeRotation), - ) - } - } -} - -@Composable -private fun MorphPopButton( - shape: RoundedPolygon, - morphTo: RoundedPolygon, - icon: ImageVector, - contentDescription: String?, - onClick: () -> Unit, - modifier: Modifier, - containerColor: Color, - contentColor: Color, - size: Dp, - iconSize: Dp, - interaction: MutableInteractionSource, - pressed: Boolean, -) { - val morph = remember(shape, morphTo) { Morph(shape, morphTo) } - val scope = rememberCoroutineScope() - var firing by remember { mutableStateOf(false) } - val popped = pressed || firing - val bouncy = spring(dampingRatio = Spring.DampingRatioMediumBouncy, stiffness = Spring.StiffnessMedium) - val progress by animateFloatAsState(if (popped) 1f else 0f, bouncy, label = "morphProgress") - val scale by animateFloatAsState(if (popped) 1.12f else 1f, bouncy, label = "popScale") - val iconScale by animateFloatAsState(if (popped) 1.2f else 1f, bouncy, label = "iconScale") - - Surface( - onClick = { - if (!firing) { - firing = true - scope.launch { - delay(MorphClickDelayMs) - onClick() - firing = false - } - } - }, - modifier = modifier.size(size).scale(scale), - shape = remember(morph, progress) { MorphShape(morph, progress) }, - color = containerColor, - contentColor = contentColor, - interactionSource = interaction, - ) { - Box(contentAlignment = Alignment.Center) { - Icon( - imageVector = icon, - contentDescription = contentDescription, - modifier = Modifier.size(iconSize).scale(iconScale), - ) - } - } -} - -private const val MorphClickDelayMs = 160L - -/** [morph] at [progress], scaled from the shapes' unit square to the component. */ -@OptIn(ExperimentalMaterial3ExpressiveApi::class) -private class MorphShape(private val morph: Morph, private val progress: Float) : Shape { - override fun createOutline(size: Size, layoutDirection: LayoutDirection, density: Density): Outline { - val path = morph.toPath(progress.coerceIn(0f, 1f), Path()) - path.transform(Matrix().apply { scale(size.width, size.height) }) - return Outline.Generic(path) - } -} /** * Named shapes for the app's top-bar actions, so each action is recognisably - * "its own" and new actions just pick the next unused shape. Expose the - * expressive [MaterialShapes] through a single opt-in site. + * "its own" when the expressive button style is on, and new actions just pick + * the next unused shape. Expose the expressive [MaterialShapes] through a + * single opt-in site. */ @OptIn(ExperimentalMaterial3ExpressiveApi::class) object ActionShapes { 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 00982d9..3b0499a 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 @@ -89,6 +89,7 @@ import de.jeanlucmakiola.agendula.domain.Task import de.jeanlucmakiola.agendula.domain.TaskSearch import de.jeanlucmakiola.agendula.domain.TaskFilter import de.jeanlucmakiola.agendula.ui.common.ActionShapes +import de.jeanlucmakiola.floret.components.ActionButton import de.jeanlucmakiola.floret.components.GroupedRow import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.floret.components.SnackChip @@ -98,7 +99,6 @@ import kotlinx.coroutines.delay import de.jeanlucmakiola.agendula.ui.common.ListColorChip import de.jeanlucmakiola.agendula.ui.common.LocalUse24HourFormat import de.jeanlucmakiola.agendula.ui.common.SearchPill -import de.jeanlucmakiola.agendula.ui.common.ShapedActionButton import de.jeanlucmakiola.agendula.ui.common.SyncPullBox import de.jeanlucmakiola.agendula.ui.common.priorityAccent import de.jeanlucmakiola.agendula.ui.tasklist.priorityLabel @@ -327,7 +327,7 @@ private fun ListsContent( ), ) } - ShapedActionButton( + ActionButton( shape = ActionShapes.AddList, morphTo = ActionShapes.AddListPressed, icon = Icons.Rounded.Add, @@ -531,7 +531,7 @@ private fun HomeTopBar( onToggleSearch = onToggleSearch, modifier = Modifier.weight(1f), ) - ShapedActionButton( + ActionButton( shape = ActionShapes.Settings, icon = Icons.Rounded.Settings, contentDescription = stringResource(R.string.settings_title), @@ -575,7 +575,7 @@ private fun SearchSlot( ) } // Always on top, at the end — the bar's fixed search icon and toggle. - ShapedActionButton( + ActionButton( shape = ActionShapes.Search, icon = Icons.Rounded.Search, contentDescription = stringResource(R.string.home_search_hint), From c65a252d1b292396cd3675010c93a6f8fad2a4db Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:16:34 +0100 Subject: [PATCH 03/13] Still Today wave when motion is reduced or animations are off (#157) --- .../java/de/jeanlucmakiola/agendula/ui/lists/ListsScreen.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 3b0499a..a72782b 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 @@ -62,6 +62,7 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.WavyProgressIndicatorDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -103,6 +104,7 @@ import de.jeanlucmakiola.agendula.ui.common.SyncPullBox import de.jeanlucmakiola.agendula.ui.common.priorityAccent import de.jeanlucmakiola.agendula.ui.tasklist.priorityLabel import de.jeanlucmakiola.floret.components.positionOf +import de.jeanlucmakiola.floret.identity.rememberLoopingMotion import de.jeanlucmakiola.floret.time.formatDateTimeCompact import java.time.LocalDate import java.time.ZoneId @@ -684,6 +686,8 @@ private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) { modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.onPrimaryContainer, trackColor = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.22f), + // A still wave when motion is reduced or the system removed animations (#157). + waveSpeed = if (rememberLoopingMotion()) WavyProgressIndicatorDefaults.CircularWavelength else 0.dp, ) Text(stringResource(R.string.progress_fraction_compact, done, total), style = MaterialTheme.typography.titleMedium) } From c4a313fe6906dfd078ea98b588d67d2b1e54f377 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:16:34 +0100 Subject: [PATCH 04/13] Compact density for task rows and home list rows --- .../jeanlucmakiola/agendula/ui/lists/ListsScreen.kt | 5 ++--- .../agendula/ui/tasklist/TaskListScreen.kt | 11 ++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) 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 a72782b..c28fee9 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 @@ -92,6 +92,7 @@ import de.jeanlucmakiola.agendula.domain.TaskFilter import de.jeanlucmakiola.agendula.ui.common.ActionShapes import de.jeanlucmakiola.floret.components.ActionButton import de.jeanlucmakiola.floret.components.GroupedRow +import de.jeanlucmakiola.floret.components.GroupedRowMinHeight import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.floret.components.SnackChip import de.jeanlucmakiola.floret.components.SnackChipHeight @@ -347,12 +348,11 @@ private fun ListsContent( items = group.lists, keyOf = { it.list.id }, onReorder = { ordered -> onReorder(ordered.map { it.list.id }) }, - rowHeight = 72.dp, + rowHeight = GroupedRowMinHeight, ) { overview, position, dragHandle, isDragging -> GroupedRow( title = overview.list.name, position = position, - minHeight = 72.dp, gapBelow = false, container = if (isDragging) MaterialTheme.colorScheme.secondaryContainer else null, leading = { ListColorChip(overview.list.color) }, @@ -374,7 +374,6 @@ private fun ListsContent( GroupedRow( title = overview.list.name, position = positionOf(index, group.lists.size), - minHeight = 72.dp, leading = { ListColorChip(overview.list.color) }, trailing = { if (overview.openCount > 0) { diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt index dfea1b5..1149e00 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt @@ -138,6 +138,7 @@ import de.jeanlucmakiola.floret.components.SnackChipMargin import de.jeanlucmakiola.floret.time.formatDateTimeCompact import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf +import de.jeanlucmakiola.floret.identity.byDensity import java.time.LocalDate import java.time.ZoneId @@ -833,8 +834,8 @@ internal fun TaskRowContent( Row( modifier = Modifier .fillMaxWidth() - .heightIn(min = 64.dp) - .padding(start = 12.dp, end = 16.dp, top = 8.dp, bottom = 8.dp), + .heightIn(min = byDensity(64.dp, 56.dp)) + .padding(start = 12.dp, end = 16.dp, top = byDensity(8.dp, 4.dp), bottom = byDensity(8.dp, 4.dp)), verticalAlignment = Alignment.CenterVertically, ) { // Calendula's signature accent: a slim pastelised colour bar for the @@ -1039,7 +1040,7 @@ private fun AddSubtaskRow( modifier = modifier.fillMaxWidth().padding(horizontal = 16.dp).then(gap).revealOnFocus(), ) { Row( - modifier = Modifier.fillMaxWidth().heightIn(min = 52.dp).padding(start = 12.dp, end = 8.dp), + modifier = Modifier.fillMaxWidth().heightIn(min = byDensity(52.dp, 48.dp)).padding(start = 12.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically, ) { Spacer(Modifier.width(5.dp)) // the parents' colour-bar slot, kept for alignment @@ -1183,8 +1184,8 @@ private fun SubtaskRow( Row( modifier = Modifier .fillMaxWidth() - .heightIn(min = 56.dp) - .padding(start = 12.dp, end = 16.dp, top = 6.dp, bottom = 6.dp), + .heightIn(min = byDensity(56.dp, 48.dp)) + .padding(start = 12.dp, end = 16.dp, top = byDensity(6.dp, 0.dp), bottom = byDensity(6.dp, 0.dp)), verticalAlignment = Alignment.CenterVertically, ) { // No colour bar — that absence (with the grouped nesting) marks the row From c103ea054899467d124bf4f70fadf480e15d696d Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:16:34 +0100 Subject: [PATCH 05/13] Appearance settings: density, buttons and reduce motion (#118, #157) --- .../agendula/ui/settings/AppearanceScreen.kt | 102 +++++++++++++++++- app/src/main/res/values/strings.xml | 12 +++ 2 files changed, 111 insertions(+), 3 deletions(-) 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 77680be..e4b3371 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,8 +2,25 @@ 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 +import androidx.compose.material.icons.rounded.Bolt +import androidx.compose.material.icons.rounded.CalendarViewWeek +import androidx.compose.material.icons.rounded.DarkMode +import androidx.compose.material.icons.rounded.Palette +import androidx.compose.material.icons.rounded.Schedule +import androidx.compose.material.icons.rounded.Search +import androidx.compose.material.icons.rounded.Settings +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -14,28 +31,40 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import androidx.graphics.shapes.RoundedPolygon import androidx.lifecycle.compose.collectAsStateWithLifecycle import de.jeanlucmakiola.agendula.R import de.jeanlucmakiola.agendula.data.appname.LauncherName import de.jeanlucmakiola.agendula.data.prefs.ThemeMode import de.jeanlucmakiola.agendula.data.prefs.TimeFormatPref import de.jeanlucmakiola.agendula.data.prefs.is24Hour +import de.jeanlucmakiola.agendula.ui.common.ActionShapes import de.jeanlucmakiola.agendula.ui.common.formatMinuteOfDay import de.jeanlucmakiola.agendula.ui.common.localeFirstDayOfWeek +import de.jeanlucmakiola.floret.components.ActionStylePreview 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 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.locale.currentLocale +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.LayoutDensity import java.time.DayOfWeek import java.time.format.TextStyle -/** How the app looks: the theme, wallpaper colours, and how times and weeks are written. */ +/** How the app looks: the theme, wallpaper colours, density, buttons, motion, and how times and weeks are written. */ @Composable internal fun AppearanceScreen( state: SettingsUiState, @@ -58,10 +87,12 @@ internal fun AppearanceScreen( predictiveBack = true, visible = visible, ) { + GroupedSectionHeader(stringResource(R.string.settings_theme)) GroupedRow( title = stringResource(R.string.settings_theme), summary = stringResource(themeLabel(state.settings.themeMode)), position = Position.Top, + leading = { Icon(Icons.Rounded.DarkMode, contentDescription = null) }, onClick = { showTheme = true }, ) GroupedRow( @@ -72,6 +103,7 @@ internal fun AppearanceScreen( stringResource(R.string.settings_dynamic_color_unavailable) }, position = Position.Bottom, + leading = { Icon(Icons.Rounded.Palette, contentDescription = null) }, trailing = { Switch( checked = state.settings.dynamicColor && dynamicColorAvailable, @@ -86,25 +118,71 @@ internal fun AppearanceScreen( }, ) - Spacer(Modifier.height(24.dp)) + Spacer(Modifier.height(8.dp)) + GroupedSectionHeader(stringResource(R.string.settings_density)) + ConnectedChoiceRow( + options = LayoutDensity.entries, + selected = state.settings.density, + label = { stringResource(densityLabel(it)) }, + onSelect = viewModel::setDensity, + ) + GroupedHint( + text = stringResource(R.string.settings_density_hint), + style = MaterialTheme.typography.bodySmall, + ) + + 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), + ) + } + } + + Spacer(Modifier.height(8.dp)) + GroupedSectionHeader(stringResource(R.string.settings_motion)) + GroupedSwitchRow( + title = stringResource(R.string.settings_reduce_motion), + summary = stringResource(R.string.settings_reduce_motion_hint), + checked = state.settings.reduceMotion, + onCheckedChange = viewModel::setReduceMotion, + position = Position.Alone, + leading = { Icon(Icons.Rounded.Bolt, contentDescription = null) }, + ) + + Spacer(Modifier.height(8.dp)) + GroupedSectionHeader(stringResource(R.string.settings_group_date_time)) GroupedRow( title = stringResource(R.string.settings_time_format), summary = timeFormatLabel(state.settings.timeFormat), position = Position.Top, + leading = { Icon(Icons.Rounded.Schedule, contentDescription = null) }, onClick = { showTimeFormat = true }, ) GroupedRow( title = stringResource(R.string.settings_week_start), summary = weekStartLabel(state.settings.weekStart), position = Position.Bottom, + leading = { Icon(Icons.Rounded.CalendarViewWeek, contentDescription = null) }, onClick = { showWeekStart = true }, ) - Spacer(Modifier.height(24.dp)) + Spacer(Modifier.height(8.dp)) + GroupedSectionHeader(stringResource(R.string.settings_group_launcher)) GroupedRow( title = stringResource(R.string.settings_app_name), summary = launcherNameLabel(launcherName), position = Position.Alone, + leading = { Icon(Icons.Rounded.Badge, contentDescription = null) }, onClick = { showAppName = true }, ) } @@ -211,6 +289,24 @@ private fun launcherNameLabel(name: LauncherName): String = stringResource( }, ) +private fun densityLabel(density: LayoutDensity): Int = when (density) { + LayoutDensity.COMFORTABLE -> R.string.settings_density_comfortable + LayoutDensity.COMPACT -> R.string.settings_density_compact +} + +private fun actionStyleLabel(style: ActionStyle): Int = when (style) { + ActionStyle.ICONS -> R.string.settings_buttons_icons + ActionStyle.SHAPES -> R.string.settings_buttons_shapes +} + +/** The home top bar's own actions, as the Buttons choice previews them. */ +private val PreviewActions: List> + get() = 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 ThemeMode.LIGHT -> R.string.settings_theme_light diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1d1c284..a797d54 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -525,6 +525,18 @@ Show Agendula as “Tasks” in your launcher. Only the launcher name changes; the icon may move to a new spot. Agendula closes when you switch, so reopen it from the launcher. Dynamic colour Use colours from your wallpaper + Density + Comfortable + Compact + Compact uses shorter rows, so more fits on the screen. + Buttons + Icons only + Expressive shapes + Motion + Reduce motion + Stops looping animations like the progress wave. The system “Remove animations” setting always wins. + Date & time + Launcher Notifications Task reminders Notify me when a task is due From d567dff38a687f87ee78d1bf1336669e0e56fab1 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:16:34 +0100 Subject: [PATCH 06/13] CHANGELOG: icon-only buttons, reduce motion, compact density (#118, #157) --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78c226c..0e7b19a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ All notable changes to this project are documented here. The format follows ## [Unreleased] +### Added +- A compact density under Settings → Appearance: shorter rows in the lists, + the task lists and settings, so more fits on the screen. +- A "Reduce motion" switch under Settings → Appearance stops looping + animations such as the wave on the Today progress ring. With the system's + "Remove animations" on, they stay still whatever the switch says (#157). + +### Changed +- The home screen's search, settings and new-list buttons are plain icons now, + for everyone. The expressive shapes they sat on are still there: pick + "Expressive shapes" under Settings → Appearance → Buttons (#118). + ## [1.4.0] - 2026-11-25 ### Added From ba05c442f07d3ab0b5e3f6ae2365c5ff21629cbc Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:32:02 +0100 Subject: [PATCH 07/13] Appearance review fixes: Colours header, shared preview row, still wave keeps its wavelength (#118, #157) --- .../agendula/ui/lists/ListsScreen.kt | 5 ++- .../agendula/ui/settings/AppearanceScreen.kt | 36 +++++++------------ app/src/main/res/values/strings.xml | 1 + .../data/prefs/AppearanceSettingsTest.kt | 21 +---------- floret-kit | 2 +- 5 files changed, 19 insertions(+), 46 deletions(-) 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 From 89fe7c17ea3c3527634974c42fce41dcb1304e31 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 12:47:29 +0100 Subject: [PATCH 08/13] Appearance: dynamic colour as a GroupedSwitchRow, subtask inset in compact (#118) --- .../agendula/ui/settings/AppearanceScreen.kt | 30 ++++++------------- .../agendula/ui/tasklist/TaskListScreen.kt | 2 +- floret-kit | 2 +- 3 files changed, 11 insertions(+), 23 deletions(-) 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 a877665..06b07fd 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 @@ -16,7 +16,6 @@ import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Settings import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Switch import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -89,27 +88,18 @@ internal fun AppearanceScreen( leading = { Icon(Icons.Rounded.DarkMode, contentDescription = null) }, onClick = { showTheme = true }, ) - GroupedRow( + GroupedSwitchRow( title = stringResource(R.string.settings_dynamic_color), summary = if (dynamicColorAvailable) { stringResource(R.string.settings_dynamic_color_hint) } else { stringResource(R.string.settings_dynamic_color_unavailable) }, + checked = state.settings.dynamicColor && dynamicColorAvailable, + onCheckedChange = viewModel::setDynamicColor, position = Position.Bottom, + enabled = dynamicColorAvailable, leading = { Icon(Icons.Rounded.Palette, contentDescription = null) }, - trailing = { - Switch( - checked = state.settings.dynamicColor && dynamicColorAvailable, - onCheckedChange = viewModel::setDynamicColor, - enabled = dynamicColorAvailable, - ) - }, - onClick = if (dynamicColorAvailable) { - { viewModel.setDynamicColor(!state.settings.dynamicColor) } - } else { - null - }, ) Spacer(Modifier.height(8.dp)) @@ -287,13 +277,11 @@ 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> by lazy { - listOf( - Icons.Rounded.Search to ActionShapes.Search, - Icons.Rounded.Settings to ActionShapes.Settings, - Icons.Rounded.Add to ActionShapes.AddList, - ) -} +private val PreviewActions: List> = 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/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt index 1149e00..a99522e 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt @@ -1185,7 +1185,7 @@ private fun SubtaskRow( modifier = Modifier .fillMaxWidth() .heightIn(min = byDensity(56.dp, 48.dp)) - .padding(start = 12.dp, end = 16.dp, top = byDensity(6.dp, 0.dp), bottom = byDensity(6.dp, 0.dp)), + .padding(start = 12.dp, end = 16.dp, top = byDensity(6.dp, 2.dp), bottom = byDensity(6.dp, 2.dp)), verticalAlignment = Alignment.CenterVertically, ) { // No colour bar — that absence (with the grouped nesting) marks the row diff --git a/floret-kit b/floret-kit index 4d9c014..34b86db 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 4d9c014eff7dd42c7d3df3694d28ed9b46557851 +Subproject commit 34b86dbfe56d4da4e19c5fa82cc0a984b876ce00 From c2712a7d99623038cb71685ef97f72fb7bf9ec85 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 13:39:54 +0100 Subject: [PATCH 09/13] Theme mode and dynamic colour through floret's AppearancePrefs, one AgendulaTheme(settings) (#118) --- .../agendula/data/prefs/SettingsPrefs.kt | 25 ++++--------------- .../agendula/ui/settings/AppearanceScreen.kt | 2 +- .../agendula/ui/settings/SettingsViewModel.kt | 2 +- .../agendula/ui/theme/SystemTheme.kt | 3 ++- .../jeanlucmakiola/agendula/ui/theme/Theme.kt | 17 +++++++++++++ .../widget/TaskWidgetConfigActivity.kt | 12 ++------- .../agendula/widget/WidgetData.kt | 2 +- .../agendula/widget/WidgetStats.kt | 2 +- .../data/prefs/AppearanceSettingsTest.kt | 24 ++++++++++++++++++ .../agendula/ui/theme/SystemThemeTest.kt | 2 +- .../agendula/widget/WidgetDataTest.kt | 2 +- 11 files changed, 56 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt b/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt index ebdbada..0d93504 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/data/prefs/SettingsPrefs.kt @@ -35,6 +35,7 @@ import de.jeanlucmakiola.agendula.domain.withinUpcoming import de.jeanlucmakiola.floret.prefs.ActionStyle import de.jeanlucmakiola.floret.prefs.AppearancePrefs import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.ThemeMode import de.jeanlucmakiola.floret.prefs.get import de.jeanlucmakiola.floret.prefs.set import de.jeanlucmakiola.floret.reminders.ReminderLead @@ -55,19 +56,6 @@ import javax.inject.Singleton import kotlin.time.Clock import kotlin.time.Instant -/** [BLACK] is dark with pure-black surfaces, for AMOLED screens. */ -enum class ThemeMode { - SYSTEM, LIGHT, DARK, BLACK; - - fun isDark(systemDark: Boolean): Boolean = when (this) { - SYSTEM -> systemDark - LIGHT -> false - DARK, BLACK -> true - } - - val isPureBlack: Boolean get() = this == BLACK -} - /** Clock convention: AUTO follows the device's 24-hour switch. */ enum class TimeFormatPref { AUTO, TWELVE_HOUR, TWENTY_FOUR_HOUR } @@ -288,9 +276,8 @@ class SettingsPrefs @Inject constructor( val settings: Flow = dataStore.data.map { p -> val scope = scopeOf(p) Settings( - themeMode = p[THEME_MODE]?.let { runCatching { ThemeMode.valueOf(it) }.getOrNull() } - ?: ThemeMode.SYSTEM, - dynamicColor = p[DYNAMIC_COLOR] ?: true, + themeMode = p[AppearancePrefs.themeMode], + dynamicColor = p[AppearancePrefs.dynamicColor], density = p[AppearancePrefs.density], actionStyle = p[AppearancePrefs.actionStyle], reduceMotion = p[AppearancePrefs.reduceMotion], @@ -454,8 +441,8 @@ class SettingsPrefs @Inject constructor( if (day == null) it.remove(WEEK_START) else it[WEEK_START] = day.name } - suspend fun setThemeMode(mode: ThemeMode) = dataStore.edit { it[THEME_MODE] = mode.name } - suspend fun setDynamicColor(enabled: Boolean) = dataStore.edit { it[DYNAMIC_COLOR] = enabled } + suspend fun setThemeMode(mode: ThemeMode) = dataStore.edit { it[AppearancePrefs.themeMode] = mode } + suspend fun setDynamicColor(enabled: Boolean) = dataStore.edit { it[AppearancePrefs.dynamicColor] = enabled } suspend fun setDensity(density: LayoutDensity) = dataStore.edit { it[AppearancePrefs.density] = density } suspend fun setActionStyle(style: ActionStyle) = dataStore.edit { it[AppearancePrefs.actionStyle] = style } suspend fun setReduceMotion(enabled: Boolean) = dataStore.edit { it[AppearancePrefs.reduceMotion] = enabled } @@ -619,8 +606,6 @@ class SettingsPrefs @Inject constructor( } private companion object { - val THEME_MODE = stringPreferencesKey("theme_mode") - val DYNAMIC_COLOR = booleanPreferencesKey("dynamic_color") val DEFAULT_LIST_ID = longPreferencesKey("default_list_id") val REMINDER_LEAD = intPreferencesKey("reminder_lead_minutes") val DEFAULT_REMINDERS = stringPreferencesKey("default_reminder_minutes") 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 06b07fd..f06c24c 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 @@ -32,7 +32,6 @@ import androidx.graphics.shapes.RoundedPolygon import androidx.lifecycle.compose.collectAsStateWithLifecycle import de.jeanlucmakiola.agendula.R import de.jeanlucmakiola.agendula.data.appname.LauncherName -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode import de.jeanlucmakiola.agendula.data.prefs.TimeFormatPref import de.jeanlucmakiola.agendula.data.prefs.is24Hour import de.jeanlucmakiola.agendula.ui.common.ActionShapes @@ -54,6 +53,7 @@ import de.jeanlucmakiola.floret.components.PreviewOptionRow import de.jeanlucmakiola.floret.locale.currentLocale import de.jeanlucmakiola.floret.prefs.ActionStyle import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.ThemeMode import java.time.DayOfWeek import java.time.format.TextStyle diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt index 4ced0fc..9d1280c 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt @@ -10,7 +10,6 @@ import de.jeanlucmakiola.agendula.data.prefs.ListPersistence import de.jeanlucmakiola.agendula.data.prefs.ReminderDescription import de.jeanlucmakiola.agendula.data.prefs.Settings import de.jeanlucmakiola.agendula.data.prefs.SettingsPrefs -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode import de.jeanlucmakiola.agendula.data.prefs.TimeFormatPref import de.jeanlucmakiola.agendula.data.reminders.ReminderScheduler import de.jeanlucmakiola.agendula.data.reminders.TaskNotifier @@ -30,6 +29,7 @@ import de.jeanlucmakiola.agendula.domain.TaskFormField import de.jeanlucmakiola.agendula.domain.TaskList import de.jeanlucmakiola.floret.prefs.ActionStyle import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.ThemeMode import de.jeanlucmakiola.floret.reminders.ReminderLead import de.jeanlucmakiola.floret.reminders.ReminderOverride import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/SystemTheme.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/SystemTheme.kt index 963a52a..4adf994 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/SystemTheme.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/SystemTheme.kt @@ -5,7 +5,8 @@ import android.app.UiModeManager import android.os.Build import androidx.annotation.StyleRes import de.jeanlucmakiola.agendula.R -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode +import de.jeanlucmakiola.floret.prefs.ThemeMode +import de.jeanlucmakiola.floret.prefs.isPureBlack /** * Hands the app's theme setting to the system, which draws the launch window diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt index 3addeca..04959ee 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/theme/Theme.kt @@ -2,7 +2,12 @@ package de.jeanlucmakiola.agendula.ui.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.Composable +import de.jeanlucmakiola.agendula.data.prefs.Settings import de.jeanlucmakiola.floret.identity.FloretExpressiveTheme +import de.jeanlucmakiola.floret.prefs.ActionStyle +import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.isDark +import de.jeanlucmakiola.floret.prefs.isPureBlack /** * Agendula's theme: the family's [FloretExpressiveTheme] machinery (dynamic @@ -34,3 +39,15 @@ fun AgendulaTheme( content = content, ) } + +/** [AgendulaTheme] as the stored [settings] ask for it: theme mode, colours, density, buttons and motion. */ +@Composable +fun AgendulaTheme(settings: Settings, content: @Composable () -> Unit) = AgendulaTheme( + darkTheme = settings.themeMode.isDark(isSystemInDarkTheme()), + dynamicColor = settings.dynamicColor, + pureBlack = settings.themeMode.isPureBlack, + compactLayout = settings.density == LayoutDensity.COMPACT, + shapedActions = settings.actionStyle == ActionStyle.SHAPES, + reduceMotion = settings.reduceMotion, + content = content, +) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt b/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt index 373e760..751a28f 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/widget/TaskWidgetConfigActivity.kt @@ -55,8 +55,7 @@ import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.floret.glance.WidgetBackground import de.jeanlucmakiola.floret.glance.WidgetThemeMode -import de.jeanlucmakiola.floret.prefs.ActionStyle -import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.isDark import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.launch @@ -137,14 +136,7 @@ class TaskWidgetConfigActivity : ComponentActivity() { selectedListIds = parseWidgetListIds(state[WIDGET_LIST_IDS_KEY]) } val dark = settings.themeMode.isDark(isSystemInDarkTheme()) - AgendulaTheme( - darkTheme = dark, - dynamicColor = settings.dynamicColor, - pureBlack = settings.themeMode.isPureBlack, - compactLayout = settings.density == LayoutDensity.COMPACT, - shapedActions = settings.actionStyle == ActionStyle.SHAPES, - reduceMotion = settings.reduceMotion, - ) { + AgendulaTheme(settings) { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.surface) {} WidgetFilterPicker( kind = kind, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetData.kt b/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetData.kt index 0792edb..3bb00c2 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetData.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetData.kt @@ -2,7 +2,6 @@ package de.jeanlucmakiola.agendula.widget import android.content.Context import android.text.format.DateFormat -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode import de.jeanlucmakiola.agendula.data.prefs.is24Hour import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.stringPreferencesKey @@ -14,6 +13,7 @@ import de.jeanlucmakiola.agendula.domain.calendarDate import de.jeanlucmakiola.agendula.domain.comparator import de.jeanlucmakiola.floret.glance.WidgetBackground import de.jeanlucmakiola.floret.glance.WidgetThemeMode +import de.jeanlucmakiola.floret.prefs.ThemeMode import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.combine diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetStats.kt b/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetStats.kt index e0c59f2..1ac3f3a 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetStats.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/widget/WidgetStats.kt @@ -2,7 +2,6 @@ package de.jeanlucmakiola.agendula.widget import android.content.Context import android.text.format.DateFormat -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode import de.jeanlucmakiola.agendula.data.prefs.is24Hour import de.jeanlucmakiola.agendula.domain.SmartList import de.jeanlucmakiola.agendula.domain.Task @@ -12,6 +11,7 @@ import de.jeanlucmakiola.agendula.domain.TaskFiltering import de.jeanlucmakiola.agendula.domain.TaskList import de.jeanlucmakiola.agendula.domain.TaskSorting import de.jeanlucmakiola.agendula.domain.comparator +import de.jeanlucmakiola.floret.prefs.ThemeMode import de.jeanlucmakiola.floret.time.DayWindow import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch 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 e4662a6..a22a2bb 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 @@ -11,6 +11,7 @@ import de.jeanlucmakiola.agendula.data.tasks.ProviderEnvironment import de.jeanlucmakiola.agendula.data.tasks.ProviderResolver import de.jeanlucmakiola.floret.prefs.ActionStyle import de.jeanlucmakiola.floret.prefs.LayoutDensity +import de.jeanlucmakiola.floret.prefs.ThemeMode import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking @@ -66,4 +67,27 @@ class AppearanceSettingsTest { assertThat(Triple(settings.density, settings.actionStyle, settings.reduceMotion)) .isEqualTo(Triple(LayoutDensity.COMPACT, ActionStyle.SHAPES, true)) } + + @Test + fun `a theme stored before floret-kit took the keys over is kept`() = runBlocking { + val upgraded = MemoryDataStore( + mutablePreferencesOf( + stringPreferencesKey("theme_mode") to "BLACK", + booleanPreferencesKey("dynamic_color") to false, + ), + ) + + val settings = prefs(upgraded).settings.first() + + assertThat(settings.themeMode to settings.dynamicColor).isEqualTo(ThemeMode.BLACK to false) + } + + @Test + fun `a theme choice is written where earlier versions read it`() = runBlocking { + val dataStore = MemoryDataStore() + + prefs(dataStore).setThemeMode(ThemeMode.DARK) + + assertThat(dataStore.data.value[stringPreferencesKey("theme_mode")]).isEqualTo("DARK") + } } diff --git a/app/src/test/java/de/jeanlucmakiola/agendula/ui/theme/SystemThemeTest.kt b/app/src/test/java/de/jeanlucmakiola/agendula/ui/theme/SystemThemeTest.kt index 584b0b9..3eb9ec3 100644 --- a/app/src/test/java/de/jeanlucmakiola/agendula/ui/theme/SystemThemeTest.kt +++ b/app/src/test/java/de/jeanlucmakiola/agendula/ui/theme/SystemThemeTest.kt @@ -3,7 +3,7 @@ package de.jeanlucmakiola.agendula.ui.theme import android.app.UiModeManager import com.google.common.truth.Truth.assertThat import de.jeanlucmakiola.agendula.R -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode +import de.jeanlucmakiola.floret.prefs.ThemeMode import org.junit.jupiter.api.Test class SystemThemeTest { diff --git a/app/src/test/java/de/jeanlucmakiola/agendula/widget/WidgetDataTest.kt b/app/src/test/java/de/jeanlucmakiola/agendula/widget/WidgetDataTest.kt index c43d32f..c11717e 100644 --- a/app/src/test/java/de/jeanlucmakiola/agendula/widget/WidgetDataTest.kt +++ b/app/src/test/java/de/jeanlucmakiola/agendula/widget/WidgetDataTest.kt @@ -1,7 +1,6 @@ package de.jeanlucmakiola.agendula.widget import com.google.common.truth.Truth.assertThat -import de.jeanlucmakiola.agendula.data.prefs.ThemeMode import de.jeanlucmakiola.agendula.domain.SmartList import de.jeanlucmakiola.agendula.domain.TaskFilter import de.jeanlucmakiola.agendula.domain.TaskSorting @@ -10,6 +9,7 @@ import de.jeanlucmakiola.agendula.domain.allDayInstantOf import de.jeanlucmakiola.agendula.domain.testTask import de.jeanlucmakiola.floret.glance.WidgetBackground import de.jeanlucmakiola.floret.glance.WidgetThemeMode +import de.jeanlucmakiola.floret.prefs.ThemeMode import org.junit.jupiter.api.Test import java.time.LocalDate import java.time.LocalDateTime From 7b8de39fab087ce159e6c874f258dd44daf7698b Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 13:39:54 +0100 Subject: [PATCH 10/13] Hold the first frame until the stored appearance is read (#118) --- .../jeanlucmakiola/agendula/MainActivity.kt | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt b/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt index 6809646..e959571 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/MainActivity.kt @@ -3,25 +3,29 @@ package de.jeanlucmakiola.agendula import android.content.Context import android.content.Intent import android.os.Bundle +import android.os.SystemClock import android.text.format.DateFormat +import android.view.View +import android.view.ViewTreeObserver import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.core.net.toUri +import de.jeanlucmakiola.agendula.data.prefs.Settings import de.jeanlucmakiola.agendula.data.prefs.SettingsPrefs import de.jeanlucmakiola.agendula.data.prefs.is24Hour import de.jeanlucmakiola.agendula.ui.common.LocalFirstDayOfWeek import de.jeanlucmakiola.agendula.ui.common.LocalUse24HourFormat import de.jeanlucmakiola.agendula.ui.common.localeFirstDayOfWeek -import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.lifecycleScope import dagger.hilt.android.AndroidEntryPoint @@ -33,21 +37,18 @@ import de.jeanlucmakiola.agendula.ui.navigation.AppShortcuts import de.jeanlucmakiola.agendula.ui.RootScreen import de.jeanlucmakiola.agendula.ui.crash.CrashReportActivity import de.jeanlucmakiola.agendula.ui.navigation.NavRequest -import de.jeanlucmakiola.agendula.ui.settings.SettingsViewModel import de.jeanlucmakiola.agendula.ui.theme.AgendulaTheme import de.jeanlucmakiola.agendula.ui.theme.SystemTheme import de.jeanlucmakiola.floret.crash.CrashReportDialog import de.jeanlucmakiola.floret.crash.CrashReporter import de.jeanlucmakiola.floret.crash.submitCrashReport -import de.jeanlucmakiola.floret.prefs.ActionStyle -import de.jeanlucmakiola.floret.prefs.LayoutDensity import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import javax.inject.Inject /** - * Single activity. The theme follows [SettingsViewModel]; [RootScreen] is the + * Single activity. The theme follows the stored [Settings]; [RootScreen] is the * (replaceable) functional scaffold over the real data layer. Notification taps * arrive as a [NavRequest] (see [navRequestOf]). */ @@ -66,6 +67,9 @@ class MainActivity : ComponentActivity() { // A notification tap's destination, handed to the nav host and cleared once taken. private var navRequest by mutableStateOf(null) + // Set once the stored settings reach the composition; see [holdFirstFrameForAppearance]. + private var appearanceReady = false + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -100,21 +104,17 @@ class MainActivity : ComponentActivity() { if (savedInstanceState == null) { launchHooks.forEach { hook -> lifecycleScope.launch { runCatching { hook.onLaunch(intent) } } } } + holdFirstFrameForAppearance() setContent { - val settingsViewModel: SettingsViewModel = hiltViewModel() - val ui by settingsViewModel.state.collectAsStateWithLifecycle() - val darkTheme = ui.settings.themeMode.isDark(isSystemInDarkTheme()) + // The stored settings, not a placeholder: until they're read the first + // frame is held, so a compact or shaped layout never opens on the defaults. + val stored by remember { settingsPrefs.settings }.collectAsStateWithLifecycle(initialValue = null) + if (stored != null) SideEffect { appearanceReady = true } + val settings = stored ?: Settings() val context = LocalContext.current - val use24Hour = ui.settings.timeFormat.is24Hour(DateFormat.is24HourFormat(context)) - val firstDayOfWeek = ui.settings.weekStart ?: localeFirstDayOfWeek() - AgendulaTheme( - darkTheme = darkTheme, - dynamicColor = ui.settings.dynamicColor, - pureBlack = ui.settings.themeMode.isPureBlack, - compactLayout = ui.settings.density == LayoutDensity.COMPACT, - shapedActions = ui.settings.actionStyle == ActionStyle.SHAPES, - reduceMotion = ui.settings.reduceMotion, - ) { + val use24Hour = settings.timeFormat.is24Hour(DateFormat.is24HourFormat(context)) + val firstDayOfWeek = settings.weekStart ?: localeFirstDayOfWeek() + AgendulaTheme(settings) { CompositionLocalProvider( LocalUse24HourFormat provides use24Hour, LocalFirstDayOfWeek provides firstDayOfWeek, @@ -144,6 +144,24 @@ class MainActivity : ComponentActivity() { } } + /** + * Keeps the launch window up until the stored appearance is in the first + * composition, at most [APPEARANCE_WAIT_MS], so a slow read can't hold the launch. + */ + private fun holdFirstFrameForAppearance() { + val content = findViewById(android.R.id.content) + val since = SystemClock.uptimeMillis() + content.viewTreeObserver.addOnPreDrawListener( + object : ViewTreeObserver.OnPreDrawListener { + override fun onPreDraw(): Boolean { + val draw = appearanceReady || SystemClock.uptimeMillis() - since > APPEARANCE_WAIT_MS + if (draw) content.viewTreeObserver.removeOnPreDrawListener(this) + return draw + } + }, + ) + } + override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) setIntent(intent) @@ -291,3 +309,6 @@ class MainActivity : ComponentActivity() { } } } + +/** The longest the first frame waits for the stored appearance. */ +private const val APPEARANCE_WAIT_MS = 600L From 9e0d9581c6e228721d29061e9f2d82b4877c0d40 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 13:39:54 +0100 Subject: [PATCH 11/13] Expressive shapes on every top-bar action, Reduce motion stills all motion (#118, #157) --- CHANGELOG.md | 14 ++-- .../agendula/ui/common/ActionShapes.kt | 20 ++++- .../agendula/ui/common/SyncPullBox.kt | 25 ++++-- .../agendula/ui/detail/TaskDetailScreen.kt | 34 +++++--- .../agendula/ui/edit/TaskEditScreen.kt | 6 +- .../agendula/ui/lists/ListsScreen.kt | 52 ++++++++---- .../agendula/ui/tasklist/TaskListScreen.kt | 83 ++++++++++--------- app/src/main/res/values/strings.xml | 2 +- floret-kit | 2 +- 9 files changed, 153 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7b19a..c284e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,14 +10,18 @@ All notable changes to this project are documented here. The format follows ### Added - A compact density under Settings → Appearance: shorter rows in the lists, the task lists and settings, so more fits on the screen. -- A "Reduce motion" switch under Settings → Appearance stops looping - animations such as the wave on the Today progress ring. With the system's - "Remove animations" on, they stay still whatever the switch says (#157). +- A "Reduce motion" switch under Settings → Appearance takes the movement out + of the app, as the system's "Remove animations" does: screens and sections + fade instead of sliding, buttons don't spin or bounce, and looping animations + such as the wave on the Today progress ring and the pull-to-sync indicator + stay still. The system setting does the same whatever the switch says (#157). ### Changed - The home screen's search, settings and new-list buttons are plain icons now, - for everyone. The expressive shapes they sat on are still there: pick - "Expressive shapes" under Settings → Appearance → Buttons (#118). + for everyone. The expressive shapes they sat on are still there, and now + reach every top-bar and header button (lists, filters, a list's search and + view options, a task's edit, delete and menu): pick "Expressive shapes" under + Settings → Appearance → Buttons (#118). ## [1.4.0] - 2026-11-25 diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt index 8734939..8ace109 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/ActionShapes.kt @@ -21,6 +21,24 @@ object ActionShapes { /** New list — a sunny burst beside the Lists header. */ val AddList: RoundedPolygon get() = MaterialShapes.Sunny - /** What [AddList] morphs into on press. */ + /** What [AddList] and [AddFilter] morph into on press. */ val AddListPressed: RoundedPolygon get() = MaterialShapes.Circle + + /** New filter — the same burst as [AddList], so both "add" actions read alike. */ + val AddFilter: RoundedPolygon get() = MaterialShapes.Sunny + + /** Reorder the lists — a four-leaf clover. */ + val Reorder: RoundedPolygon get() = MaterialShapes.Clover4Leaf + + /** A list's view options (sort, group, filter) — a 9-sided cookie. */ + val ViewOptions: RoundedPolygon get() = MaterialShapes.Cookie9Sided + + /** Edit a task, list or filter — a flower. */ + val Edit: RoundedPolygon get() = MaterialShapes.Flower + + /** Delete — a pentagon, set apart from the softer shapes. */ + val Delete: RoundedPolygon get() = MaterialShapes.Pentagon + + /** The overflow menu — a puffy cloud. */ + val More: RoundedPolygon get() = MaterialShapes.Puffy } diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt index efccbbf..85a4c53 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt @@ -3,6 +3,8 @@ package de.jeanlucmakiola.agendula.ui.common import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.pulltorefresh.PullToRefreshBox @@ -13,11 +15,13 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import de.jeanlucmakiola.floret.identity.rememberLoopingMotion /** * Pull down to sync every account (#73). Without an account there is nothing * to sync, so the gesture is off. [topPadding] keeps the indicator below a top - * bar the content scrolls under. + * bar the content scrolls under. Under reduced motion the indicator is a still + * ring rather than the morphing loading shape (#157). */ @OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class) @Composable @@ -34,17 +38,26 @@ fun SyncPullBox( return } val state = rememberPullToRefreshState() + val looping = rememberLoopingMotion() PullToRefreshBox( isRefreshing = syncing, onRefresh = onSync, modifier = modifier, state = state, indicator = { - PullToRefreshDefaults.LoadingIndicator( - state = state, - isRefreshing = syncing, - modifier = Modifier.align(Alignment.TopCenter).padding(top = topPadding), - ) + val placement = Modifier.align(Alignment.TopCenter).padding(top = topPadding) + if (looping) { + PullToRefreshDefaults.LoadingIndicator(state = state, isRefreshing = syncing, modifier = placement) + } else { + // Reduced motion: a still ring that fills with the pull and stays full while syncing. + PullToRefreshDefaults.IndicatorBox(state = state, isRefreshing = syncing, modifier = placement) { + CircularProgressIndicator( + progress = { if (syncing) 1f else state.distanceFraction.coerceIn(0f, 1f) }, + modifier = Modifier.size(24.dp), + strokeWidth = 2.5.dp, + ) + } + } }, content = content, ) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/detail/TaskDetailScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/detail/TaskDetailScreen.kt index 529d613..5c69789 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/detail/TaskDetailScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/detail/TaskDetailScreen.kt @@ -111,6 +111,10 @@ import de.jeanlucmakiola.floret.time.formatTime import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.agendula.ui.tasklist.priorityLabel +import androidx.compose.animation.core.spring +import de.jeanlucmakiola.agendula.ui.common.ActionShapes +import de.jeanlucmakiola.floret.components.ActionButton +import de.jeanlucmakiola.floret.identity.reducibleSpec /** * One task's detail. Each fact is its own tonal card with a leading icon (the @@ -148,23 +152,31 @@ fun TaskDetailScreen( val content = state as? TaskDetailUiState.Content // A read-only share: an edit would never reach the server. val writable = content != null && !content.detail.task.isReadOnly - IconButton(onClick = { content?.let { onEdit(it.detail.task) } }, enabled = writable) { - Icon(Icons.Rounded.Edit, contentDescription = stringResource(R.string.edit)) - } - IconButton( + ActionButton( + shape = ActionShapes.Edit, + icon = Icons.Rounded.Edit, + contentDescription = stringResource(R.string.edit), + onClick = { content?.let { onEdit(it.detail.task) } }, + enabled = writable, + ) + ActionButton( + shape = ActionShapes.Delete, + icon = Icons.Rounded.Delete, + contentDescription = stringResource(R.string.delete), onClick = { confirmDelete = true }, enabled = writable, - ) { - Icon(Icons.Rounded.Delete, contentDescription = stringResource(R.string.delete)) - } + ) // On an occurrence of a series, cancelling reaches only that occurrence. val task = content?.detail?.task if (task != null) { var menuOpen by remember { mutableStateOf(false) } Box { - IconButton(onClick = { menuOpen = true }) { - Icon(Icons.Rounded.MoreVert, contentDescription = stringResource(R.string.more_options)) - } + ActionButton( + shape = ActionShapes.More, + icon = Icons.Rounded.MoreVert, + contentDescription = stringResource(R.string.more_options), + onClick = { menuOpen = true }, + ) DropdownMenu(expanded = menuOpen, onDismissRequest = { menuOpen = false }) { val cancelled = task.status == TaskStatus.CANCELLED DropdownMenuItem( @@ -546,7 +558,7 @@ private fun SubtasksGroup( val done = subtasks.count { it.isCompleted } // Completed subtasks sink to the bottom; stable, so order is otherwise kept. val ordered = remember(subtasks) { subtasks.sortedBy { it.isCompleted } } - val rotation by animateFloatAsState(if (expanded) 180f else 0f, label = "subtasksChevron") + val rotation by animateFloatAsState(if (expanded) 180f else 0f, reducibleSpec(spring()), label = "subtasksChevron") // Segments when expanded: header + the always-present add row + each subtask. val addRow = if (readOnly) 0 else 1 val count = if (expanded) subtasks.size + 1 + addRow else 1 diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/edit/TaskEditScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/edit/TaskEditScreen.kt index c4d3e8f..25bbae2 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/edit/TaskEditScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/edit/TaskEditScreen.kt @@ -141,6 +141,7 @@ import java.time.LocalTime import java.time.ZoneId import kotlin.time.Clock import kotlin.time.Instant +import de.jeanlucmakiola.floret.identity.rememberReduceMotion /** * Create / edit form, in the family's tonal-card language (mirrors Calendula's @@ -173,6 +174,7 @@ fun TaskEditScreen( val scroll = rememberScrollState() var titleBottom by remember { mutableIntStateOf(Int.MAX_VALUE) } val titleInBar by remember { derivedStateOf { scroll.value > titleBottom } } + val reduceMotion = rememberReduceMotion() Scaffold( modifier = modifier, @@ -181,8 +183,8 @@ fun TaskEditScreen( title = { AnimatedVisibility( visible = titleInBar && state.title.isNotBlank(), - enter = fadeIn() + slideInVertically { it / 2 }, - exit = fadeOut() + slideOutVertically { it / 2 }, + enter = if (reduceMotion) fadeIn() else fadeIn() + slideInVertically { it / 2 }, + exit = if (reduceMotion) fadeOut() else fadeOut() + slideOutVertically { it / 2 }, ) { Text(state.title, maxLines = 1, overflow = TextOverflow.Ellipsis) } 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 9f9a899..f881caf 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 @@ -9,6 +9,7 @@ import androidx.compose.material.icons.rounded.SwapVert import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.animateDpAsState +import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween import androidx.compose.animation.expandHorizontally import androidx.compose.animation.fadeIn @@ -56,7 +57,6 @@ import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface @@ -92,7 +92,6 @@ import de.jeanlucmakiola.agendula.domain.TaskFilter import de.jeanlucmakiola.agendula.ui.common.ActionShapes import de.jeanlucmakiola.floret.components.ActionButton import de.jeanlucmakiola.floret.components.GroupedRow -import de.jeanlucmakiola.floret.components.GroupedRowMinHeight import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.floret.components.SnackChip import de.jeanlucmakiola.floret.components.SnackChipHeight @@ -105,7 +104,10 @@ import de.jeanlucmakiola.agendula.ui.common.SyncPullBox import de.jeanlucmakiola.agendula.ui.common.priorityAccent import de.jeanlucmakiola.agendula.ui.tasklist.priorityLabel import de.jeanlucmakiola.floret.components.positionOf +import de.jeanlucmakiola.floret.identity.FloretDensity +import de.jeanlucmakiola.floret.identity.reducibleSpec import de.jeanlucmakiola.floret.identity.rememberLoopingMotion +import de.jeanlucmakiola.floret.identity.rememberReduceMotion import de.jeanlucmakiola.floret.time.formatDateTimeCompact import java.time.LocalDate import java.time.ZoneId @@ -322,14 +324,14 @@ private fun ListsContent( SectionHeader( text = stringResource(R.string.lists_header), action = { - IconButton(onClick = { reordering = !reordering }) { - Icon( - if (reordering) Icons.Rounded.Check else Icons.Rounded.SwapVert, - contentDescription = stringResource( - if (reordering) R.string.lists_reorder_done else R.string.lists_reorder, - ), - ) - } + ActionButton( + shape = ActionShapes.Reorder, + icon = if (reordering) Icons.Rounded.Check else Icons.Rounded.SwapVert, + contentDescription = stringResource( + if (reordering) R.string.lists_reorder_done else R.string.lists_reorder, + ), + onClick = { reordering = !reordering }, + ) ActionButton( shape = ActionShapes.AddList, morphTo = ActionShapes.AddListPressed, @@ -348,7 +350,7 @@ private fun ListsContent( items = group.lists, keyOf = { it.list.id }, onReorder = { ordered -> onReorder(ordered.map { it.list.id }) }, - rowHeight = GroupedRowMinHeight, + rowHeight = FloretDensity.rowHeight, ) { overview, position, dragHandle, isDragging -> GroupedRow( title = overview.list.name, @@ -434,9 +436,13 @@ private fun LazyListScope.filtersSection( null } else { { - IconButton(onClick = onNewFilter) { - Icon(Icons.Rounded.Add, contentDescription = stringResource(R.string.filter_new_title)) - } + ActionButton( + shape = ActionShapes.AddFilter, + morphTo = ActionShapes.AddListPressed, + icon = Icons.Rounded.Add, + contentDescription = stringResource(R.string.filter_new_title), + onClick = onNewFilter, + ) } }, ) @@ -560,11 +566,21 @@ private fun SearchSlot( onToggleSearch: () -> Unit, modifier: Modifier = Modifier, ) { + // Under reduced motion the pill fades in place instead of unfurling. + val reduced = rememberReduceMotion() Box(modifier = modifier, contentAlignment = Alignment.CenterEnd) { AnimatedVisibility( visible = searchActive, - enter = expandHorizontally(tween(300), expandFrom = Alignment.End) + fadeIn(tween(280)), - exit = shrinkHorizontally(tween(220), shrinkTowards = Alignment.End) + fadeOut(tween(140)), + enter = if (reduced) { + fadeIn(tween(280)) + } else { + expandHorizontally(tween(300), expandFrom = Alignment.End) + fadeIn(tween(280)) + }, + exit = if (reduced) { + fadeOut(tween(140)) + } else { + shrinkHorizontally(tween(220), shrinkTowards = Alignment.End) + fadeOut(tween(140)) + }, ) { SearchPill( query = query, @@ -638,7 +654,7 @@ private fun SearchResults( private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) { val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, label = "todayCorner") + val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, reducibleSpec(spring()), label = "todayCorner") val left = total - done Surface( onClick = onClick, @@ -836,7 +852,7 @@ private fun SmartCard(count: SmartCount, modifier: Modifier = Modifier, onClick: val style = smartStyle(count.smart) val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, label = "smartCorner") + val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, reducibleSpec(spring()), label = "smartCorner") Surface( onClick = onClick, shape = RoundedCornerShape(corner), diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt index a99522e..0a804ad 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt @@ -4,6 +4,7 @@ import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.spring import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.slideInVertically @@ -53,13 +54,10 @@ import androidx.compose.material.icons.rounded.Edit import androidx.compose.material.icons.rounded.ExpandMore import androidx.compose.material.icons.rounded.Flag import androidx.compose.material3.Checkbox -import androidx.compose.material3.Badge -import androidx.compose.material3.BadgedBox import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MediumTopAppBar import androidx.compose.material3.Scaffold @@ -138,7 +136,11 @@ import de.jeanlucmakiola.floret.components.SnackChipMargin import de.jeanlucmakiola.floret.time.formatDateTimeCompact import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf +import de.jeanlucmakiola.floret.identity.FloretDensity import de.jeanlucmakiola.floret.identity.byDensity +import de.jeanlucmakiola.floret.identity.reducibleSpec +import de.jeanlucmakiola.floret.components.ActionButton +import de.jeanlucmakiola.agendula.ui.common.ActionShapes import java.time.LocalDate import java.time.ZoneId @@ -249,37 +251,38 @@ fun TaskListScreen( }, actions = { if (listId != null) { - IconButton(onClick = viewModel::openSearch, enabled = content != null) { - Icon(Icons.Rounded.Search, contentDescription = stringResource(R.string.task_search_action)) - } - } - IconButton(onClick = { showSort = true }, enabled = content != null) { - val narrowed = content?.selectedTags?.isNotEmpty() == true || content?.upcomingLimited == true - BadgedBox(badge = { if (narrowed) Badge() }) { - Icon(Icons.Rounded.Tune, contentDescription = stringResource(R.string.view_options_title)) - } + ActionButton( + shape = ActionShapes.Search, + icon = Icons.Rounded.Search, + contentDescription = stringResource(R.string.task_search_action), + onClick = viewModel::openSearch, + enabled = content != null, + ) } + ActionButton( + shape = ActionShapes.ViewOptions, + icon = Icons.Rounded.Tune, + contentDescription = stringResource(R.string.view_options_title), + onClick = { showSort = true }, + enabled = content != null, + badge = content?.selectedTags?.isNotEmpty() == true || content?.upcomingLimited == true, + ) if (savedFilter != null) { - IconButton(onClick = { onEditFilter(savedFilter.id) }) { - Icon(Icons.Rounded.Edit, contentDescription = stringResource(R.string.filter_edit_title)) - } + ActionButton( + shape = ActionShapes.Edit, + icon = Icons.Rounded.Edit, + contentDescription = stringResource(R.string.filter_edit_title), + onClick = { onEditFilter(savedFilter.id) }, + ) } if (list != null) { - IconButton( - onClick = { - if (list.isReadOnly) readOnlyHint = true else editingList = true - }, - ) { - Icon( - Icons.Rounded.Edit, - contentDescription = stringResource(R.string.list_edit_title), - tint = if (list.isReadOnly) { - LocalContentColor.current.copy(alpha = 0.38f) - } else { - LocalContentColor.current - }, - ) - } + ActionButton( + shape = ActionShapes.Edit, + icon = Icons.Rounded.Edit, + contentDescription = stringResource(R.string.list_edit_title), + onClick = { if (list.isReadOnly) readOnlyHint = true else editingList = true }, + dimmed = list.isReadOnly, + ) } }, scrollBehavior = scrollBehavior, @@ -811,8 +814,8 @@ internal fun TaskRowContent( ) { val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val full by animateDpAsState(if (pressed) 36.dp else 22.dp, label = "fullCorner") - val small by animateDpAsState(if (pressed) 36.dp else 6.dp, label = "smallCorner") + val full by animateDpAsState(if (pressed) 36.dp else 22.dp, reducibleSpec(spring()), label = "fullCorner") + val small by animateDpAsState(if (pressed) 36.dp else 6.dp, reducibleSpec(spring()), label = "smallCorner") val dark = isSystemInDarkTheme() val due = task.shownValue(TaskEnd.DUE)?.formatDateTimeCompact(!task.hasTime(TaskEnd.DUE), LocalUse24HourFormat.current) val listName = task.listName?.takeIf { showListName && it.isNotBlank() } @@ -834,8 +837,8 @@ internal fun TaskRowContent( Row( modifier = Modifier .fillMaxWidth() - .heightIn(min = byDensity(64.dp, 56.dp)) - .padding(start = 12.dp, end = 16.dp, top = byDensity(8.dp, 4.dp), bottom = byDensity(8.dp, 4.dp)), + .heightIn(min = FloretDensity.cardRowHeight) + .padding(start = 12.dp, end = 16.dp, top = FloretDensity.cardRowInset, bottom = FloretDensity.cardRowInset), verticalAlignment = Alignment.CenterVertically, ) { // Calendula's signature accent: a slim pastelised colour bar for the @@ -1088,7 +1091,7 @@ private fun AddSubtaskRow( /** The trailing expand/collapse control for a parent row — a rotating chevron. */ @Composable private fun SubtaskExpandButton(expanded: Boolean, onToggle: () -> Unit) { - val rotation by animateFloatAsState(if (expanded) 180f else 0f, label = "subtaskExpand") + val rotation by animateFloatAsState(if (expanded) 180f else 0f, reducibleSpec(spring()), label = "subtaskExpand") IconButton(onClick = onToggle) { Icon( imageVector = Icons.Rounded.ExpandMore, @@ -1164,8 +1167,8 @@ private fun SubtaskRow( ) val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val full by animateDpAsState(if (pressed) 36.dp else 22.dp, label = "subFullCorner") - val small by animateDpAsState(if (pressed) 36.dp else 6.dp, label = "subSmallCorner") + val full by animateDpAsState(if (pressed) 36.dp else 22.dp, reducibleSpec(spring()), label = "subFullCorner") + val small by animateDpAsState(if (pressed) 36.dp else 6.dp, reducibleSpec(spring()), label = "subSmallCorner") val gap = if (lastInRun) Modifier else Modifier.padding(bottom = 2.dp) SwipeToDismissBox( state = dismissState, @@ -1184,8 +1187,8 @@ private fun SubtaskRow( Row( modifier = Modifier .fillMaxWidth() - .heightIn(min = byDensity(56.dp, 48.dp)) - .padding(start = 12.dp, end = 16.dp, top = byDensity(6.dp, 2.dp), bottom = byDensity(6.dp, 2.dp)), + .heightIn(min = FloretDensity.nestedRowHeight) + .padding(start = 12.dp, end = 16.dp, top = FloretDensity.nestedRowInset, bottom = FloretDensity.nestedRowInset), verticalAlignment = Alignment.CenterVertically, ) { // No colour bar — that absence (with the grouped nesting) marks the row @@ -1268,7 +1271,7 @@ private fun CollapsibleSectionHeader( onToggle: () -> Unit, onClear: (() -> Unit)? = null, ) { - val rotation by animateFloatAsState(if (expanded) 180f else 0f, label = "chevron") + val rotation by animateFloatAsState(if (expanded) 180f else 0f, reducibleSpec(spring()), label = "chevron") Surface( onClick = onToggle, color = MaterialTheme.colorScheme.surface, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e9714b0..90d6a7e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -534,7 +534,7 @@ Expressive shapes Motion Reduce motion - Stops looping animations like the progress wave. The system “Remove animations” setting always wins. + Screens fade instead of sliding, and looping animations like the progress wave stay still. The system “Remove animations” setting does the same. Colours Date & time Launcher diff --git a/floret-kit b/floret-kit index 34b86db..381ddc9 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 34b86dbfe56d4da4e19c5fa82cc0a984b876ce00 +Subproject commit 381ddc99a0257481bb7fadc70027f361fa2de88c From d856786161b31292e3568864b1bf8640ab350242 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 13:48:36 +0100 Subject: [PATCH 12/13] Reduce motion: task rows only fade, still busy spinners, pull indicator container (#157) --- .../jeanlucmakiola/agendula/ui/common/SyncPullBox.kt | 7 ++++++- .../jeanlucmakiola/agendula/ui/export/ExportScreen.kt | 4 ++-- .../jeanlucmakiola/agendula/ui/imports/ImportScreen.kt | 4 ++-- .../agendula/ui/settings/BackupScreen.kt | 4 ++-- .../agendula/ui/settings/SettingsViewModel.kt | 10 +++++----- .../agendula/ui/settings/StorageScreen.kt | 4 ++-- .../agendula/ui/tasklist/TaskListScreen.kt | 5 ++++- floret-kit | 2 +- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt index 85a4c53..1724605 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt @@ -50,7 +50,12 @@ fun SyncPullBox( PullToRefreshDefaults.LoadingIndicator(state = state, isRefreshing = syncing, modifier = placement) } else { // Reduced motion: a still ring that fills with the pull and stays full while syncing. - PullToRefreshDefaults.IndicatorBox(state = state, isRefreshing = syncing, modifier = placement) { + PullToRefreshDefaults.IndicatorBox( + state = state, + isRefreshing = syncing, + modifier = placement, + containerColor = PullToRefreshDefaults.loadingIndicatorContainerColor, + ) { CircularProgressIndicator( progress = { if (syncing) 1f else state.distanceFraction.coerceIn(0f, 1f) }, modifier = Modifier.size(24.dp), diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/export/ExportScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/export/ExportScreen.kt index fb797ef..65ecea3 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/export/ExportScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/export/ExportScreen.kt @@ -26,7 +26,6 @@ import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonGroup import androidx.compose.material3.ButtonGroupScope -import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.Icon @@ -57,6 +56,7 @@ import de.jeanlucmakiola.floret.components.SelectedCheck import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf +import de.jeanlucmakiola.floret.components.BusyIndicator private const val ZIP_MIME = "application/zip" private const val ZIP_NAME = "agendula-tasks.zip" @@ -238,7 +238,7 @@ private fun ExportStatus(state: ExportUiState) { verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), ) { - CircularProgressIndicator(Modifier.size(18.dp)) + BusyIndicator(Modifier.size(18.dp)) Text( text = stringResource(R.string.export_running), style = MaterialTheme.typography.bodyMedium, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/imports/ImportScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/imports/ImportScreen.kt index 85bfe03..d4749ec 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/imports/ImportScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/imports/ImportScreen.kt @@ -28,7 +28,6 @@ import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonGroup import androidx.compose.material3.ButtonGroupScope -import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.Icon @@ -60,6 +59,7 @@ import de.jeanlucmakiola.floret.components.GroupedRow import de.jeanlucmakiola.floret.components.OptionPicker import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.floret.components.pastelize +import de.jeanlucmakiola.floret.components.BusyIndicator private val PICK_TYPES = arrayOf("text/calendar", "text/x-vcalendar", "application/zip", "*/*") @@ -312,7 +312,7 @@ private fun Progress(label: String) { verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), ) { - CircularProgressIndicator(Modifier.size(18.dp)) + BusyIndicator(Modifier.size(18.dp)) Text( text = label, style = MaterialTheme.typography.bodyMedium, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/BackupScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/BackupScreen.kt index 08cfdd3..4cfaf9c 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/BackupScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/BackupScreen.kt @@ -5,7 +5,6 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size -import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -40,6 +39,7 @@ import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.floret.locale.relativeTimeAgo import de.jeanlucmakiola.floret.reminders.ReminderUnit import de.jeanlucmakiola.floret.reminders.decomposeReminderMinutes +import de.jeanlucmakiola.floret.components.BusyIndicator /** Backup & restore: export, import and the automatic backup (after Calendula). */ @Composable @@ -113,7 +113,7 @@ internal fun BackupScreen( title = stringResource(R.string.backup_auto_now), position = Position.Bottom, dimmed = state.running, - trailing = if (state.running) ({ CircularProgressIndicator(Modifier.size(20.dp)) }) else null, + trailing = if (state.running) ({ BusyIndicator(Modifier.size(20.dp)) }) else null, onClick = viewModel::backUpNow.takeUnless { state.running }, ) GroupedHint(backupStatusText(state), style = MaterialTheme.typography.bodySmall) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt index 9d1280c..c1f0169 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsViewModel.kt @@ -99,8 +99,8 @@ data class TransferUiState( ) /** - * Drives both the Settings screen and the app theme (MainActivity collects the - * same instance), so a theme change applies app-wide at once. + * Drives the Settings screens. The app theme reads the stored settings itself, + * so a change made here applies app-wide at once. */ @HiltViewModel class SettingsViewModel @Inject constructor( @@ -116,9 +116,9 @@ class SettingsViewModel @Inject constructor( repository: TasksRepository, ) : ViewModel() { - // MainActivity collects this for the theme, above the permission gate and for - // the whole Activity lifetime — so the list flow must survive the pre-grant - // SecurityException and recover once permission is given, not die for good. + // The list flow may be collected before the provider permission is granted, so + // it must survive the pre-grant SecurityException and recover once permission + // is given, not die for good. val state: StateFlow = combine( prefs.settings, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/StorageScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/StorageScreen.kt index 088bea9..1d28b98 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/StorageScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/StorageScreen.kt @@ -18,7 +18,6 @@ import androidx.compose.material.icons.rounded.MoveDown import androidx.compose.material.icons.rounded.PhoneAndroid import androidx.compose.material.icons.rounded.SwapHoriz import androidx.compose.material3.AlertDialog -import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -47,6 +46,7 @@ import de.jeanlucmakiola.floret.components.FullScreenPicker import de.jeanlucmakiola.floret.components.GroupedRow import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.floret.components.SelectedCheck +import de.jeanlucmakiola.floret.components.BusyIndicator /** * Where the tasks live: the store picker the resolver's `autoMode()` has always @@ -282,7 +282,7 @@ private fun TransferStatus(state: TransferUiState) { verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), ) { - CircularProgressIndicator(Modifier.size(18.dp)) + BusyIndicator(Modifier.size(18.dp)) Text( text = stringResource(R.string.settings_copy_running), style = MaterialTheme.typography.bodyMedium, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt index 0a804ad..7a977be 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt @@ -139,6 +139,7 @@ import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.floret.identity.FloretDensity import de.jeanlucmakiola.floret.identity.byDensity import de.jeanlucmakiola.floret.identity.reducibleSpec +import de.jeanlucmakiola.floret.identity.rememberReduceMotion import de.jeanlucmakiola.floret.components.ActionButton import de.jeanlucmakiola.agendula.ui.common.ActionShapes import java.time.LocalDate @@ -522,6 +523,7 @@ private fun TaskListBody( bottomBarShown -> Modifier.padding(bottom = inner.calculateBottomPadding()) else -> Modifier.imePadding() } + val reduceMotion = rememberReduceMotion() LazyColumn( modifier = Modifier.fillMaxSize().then(viewport), contentPadding = PaddingValues( @@ -612,7 +614,8 @@ private fun TaskListBody( // animateItem so an (un)expanding group fades its subtasks in/out // and slides the rows below — clean whether the children were // already loaded (real list) or arrive a frame later (smart list). - val rowModifier = Modifier.animateItem() + // Under reduced motion they only fade; nothing slides. + val rowModifier = if (reduceMotion) Modifier.animateItem(placementSpec = null) else Modifier.animateItem() when (val row = r.row) { is ListRow.Parent -> TaskRow( modifier = rowModifier, diff --git a/floret-kit b/floret-kit index 381ddc9..7d3b7b7 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 381ddc99a0257481bb7fadc70027f361fa2de88c +Subproject commit 7d3b7b7e45e7f5c78a08afd5a2a1bd1eb72e4869 From 89fa58ddffce5fef8857b4955b2afddb157c20f0 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 14:02:23 +0100 Subject: [PATCH 13/13] Review fixes: indeterminate still pull indicator, Dp corner springs, add-subtask row on the nested token (#118, #157) --- .../agendula/ui/common/SyncPullBox.kt | 7 ++++++- .../jeanlucmakiola/agendula/ui/lists/ListsScreen.kt | 6 ++++-- .../agendula/ui/tasklist/TaskListScreen.kt | 13 +++++++------ floret-kit | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt index 1724605..e5ab3f9 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/common/SyncPullBox.kt @@ -16,6 +16,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import de.jeanlucmakiola.floret.identity.rememberLoopingMotion +import androidx.compose.ui.semantics.ProgressBarRangeInfo +import androidx.compose.ui.semantics.clearAndSetSemantics +import androidx.compose.ui.semantics.progressBarRangeInfo /** * Pull down to sync every account (#73). Without an account there is nothing @@ -58,7 +61,9 @@ fun SyncPullBox( ) { CircularProgressIndicator( progress = { if (syncing) 1f else state.distanceFraction.coerceIn(0f, 1f) }, - modifier = Modifier.size(24.dp), + modifier = Modifier + .size(24.dp) + .clearAndSetSemantics { progressBarRangeInfo = ProgressBarRangeInfo.Indeterminate }, strokeWidth = 2.5.dp, ) } 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 f881caf..4cf7b11 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 @@ -9,6 +9,7 @@ import androidx.compose.material.icons.rounded.SwapVert import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.animateDpAsState +import androidx.compose.animation.core.VisibilityThreshold import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween import androidx.compose.animation.expandHorizontally @@ -79,6 +80,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -654,7 +656,7 @@ private fun SearchResults( private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) { val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, reducibleSpec(spring()), label = "todayCorner") + val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, reducibleSpec(spring(visibilityThreshold = Dp.VisibilityThreshold)), label = "todayCorner") val left = total - done Surface( onClick = onClick, @@ -852,7 +854,7 @@ private fun SmartCard(count: SmartCount, modifier: Modifier = Modifier, onClick: val style = smartStyle(count.smart) val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, reducibleSpec(spring()), label = "smartCorner") + val corner by animateDpAsState(if (pressed) 34.dp else 22.dp, reducibleSpec(spring(visibilityThreshold = Dp.VisibilityThreshold)), label = "smartCorner") Surface( onClick = onClick, shape = RoundedCornerShape(corner), diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt index 7a977be..741a8be 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/tasklist/TaskListScreen.kt @@ -4,6 +4,7 @@ import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.VisibilityThreshold import androidx.compose.animation.core.spring import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut @@ -107,6 +108,7 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -137,7 +139,6 @@ import de.jeanlucmakiola.floret.time.formatDateTimeCompact import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf import de.jeanlucmakiola.floret.identity.FloretDensity -import de.jeanlucmakiola.floret.identity.byDensity import de.jeanlucmakiola.floret.identity.reducibleSpec import de.jeanlucmakiola.floret.identity.rememberReduceMotion import de.jeanlucmakiola.floret.components.ActionButton @@ -817,8 +818,8 @@ internal fun TaskRowContent( ) { val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val full by animateDpAsState(if (pressed) 36.dp else 22.dp, reducibleSpec(spring()), label = "fullCorner") - val small by animateDpAsState(if (pressed) 36.dp else 6.dp, reducibleSpec(spring()), label = "smallCorner") + val full by animateDpAsState(if (pressed) 36.dp else 22.dp, reducibleSpec(spring(visibilityThreshold = Dp.VisibilityThreshold)), label = "fullCorner") + val small by animateDpAsState(if (pressed) 36.dp else 6.dp, reducibleSpec(spring(visibilityThreshold = Dp.VisibilityThreshold)), label = "smallCorner") val dark = isSystemInDarkTheme() val due = task.shownValue(TaskEnd.DUE)?.formatDateTimeCompact(!task.hasTime(TaskEnd.DUE), LocalUse24HourFormat.current) val listName = task.listName?.takeIf { showListName && it.isNotBlank() } @@ -1046,7 +1047,7 @@ private fun AddSubtaskRow( modifier = modifier.fillMaxWidth().padding(horizontal = 16.dp).then(gap).revealOnFocus(), ) { Row( - modifier = Modifier.fillMaxWidth().heightIn(min = byDensity(52.dp, 48.dp)).padding(start = 12.dp, end = 8.dp), + modifier = Modifier.fillMaxWidth().heightIn(min = FloretDensity.nestedRowHeight).padding(start = 12.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically, ) { Spacer(Modifier.width(5.dp)) // the parents' colour-bar slot, kept for alignment @@ -1170,8 +1171,8 @@ private fun SubtaskRow( ) val interaction = remember { MutableInteractionSource() } val pressed by interaction.collectIsPressedAsState() - val full by animateDpAsState(if (pressed) 36.dp else 22.dp, reducibleSpec(spring()), label = "subFullCorner") - val small by animateDpAsState(if (pressed) 36.dp else 6.dp, reducibleSpec(spring()), label = "subSmallCorner") + val full by animateDpAsState(if (pressed) 36.dp else 22.dp, reducibleSpec(spring(visibilityThreshold = Dp.VisibilityThreshold)), label = "subFullCorner") + val small by animateDpAsState(if (pressed) 36.dp else 6.dp, reducibleSpec(spring(visibilityThreshold = Dp.VisibilityThreshold)), label = "subSmallCorner") val gap = if (lastInRun) Modifier else Modifier.padding(bottom = 2.dp) SwipeToDismissBox( state = dismissState, diff --git a/floret-kit b/floret-kit index 7d3b7b7..a7f8166 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 7d3b7b7e45e7f5c78a08afd5a2a1bd1eb72e4869 +Subproject commit a7f8166c4be0d791df965cbed4a556e2ad7a2882