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.

Every container of rows is the Files list's liquid glass

chethan6166310df85df4c
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 e959722..8453d50 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
@@ -177,7 +177,7 @@ fun glassDim(heavy: Boolean = false): Color {
*/
@Composable
fun GlassListPanel(modifier: Modifier = Modifier, shape: Shape = RoundedRectangle(28.dp), content: @Composable ColumnScope.() -> Unit) {
- Column(modifier.glass(shape, blur = 20.dp, lensHeight = 14.dp, lensAmount = 20.dp, dim = glassDim(heavy = true)), content = content)
+ Column(modifier.wash(shape), content = content)
}
/**
@@ -228,12 +228,24 @@ fun GlassHost(
}
/**
- * The wash panel scrolling lists use: the glass's tint and its lit rim without the backdrop pass.
- * Over the aurora's soft gradients a blur changes almost nothing, but re-sampling every panel on
- * every scrolled frame costs a lot; floating chrome keeps the real glass.
+ * A container of rows (a Settings group, a tool's panel): the same liquid glass as the Files list
+ * and its search bar, app-wide. The wallpaper refracts and frosts through it at the user's preset
+ * (Settings ▸ Liquid glass), under a dimming layer that is strong only over a picture of their own
+ * ([glassDim]), so its words read on any wallpaper. It used to be a flat wash (tint and rim, no
+ * backdrop) while Files was glass; now every container is one kind of glass. Solid while glass is
+ * ([solidGlass]: Clean, or Reduce transparency).
+ */
+@Composable
+fun Modifier.wash(shape: Shape = RoundedRectangle(28.dp), tint: Color = clear.glass): Modifier =
+ glass(shape, wash = tint, blur = 20.dp, lensHeight = 14.dp, lensAmount = 20.dp, dim = glassDim(heavy = true)).clip(shape)
+
+/**
+ * The old flat wash: the glass's tint and its lit rim, without the backdrop pass. Only for a grid of
+ * many small cards that scroll (the Pages screen's page cards), where a backdrop pass per card on
+ * every scrolled frame would cost too much for what a blur adds there.
*/
@Composable
-fun Modifier.wash(shape: Shape = RoundedRectangle(28.dp), tint: Color = clear.glass): Modifier {
+fun Modifier.flatWash(shape: Shape = RoundedRectangle(20.dp), tint: Color = clear.glass): Modifier {
if (solidGlass) return clip(shape).background(clear.solidPanel)
val dark = clear.dark
val rimTop = Color.White.copy(alpha = if (dark) 0.16f else 0.70f)
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt
index c985edc..b4a2340 100644
--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt
+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt
@@ -1,5 +1,6 @@
package com.chethan616.clearpdf.ui.viewer
+import com.chethan616.clearpdf.ui.glass.flatWash
import com.chethan616.clearpdf.ui.safeTopPadding
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.Image
@@ -222,7 +223,7 @@ fun PagesScreen(vm: AppViewModel, doc: OpenDocument, onClose: () -> Unit) {
horizontalAlignment = Alignment.CenterHorizontally,
) {
Box(
- Modifier.size(cardW, 162.dp).then(com.chethan616.clearpdf.ui.glass.washPanel())
+ Modifier.size(cardW, 162.dp).flatWash()
.then(if (highlighted) Modifier.border(2.dp, com.chethan616.clearpdf.ui.theme.Candy.Sky, com.chethan616.clearpdf.ui.glass.RoundedRectangle(20.dp)) else Modifier),
contentAlignment = Alignment.Center,
) {
@@ -321,3 +322,4 @@ private fun androidx.compose.foundation.layout.RowScope.OrganizeItem(icon: Image
com.chethan616.clearpdf.ui.glass.GlassIcon(icon, null, Modifier.size(24.dp).graphicsLayer { alpha = if (enabled) 1f else 0.35f })
}
}
+