From 37662e83bbfdf08a51789c3feb60afbc8efd2808 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sun, 28 Jun 2026 14:31:20 +0200 Subject: [PATCH] nav: swap the full slide-back for the predictive-back peek MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Back was a full-width horizontal slide-off — too heavy. Replace it with floret-kit's Modifier.predictiveBack on each pop-able destination (task list, detail, edit) so the leaving screen scales/rounds with the gesture and the held screen is revealed unmoved; NavHost now does no pop animation. Settings applies it at the hub only (enabled = section == null) so its inner section back still returns to the hub. Forward stays a calm fade-in. Bumps the floret-kit submodule. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../agendula/ui/navigation/AgendulaNavHost.kt | 16 +++++++++------- .../agendula/ui/settings/SettingsScreen.kt | 4 ++++ floret-kit | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt index 1c102d5..9f1f771 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaNavHost.kt @@ -1,11 +1,9 @@ package de.jeanlucmakiola.agendula.ui.navigation -import de.jeanlucmakiola.floret.identity.rememberNavSlideSpec +import de.jeanlucmakiola.floret.identity.predictiveBack import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.animation.slideOutHorizontally import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier @@ -35,7 +33,6 @@ import de.jeanlucmakiola.agendula.ui.tasklist.TaskListViewModel @Composable fun AgendulaNavHost(modifier: Modifier = Modifier) { val nav = rememberNavController() - val slide = rememberNavSlideSpec() NavHost( navController = nav, @@ -43,12 +40,14 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { modifier = modifier, // Only the screen on top moves; the background is always held static. // Forward is a plain fade-in over the held screen — calm, not a slide. - // Back (and the predictive-back drag, which drives popExit) is the snappy - // slide-out to the right, revealing the held screen unmoved. + // Back is the system predictive-back peek: each destination applies + // Modifier.predictiveBack, so the leaving screen scales/rounds with the + // gesture and the held screen is revealed unmoved. NavHost itself does no + // pop animation (the screen owns the motion). enterTransition = { fadeIn() }, exitTransition = { ExitTransition.None }, popEnterTransition = { EnterTransition.None }, - popExitTransition = { slideOutHorizontally(slide) { it } + fadeOut() }, + popExitTransition = { ExitTransition.None }, ) { composable(Dest.LISTS) { ListsScreen( @@ -72,6 +71,7 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { LaunchedEffect(filter) { vm.bind(filter) } TaskListScreen( + modifier = Modifier.predictiveBack(onBack = { nav.popBackStack() }), filter = filter, viewModel = vm, onOpenTask = { taskId -> nav.navigate(Dest.TaskDetail.build(taskId)) }, @@ -89,6 +89,7 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { LaunchedEffect(taskId) { vm.bind(taskId) } TaskDetailScreen( + modifier = Modifier.predictiveBack(onBack = { nav.popBackStack() }), viewModel = vm, onEdit = { nav.navigate(Dest.TaskEdit.buildEdit(taskId)) }, onDeleted = { nav.popBackStack() }, @@ -117,6 +118,7 @@ fun AgendulaNavHost(modifier: Modifier = Modifier) { } TaskEditScreen( + modifier = Modifier.predictiveBack(onBack = { nav.popBackStack() }), viewModel = vm, onSaved = { nav.popBackStack() }, onBack = { nav.popBackStack() }, diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt index a17e866..b6efcd6 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/settings/SettingsScreen.kt @@ -93,6 +93,7 @@ import de.jeanlucmakiola.floret.components.Position import de.jeanlucmakiola.agendula.ui.common.ReminderLeadPicker import de.jeanlucmakiola.floret.components.pastelize import de.jeanlucmakiola.floret.components.positionOf +import de.jeanlucmakiola.floret.identity.predictiveBack import de.jeanlucmakiola.floret.locale.AppLanguage import de.jeanlucmakiola.floret.reminders.ReminderOverride import de.jeanlucmakiola.agendula.ui.common.reminderLeadTimeLabel @@ -128,6 +129,9 @@ fun SettingsScreen( Box( modifier = modifier + // At the hub, the back gesture previews the pop to the lists overview; + // in a section the BackHandler above takes it (section -> hub) instead. + .predictiveBack(onBack = onBack, enabled = section == null) .fillMaxSize() .background(MaterialTheme.colorScheme.surface), ) { diff --git a/floret-kit b/floret-kit index 10e0ca0..2085b82 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 10e0ca0b06fc73a36189c042f4dc0d6d3b669cfa +Subproject commit 2085b82a5e7f445f95e4fb61460c8363202b036e