Skip to content

Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.

Onboarding offers the motion profiles; Bouncy is the default

chethan61688d94fa60c22
diff --git a/DESIGN.md b/DESIGN.md
index d08091b..d51404e 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -95,7 +95,9 @@ Use the shared springs in `GlassMotion` (or springs close to them):
**The user tunes it (Settings -> Liquid Glass -> Motion).** `MotionSettings` holds multipliers on
the numbers above (bounce, speed, press depth, release jiggle, drag stretch, long-press bloom) with
-the profiles Normal (the design, exactly), Performance, Bouncy and Super springy. So every bouncing
+the profiles Normal (the design, exactly), Performance, Bouncy and Super springy. Bouncy
+(`MotionStyle.Default`) runs until the user picks one, here or in the onboarding Appearance step,
+and Reset returns to it. So every bouncing
spring goes through `MotionSettings.damping(designed)` / `stiffness(designed)`, and every press
size goes through the style. The `GlassMotion` springs already do. A new bouncing spring written
by hand must do the same. `settle`, `fade` and layout springs never bounce and ignore it.
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/MotionSettings.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/MotionSettings.kt
index 9b16e80..559e71d 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/MotionSettings.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/MotionSettings.kt
@@ -8,7 +8,8 @@ import androidx.compose.runtime.setValue
/**
* How springy the Liquid Glass motion is (Settings -> Liquid Glass -> Motion). Every value is a
- * multiplier on the physics the app was designed with, so [Normal] reproduces it exactly:
+ * multiplier on the physics the app was designed with, so [Normal] reproduces it exactly. Until the
+ * user picks one (in Settings or the onboarding tour) the app runs [Default], which is [Bouncy]:
*
* - [bounce]: 0.5 is the design; higher lowers the springs' damping (more overshoot), lower raises
* it. Springs that must never bounce (fades, layout, dismissals) ignore it.
@@ -33,13 +34,15 @@ data class MotionStyle(
val Bouncy = MotionStyle(bounce = 0.75f, speed = 0.92f, press = 1.3f, wobble = 1.6f, stretch = 1.2f, bloom = 1.2f)
val SuperSpringy = MotionStyle(bounce = 0.95f, speed = 0.82f, press = 1.6f, wobble = 2.2f, stretch = 1.5f, bloom = 1.5f)
val Presets = listOf(Normal, Performance, Bouncy, SuperSpringy)
+ /** What the app runs until the user picks a profile, and what Reset returns to. */
+ val Default = Bouncy
}
}
object MotionSettings {
private const val PREFS = "ui_prefs"
- var style: MotionStyle by mutableStateOf(MotionStyle.Normal)
+ var style: MotionStyle by mutableStateOf(MotionStyle.Default)
private set
private var loaded = false
@@ -48,7 +51,7 @@ object MotionSettings {
if (loaded) return
loaded = true
val p = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
- val d = MotionStyle.Normal
+ val d = MotionStyle.Default
style = MotionStyle(
bounce = p.getFloat("motion_bounce", d.bounce),
speed = p.getFloat("motion_speed", d.speed),
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/OnboardingScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/OnboardingScreen.kt
index 8e36121..b1b384d 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/OnboardingScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/OnboardingScreen.kt
@@ -616,6 +616,41 @@ private fun AppearanceChooser(
}
}
+ // Motion profile: the same presets as Settings -> Liquid Glass -> Motion (Bouncy until the
+ // user picks). Each chip is itself a glass button, so tapping one plays the new physics.
+ BasicText(
+ stringResource(R.string.glass_motion),
+ style = TextStyle(inkSoft, 13.sp, fontWeight = FontWeight.SemiBold)
+ )
+ val motionStyle = com.chethan616.clearpdf.ui.components.MotionSettings.style
+ val motionPresets = listOf(
+ com.chethan616.clearpdf.ui.components.MotionStyle.Normal to stringResource(R.string.motion_preset_normal),
+ com.chethan616.clearpdf.ui.components.MotionStyle.Performance to stringResource(R.string.motion_preset_performance),
+ com.chethan616.clearpdf.ui.components.MotionStyle.Bouncy to stringResource(R.string.motion_preset_bouncy),
+ com.chethan616.clearpdf.ui.components.MotionStyle.SuperSpringy to stringResource(R.string.motion_preset_super)
+ )
+ Row(
+ Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()),
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ motionPresets.forEach { (preset, label) ->
+ val selected = motionStyle == preset
+ LiquidButton(
+ onClick = { com.chethan616.clearpdf.ui.components.MotionSettings.update(context, preset) },
+ backdrop = backdrop,
+ tint = if (selected) LiquidGlassColors.Purple else Color.Unspecified,
+ surfaceColor = if (selected) Color.Unspecified else (if (isDark) Color.White.copy(0.10f) else Color.Black.copy(0.06f)),
+ horizontalContentPadding = 14.dp
+ ) {
+ BasicText(
+ label,
+ style = TextStyle(if (selected) Color.White else ink, 12.sp, fontWeight = if (selected) FontWeight.Bold else FontWeight.Medium),
+ maxLines = 1
+ )
+ }
+ }
+ }
+
Box(Modifier.fillMaxWidth().height(1.dp).background(ink.copy(0.10f)))
Row(
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
index ec86be2..1b552ab 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
@@ -822,7 +822,7 @@ private fun MotionTuningSection(
Spacer(Modifier.height(8.dp))
ToolPrimaryButton(
text = stringResource(R.string.motion_reset),
- onClick = { set(com.chethan616.clearpdf.ui.components.MotionStyle.Normal) },
+ onClick = { set(com.chethan616.clearpdf.ui.components.MotionStyle.Default) },
backdrop = backdrop,
accent = LiquidGlassColors.Purple,
icon = Icons.Rounded.Refresh,