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.

Fan chips swing clear of the column's edge; Reduce transparency is Liquid Glass's

chethan616cd1489910239
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt
index dcae762..25b24c4 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt
@@ -157,7 +157,8 @@ private fun SettingsRoot(vm: AppViewModel, openLicences: () -> Unit, openGlass:
Panel {
ThemePicker(vm.theme) { vm.setThemeChoice(it) }
AppearancePicker(vm.cleanAppearance, vm::updateCleanAppearance)
- ToggleRow(
+ // a Liquid Glass setting: Clean is solid surfaces already
+ if (!vm.cleanAppearance) ToggleRow(
LucideIcons.Contrast, Candy.Sky, stringResource(R.string.settings_reduce_transparency),
stringResource(R.string.settings_reduce_transparency_detail), GlassSettings.reduceTransparency,
) { GlassSettings.updateReduceTransparency(context, it) }
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt
index c03c62d..628aaef 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Style.kt
@@ -117,11 +117,10 @@ object GlassSettings {
private set
/**
- * Reduce transparency (Settings ▸ Look & feel, either appearance): nothing shows through. In Liquid
- * Glass every glass surface (buttons, title pills, bars, tabs, menus, sheets, panels) is drawn
- * solid in the theme's frost; in Clean the controls that float over content (the reader's toolbar,
- * the desk's pinned filters, the bottom pill) are solid too (#158). The wallpaper, colours and
- * motion stay. Off by default, on by default when the system asks for high contrast.
+ * Reduce transparency (Settings ▸ Look & feel, in Liquid Glass): nothing shows through. Every glass
+ * surface (buttons, title pills, bars, tabs, menus, sheets, panels) is drawn solid in the theme's
+ * frost (#158); the wallpaper, colours and motion stay. Clean is solid surfaces already, so it is
+ * not offered there. Off by default, on by default when the system asks for high contrast.
*/
var reduceTransparency: Boolean by mutableStateOf(false)
private set
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt
index 8453d50..5ad9873 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt
@@ -50,7 +50,8 @@ val solidGlass: Boolean
@Composable
internal fun Modifier.cleanFloatingSurface(shape: Shape, strongestAtTop: Boolean = false): Modifier {
val panel = clear.solidPanel
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || GlassSettings.reduceTransparency) {
+ // (Reduce transparency is a Liquid Glass setting: Clean's floating bars keep their own frost)
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
return clip(shape).background(panel)
}
val mask = remember(strongestAtTop) {
@@ -69,9 +70,7 @@ internal fun Modifier.cleanFloatingSurface(shape: Shape, strongestAtTop: Boolean
},
highlight = null,
shadow = null,
- // Frosted enough to read on, clear enough to see what passes under: at 82% the blur showed so
- // little that Reduce transparency (fully solid) seemed to change nothing (#158)
- ).background(panel.copy(alpha = 0.66f), shape)
+ ).background(panel.copy(alpha = 0.82f), shape)
}
/**
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
index 9672e1c..0328459 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt
@@ -412,6 +412,9 @@ private fun PlusButton(open: Boolean, onClick: () -> Unit) {
/** A way to make something, in the fan. */
private class FanItem(val icon: ImageVector, val label: String, val accent: Color, val go: () -> Unit)
+/** How far past rest the fan's springiest chip may swing (Settings ▸ Motion at its bounciest), kept clear above it. */
+private val FanSwingRoom = 32.dp
+
/** The fan: the ways to make something, rising from the + one after another. */
@Composable
private fun BoxScope.Fan(vm: AppViewModel, desk: DeskState, open: Boolean, onBrowse: () -> Unit, onScanQr: () -> Unit) {
@@ -439,6 +442,9 @@ private fun BoxScope.Fan(vm: AppViewModel, desk: DeskState, open: Boolean, onBro
verticalArrangement = Arrangement.spacedBy(10.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
+ // room above the top chip for its spring to swing past rest: the column scrolls, so it clips
+ // to its own bounds, and the top chip ("New note") was cut at the top of its bounce
+ Spacer(Modifier.height(FanSwingRoom))
items.forEachIndexed { i, item -> FanChip(item, i, items.size, open, body) }
}
}