From 18e03e27b6302301f462dd9ee21c7c97f4408cd3 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sun, 28 Jun 2026 12:59:56 +0200 Subject: [PATCH] identity: draw the M3 Expressive theme factory + nav slide from floret-kit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3 (identity layer). AgendulaTheme is now a thin wrapper over the kit's FloretExpressiveTheme(lightScheme, darkScheme, …): the shared mechanics (dynamic colour, light/dark, standard motion scheme) live in floret-kit, while Agendula keeps its own identity — the seed-derived AgendulaLight/DarkFallback schemes and AgendulaTypography (unchanged in Color.kt/Type.kt). rememberNavSlideSpec now comes from the kit; the app's AgendulaTransitions.kt is removed and the NavHost import repointed. Submodule re-pinned to the identity kit commit. Clean composite build + tests + lintDebug + debug assemble green; substitution confirmed (de.jeanlucmakiola.floret:identity -> project :floret-kit:identity). Co-Authored-By: Claude Opus 4.8 (1M context) --- app/build.gradle.kts | 1 + .../agendula/ui/navigation/AgendulaNavHost.kt | 1 + .../ui/navigation/AgendulaTransitions.kt | 21 ---------- .../jeanlucmakiola/agendula/ui/theme/Theme.kt | 42 +++++-------------- floret-kit | 2 +- 5 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaTransitions.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 84b2285..bcac3f1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -122,6 +122,7 @@ dependencies { implementation(libs.kotlinx.coroutines.core) implementation("de.jeanlucmakiola.floret:core-time") implementation("de.jeanlucmakiola.floret:core-crash") + implementation("de.jeanlucmakiola.floret:identity") debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) 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 4abcc52..1c102d5 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,5 +1,6 @@ package de.jeanlucmakiola.agendula.ui.navigation +import de.jeanlucmakiola.floret.identity.rememberNavSlideSpec import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.fadeIn diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaTransitions.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaTransitions.kt deleted file mode 100644 index 2ee421d..0000000 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/navigation/AgendulaTransitions.kt +++ /dev/null @@ -1,21 +0,0 @@ -package de.jeanlucmakiola.agendula.ui.navigation - -import androidx.compose.animation.core.FiniteAnimationSpec -import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi -import androidx.compose.material3.MaterialTheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.unit.IntOffset - -/** - * The horizontal slide spec for screen-to-screen navigation: the *fast* - * spring-physics spec from the active motion scheme — snappy with a subtle - * springy settle, rather than a fixed easing curve. Same choice as Calendula's - * calendar slide, so the two apps move the same way. - * - * Read in composable scope so the non-composable `NavHost` transition lambdas - * can capture it. - */ -@OptIn(ExperimentalMaterial3ExpressiveApi::class) -@Composable -fun rememberNavSlideSpec(): FiniteAnimationSpec = - MaterialTheme.motionScheme.fastSpatialSpec() 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 451db94..2bca6f8 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 @@ -1,48 +1,28 @@ package de.jeanlucmakiola.agendula.ui.theme -import android.os.Build import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi -import androidx.compose.material3.MaterialExpressiveTheme -import androidx.compose.material3.MotionScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext +import de.jeanlucmakiola.floret.identity.FloretExpressiveTheme /** - * App theme. Honors: - * - System light/dark. - * - Dynamic Color on API 31+, else falls back to the hand-tuned scheme - * derived from [AgendulaSeed]. - * - * Mirrors Calendula's theme: MaterialExpressiveTheme routes all component + - * custom motion through MaterialTheme.motionScheme. STANDARD over expressive() - * is the same deliberate choice — spring choreography without the overshoot. - * - * A Settings screen can later override dynamicColor and theme mode; the M0 - * foundation just follows the system. + * Agendula's theme: the family's [FloretExpressiveTheme] machinery (dynamic + * colour on API 31+, system light/dark, the standard motion scheme) fed with + * Agendula's own identity — its seed-derived fallback schemes + * ([AgendulaLightFallback] / [AgendulaDarkFallback]) and [AgendulaTypography]. + * The mechanics live in floret-kit; the look stays here. */ -@OptIn(ExperimentalMaterial3ExpressiveApi::class) @Composable fun AgendulaTheme( darkTheme: Boolean = isSystemInDarkTheme(), dynamicColor: Boolean = true, content: @Composable () -> Unit, ) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val ctx = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(ctx) else dynamicLightColorScheme(ctx) - } - darkTheme -> AgendulaDarkFallback - else -> AgendulaLightFallback - } - - MaterialExpressiveTheme( - colorScheme = colorScheme, + FloretExpressiveTheme( + lightScheme = AgendulaLightFallback, + darkScheme = AgendulaDarkFallback, + darkTheme = darkTheme, + dynamicColor = dynamicColor, typography = AgendulaTypography, - motionScheme = MotionScheme.standard(), content = content, ) } diff --git a/floret-kit b/floret-kit index 19c2f8a..dccf934 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 19c2f8a6778ba1971c56be4248dc6f6ac98f7dec +Subproject commit dccf934172df2bb6fbfd0969a93ff9ae2f188d6a