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.

feat: bounce the search bar open, one glass recipe across the viewers

Chethan616f84e37a42b22
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassSearchHeader.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassSearchHeader.kt
index 1ded116..20ce75b 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassSearchHeader.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassSearchHeader.kt
@@ -95,8 +95,11 @@ val GlassSearchPillHeight = 36.dp
* to the cancel circle.
*
* A single [updateTransition] drives the pill collapse, the leading slot's width, the field's scale
- * and both icon cross-fades — one frame clock, so nothing can drift. Everything here is critically
- * damped: an overshooting width re-measures the glass and re-runs its blur+lens at a new size.
+ * and both icon cross-fades — one frame clock, so nothing can drift. It forks into three floats by
+ * what each one is allowed to do: `progress` owns the layout width and stays critically damped (an
+ * overshooting width re-measures the glass and re-runs its blur+lens at a new size, and a negative
+ * one throws), `fade` owns alpha and stays critically damped (overshoot clips at 1.0 and reads as a
+ * flicker), and `bounce` owns the scales and the icon spin, where overshoot is the whole point.
*/
@Composable
fun GlassSearchHeader(
@@ -117,14 +120,23 @@ fun GlassSearchHeader(
val keyboard = LocalSoftwareKeyboardController.current
val transition = updateTransition(active, label = "searchHeader")
+ // Owns the leading slot's real WIDTH, so it must never overshoot — a negative width throws.
val progress by transition.animateFloat(
- transitionSpec = { spring(dampingRatio = 0.9f, stiffness = Spring.StiffnessMediumLow) },
+ transitionSpec = { GlassMotion.settle() },
label = "searchProgress"
) { if (it) 1f else 0f }
val fade by transition.animateFloat(
- transitionSpec = { spring(dampingRatio = 1f, stiffness = Spring.StiffnessMedium) },
+ transitionSpec = { GlassMotion.fade() },
label = "searchFade"
) { if (it) 1f else 0f }
+ // The bounce rides its own clock so it can overshoot without dragging `progress` — and therefore
+ // the layout width — past 1. Everything it drives is a draw-time property, so the overshoot costs
+ // a layer-matrix update, not a re-measure: `drawBackdrop` never re-runs its blur or lens.
+ // Open only. Overshooting on close drives the scale under its floor and reads as a glitch.
+ val bounce by transition.animateFloat(
+ transitionSpec = { if (targetState) GlassMotion.morph() else GlassMotion.settle() },
+ label = "searchBounce"
+ ) { if (it) 1f else 0f }
val dismiss = {
onQueryChange("")
@@ -148,8 +160,9 @@ fun GlassSearchHeader(
) {
// Idle, this balances the trailing circle so the title pill sits dead-centre. As search
// opens it collapses — width and its trailing gap both go to zero — so the field gets the
- // whole row. `progress` is critically damped, so the width only ever shrinks monotonically.
- val leadingWidth = (HeaderCircleSize + HeaderGap) * (1f - progress)
+ // whole row. `progress` is critically damped, so the width only ever shrinks monotonically;
+ // the clamp is belt-and-braces, because Modifier.width() throws on a negative value.
+ val leadingWidth = (HeaderCircleSize + HeaderGap) * (1f - progress).coerceAtLeast(0f)
Box(
Modifier
.width(leadingWidth)
@@ -165,7 +178,9 @@ fun GlassSearchHeader(
Box(
Modifier.graphicsLayer {
alpha = 1f - fade
- val s = lerp(1f, 0.86f, progress.coerceIn(0f, 1f))
+ // Clamped: the pill only needs the eased shape, not the overshoot — it is on
+ // its way out and a rebound would fight the fade.
+ val s = lerp(1f, 0.86f, bounce.coerceIn(0f, 1f))
scaleX = s
scaleY = s
}
@@ -185,10 +200,11 @@ fun GlassSearchHeader(
.graphicsLayer {
alpha = fade
// Grow out of the circle: the capsule's right edge is pinned, so it
- // unfurls leftward and overshoots a hair before settling.
+ // unfurls leftward, overshoots past full width and springs back. The
+ // overshoot runs into the leading slot, which has collapsed by then.
transformOrigin = TransformOrigin(1f, 0.5f)
- scaleX = lerp(0.32f, 1f, progress)
- scaleY = lerp(0.72f, 1f, progress)
+ scaleX = lerp(0.32f, 1f, bounce)
+ scaleY = lerp(0.72f, 1f, bounce)
}
) {
GlassSearchPill(
@@ -217,9 +233,10 @@ fun GlassSearchHeader(
) {
val tint = LiquidGlassColors.text(LocalIsDarkMode.current)
// The icon spins a quarter turn as it swaps, so the circle feels like it re-purposes
- // rather than just blinking to a new glyph.
+ // rather than just blinking to a new glyph. On `bounce`, so it overshoots the turn in
+ // step with the capsule instead of arriving ahead of it.
Box(
- Modifier.graphicsLayer { rotationZ = lerp(0f, 90f, progress) },
+ Modifier.graphicsLayer { rotationZ = lerp(0f, 90f, bounce) },
contentAlignment = Alignment.Center
) {
if (showTitle) {
@@ -250,6 +267,8 @@ fun GlassSearchHeader(
*
* @param animateIn set `false` when a caller already animates the pill in (e.g. [GlassSearchHeader]
* grows it out of the search circle) — otherwise the two entrances stack.
+ * @param viewerChrome set `true` inside the viewers, where the pill wears [viewerGlass]'s lighter
+ * stack so it matches the top bar's title pill instead of the app-chrome one Home and Tools use.
* @param trailing an optional slot before the clear button, e.g. the find bar's "3 / 12" counter.
*/
@Composable
@@ -263,6 +282,7 @@ fun GlassSearchPill(
focusRequester: FocusRequester? = null,
onSubmit: () -> Unit = {},
animateIn: Boolean = true,
+ viewerChrome: Boolean = false,
surfaceColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
hintColor: Color = Color.Unspecified,
@@ -298,20 +318,29 @@ fun GlassSearchPill(
scaleY = enterScale
alpha = enterAlpha
}
- .drawBackdrop(
- backdrop = backdrop,
- shape = { Capsule },
- effects = {
- vibrancy()
- blur(8f.dp.toPx())
- lens(16f.dp.toPx(), 32f.dp.toPx())
- },
- highlight = {
- Highlight(style = HighlightStyle.Default(angle = uiSensor.gravityAngle, falloff = 2f))
- },
- shadow = { Shadow(radius = 6f.dp, color = Color.Black.copy(alpha = 0.08f)) },
- innerShadow = { InnerShadow(radius = 2f.dp, alpha = 0.25f) },
- onDrawSurface = { drawRect(containerColor) }
+ // Two stacks, one shape. In the viewers the pill has to be the same material as the top
+ // bar's title pill, which is a plain LiquidButton — lighter blur, shallower lens, and the
+ // library's default highlight/shadow rather than the gravity-angled app-chrome ones.
+ .then(
+ if (viewerChrome) {
+ Modifier.viewerGlass(backdrop, containerColor, shape = { Capsule })
+ } else {
+ Modifier.drawBackdrop(
+ backdrop = backdrop,
+ shape = { Capsule },
+ effects = {
+ vibrancy()
+ blur(8f.dp.toPx())
+ lens(16f.dp.toPx(), 32f.dp.toPx())
+ },
+ highlight = {
+ Highlight(style = HighlightStyle.Default(angle = uiSensor.gravityAngle, falloff = 2f))
+ },
+ shadow = { Shadow(radius = 6f.dp, color = Color.Black.copy(alpha = 0.08f)) },
+ innerShadow = { InnerShadow(radius = 2f.dp, alpha = 0.25f) },
+ onDrawSurface = { drawRect(containerColor) }
+ )
+ }
)
.height(GlassSearchPillHeight)
.padding(horizontal = 12.dp),
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/ShareMorphButton.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/ShareMorphButton.kt
index e12566a..825ee0e 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/ShareMorphButton.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/ShareMorphButton.kt
@@ -46,8 +46,8 @@ import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.chethan616.clearpdf.R
-import com.chethan616.clearpdf.ui.utils.UISensor
import com.kyant.backdrop.backdrops.LayerBackdrop
+import com.kyant.shapes.Capsule
/**
* A liquid-glass circle with an Apple-style share gesture: **tap** = [onOpen]; **press-and-hold**
@@ -65,7 +65,6 @@ import com.kyant.backdrop.backdrops.LayerBackdrop
@Composable
fun ShareMorphButton(
backdrop: LayerBackdrop,
- uiSensor: UISensor,
glass: Color,
fg: Color,
onOpen: () -> Unit,
@@ -141,7 +140,10 @@ fun ShareMorphButton(
.width(52.dp)
.height(height)
.graphicsLayer { scaleX = pressScale; scaleY = pressScale }
- .liquidGlassPanel(backdrop, uiSensor, containerColorOverride = surface)
+ // The viewer's own chrome material, so this sits beside the back and search circles as one
+ // family rather than as a frostier slab. Capsule, not a 28 dp rounded rectangle, so the
+ // 52 -> 104 dp morph is an actual circle-to-capsule the whole way up.
+ .viewerGlass(backdrop, surface, shape = { Capsule })
.pointerInput(Unit) {
detectTapGestures(
onPress = {
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/ViewerGlass.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/ViewerGlass.kt
new file mode 100644
index 0000000..508f0dc
--- /dev/null
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/ViewerGlass.kt
@@ -0,0 +1,53 @@
+package com.chethan616.clearpdf.ui.components
+
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.unit.dp
+import com.kyant.backdrop.Backdrop
+import com.kyant.backdrop.drawBackdrop
+import com.kyant.backdrop.effects.blur
+import com.kyant.backdrop.effects.lens
+import com.kyant.backdrop.effects.vibrancy
+import com.kyant.shapes.RoundedRectangle
+
+/**
+ * The PDF viewer top bar's glass, as a modifier for surfaces that are not buttons.
+ *
+ * This is [LiquidIconButton] and [LiquidButton]'s effect stack verbatim — `vibrancy`, a 2 dp blur and
+ * a 12x24 lens, with `highlight`/`shadow` left at `drawBackdrop`'s defaults and no inner shadow —
+ * lifted off their hardcoded circle and capsule so a panel can wear the same material. Those two
+ * components are read-only, hence the copy rather than a shared helper.
+ *
+ * Deliberately lighter than [liquidGlassPanel], which runs an 8 dp blur, a 20x40 depth lens, a
+ * gravity-angled highlight and an inner shadow. That heavier stack is still right for dialogs: they
+ * sit over a scrim and need an edge of their own. Chrome sits directly on the document and should read
+ * as one material with the buttons floating on top of it.
+ *
+ * Takes an explicit [color] rather than resolving the theme, so it is not `@Composable` and each
+ * viewer passes the same `chromeGlass` its buttons already use.
+ */
+fun Modifier.viewerGlass(
+ backdrop: Backdrop,
+ color: Color,
+ shape: () -> Shape = { RoundedRectangle(28f.dp) }
+): Modifier = drawBackdrop(
+ backdrop = backdrop,
+ shape = shape,
+ effects = {
+ vibrancy()
+ blur(2f.dp.toPx())
+ lens(12f.dp.toPx(), 24f.dp.toPx())
+ },
+ onDrawSurface = { drawRect(color) }
+)
+
+/**
+ * The neutral chrome tint the theme-driven viewers pair with [viewerGlass], so their panels and their
+ * buttons resolve the same colour from one place instead of each screen writing the literal.
+ *
+ * The PDF viewer does *not* use this: its tint is chosen from the current page's luminance rather than
+ * the app theme, because its chrome floats over the document itself.
+ */
+fun viewerChromeGlass(isDark: Boolean): Color =
+ if (isDark) Color(0xFF20242C).copy(0.7f) else Color.White.copy(0.55f)
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/ImageEditorScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/ImageEditorScreen.kt
index aaed836..a67009b 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/ImageEditorScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/ImageEditorScreen.kt
@@ -50,7 +50,8 @@ import com.chethan616.clearpdf.ui.components.LiquidButton
import com.chethan616.clearpdf.ui.components.LiquidIconButton
import com.chethan616.clearpdf.ui.components.GlassScreenHeaderRow
import com.chethan616.clearpdf.ui.components.GlassScreenScaffold
-import com.chethan616.clearpdf.ui.components.liquidGlassPanel
+import com.chethan616.clearpdf.ui.components.viewerChromeGlass
+import com.chethan616.clearpdf.ui.components.viewerGlass
import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
import com.chethan616.clearpdf.ui.utils.rememberUISensor
@@ -125,7 +126,7 @@ fun ImageEditorScreen(
// Controls panel
Column(
- Modifier.fillMaxWidth().navigationBarsPadding().liquidGlassPanel(backdrop, uiSensor).padding(14.dp),
+ Modifier.fillMaxWidth().navigationBarsPadding().viewerGlass(backdrop, viewerChromeGlass(isDark)).padding(14.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
// Rotate + reset
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfSearchBar.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfSearchBar.kt
index 7b1b3b6..d421704 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfSearchBar.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfSearchBar.kt
@@ -28,13 +28,17 @@ import com.chethan616.clearpdf.ui.utils.UISensor
import com.kyant.backdrop.backdrops.LayerBackdrop
import kotlinx.coroutines.delay
+/** [LiquidIconButton]'s own size, so these read as the top bar's circles moved down the screen. */
+private val FindBarButtonSize = 40.dp
+
/**
* The find bar for both viewers. It is the same 36 dp [GlassSearchPill] Home and Tools use — one
* search shape across the app — with the nav circles moved *outside* the capsule so the pill stays a
- * pure input rather than a slab with controls buried in it.
+ * pure input rather than a slab with controls buried in it. Both the pill and the circles wear the
+ * viewer's chrome glass, so the bar is the top bar's material, just lower down.
*
- * The adaptive chrome palette ([fg]/[fgSoft]/[surface]/[field]) still threads through: on a light
- * page the viewer inverts its chrome, and the find bar has to follow or it goes unreadable.
+ * The adaptive chrome palette ([fg]/[fgSoft]/[surface]) still threads through: on a light page the
+ * viewer inverts its chrome, and the find bar has to follow or it goes unreadable.
*/
@Composable
internal fun PdfSearchBar(
@@ -48,7 +52,6 @@ internal fun PdfSearchBar(
fg: Color,
fgSoft: Color,
surface: Color,
- field: Color,
onQueryChange: (String) -> Unit,
onPrevMatch: () -> Unit,
onNextMatch: () -> Unit,
@@ -74,6 +77,8 @@ internal fun PdfSearchBar(
focusRequester = focusRequester,
// The bar's own slide-up is the entrance; a spring-in on the pill would stack on it.
animateIn = false,
+ // Same material as the top bar's title pill, not Home's heavier app chrome.
+ viewerChrome = true,
surfaceColor = surface,
contentColor = fg,
hintColor = fgSoft,
@@ -93,29 +98,32 @@ internal fun PdfSearchBar(
}
)
+ // 40 dp and `surface`, matching the top bar's circles exactly. `field` is only 6-10% alpha,
+ // which sets no value of its own and leaves the button refracting whatever is behind it —
+ // the same reason single-page chrome went invisible.
LiquidIconButton(
onClick = onPrevMatch,
backdrop = backdrop,
- surfaceColor = field,
- modifier = Modifier.size(30.dp)
+ surfaceColor = surface,
+ modifier = Modifier.size(FindBarButtonSize)
) {
- Icon(Icons.Rounded.KeyboardArrowUp, stringResource(R.string.previous), Modifier.size(17.dp), fg)
+ Icon(Icons.Rounded.KeyboardArrowUp, stringResource(R.string.previous), Modifier.size(20.dp), fg)
}
LiquidIconButton(
onClick = onNextMatch,
backdrop = backdrop,
- surfaceColor = field,
- modifier = Modifier.size(30.dp)
+ surfaceColor = surface,
+ modifier = Modifier.size(FindBarButtonSize)
) {
- Icon(Icons.Rounded.KeyboardArrowDown, stringResource(R.string.next), Modifier.size(17.dp), fg)
+ Icon(Icons.Rounded.KeyboardArrowDown, stringResource(R.string.next), Modifier.size(20.dp), fg)
}
LiquidIconButton(
onClick = onClose,
backdrop = backdrop,
surfaceColor = Color(0xFFEF5350).copy(0.22f),
- modifier = Modifier.size(30.dp)
+ modifier = Modifier.size(FindBarButtonSize)
) {
- CloseCrossIcon(Modifier.size(11.dp), fg)
+ CloseCrossIcon(Modifier.size(13.dp), fg)
}
}
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerBottomToolbar.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerBottomToolbar.kt
index d867a61..36ed963 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerBottomToolbar.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerBottomToolbar.kt
@@ -82,7 +82,7 @@ import com.chethan616.clearpdf.ui.components.CloseCrossIcon
import com.chethan616.clearpdf.ui.components.LiquidButton
import com.chethan616.clearpdf.ui.components.LiquidIconButton
import com.chethan616.clearpdf.ui.components.ShareMorphButton
-import com.chethan616.clearpdf.ui.components.liquidGlassPanel
+import com.chethan616.clearpdf.ui.components.viewerGlass
import com.chethan616.clearpdf.ui.utils.UISensor
import com.chethan616.clearpdf.utils.DocKind
import com.kyant.backdrop.backdrops.LayerBackdrop
@@ -193,7 +193,7 @@ internal fun PdfViewerBottomToolbar(
Column(
Modifier.fillMaxWidth()
.graphicsLayer { scaleX = toolCompress; transformOrigin = TransformOrigin(0f, 0.5f) }
- .liquidGlassPanel(backdrop, uiSensor, glass).padding(12.dp),
+ .viewerGlass(backdrop, glass).padding(12.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Row(
@@ -369,7 +369,7 @@ internal fun PdfViewerBottomToolbar(
// ── Export feedback row ────────────────────────────────────────────
if (exportError != null || exportMessage != null || isExporting) {
Row(
- Modifier.fillMaxWidth().liquidGlassPanel(backdrop, uiSensor, glass).padding(12.dp),
+ Modifier.fillMaxWidth().viewerGlass(backdrop, glass).padding(12.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
@@ -413,7 +413,7 @@ internal fun PdfViewerBottomToolbar(
Modifier
.fillMaxWidth()
.graphicsLayer { scaleX = toolCompress; transformOrigin = TransformOrigin(0f, 0.5f) }
- .liquidGlassPanel(backdrop, uiSensor, glass)
+ .viewerGlass(backdrop, glass)
.padding(horizontal = 16.dp, vertical = 16.dp),
horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterHorizontally),
verticalAlignment = Alignment.CenterVertically
@@ -428,7 +428,7 @@ internal fun PdfViewerBottomToolbar(
Modifier
.fillMaxWidth()
.graphicsLayer { scaleX = toolCompress; transformOrigin = TransformOrigin(0f, 0.5f) }
- .liquidGlassPanel(backdrop, uiSensor, glass)
+ .viewerGlass(backdrop, glass)
.padding(horizontal = 12.dp, vertical = 10.dp)
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(8.dp),
@@ -461,7 +461,7 @@ internal fun PdfViewerBottomToolbar(
Modifier
.fillMaxWidth()
.graphicsLayer { scaleX = toolCompress; transformOrigin = TransformOrigin(0f, 0.5f) }
- .liquidGlassPanel(backdrop, uiSensor, glass)
+ .viewerGlass(backdrop, glass)
.padding(horizontal = 12.dp, vertical = 10.dp)
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(8.dp),
@@ -621,7 +621,6 @@ internal fun PdfViewerBottomToolbar(
) {
ShareMorphButton(
backdrop = backdrop,
- uiSensor = uiSensor,
glass = glass,
fg = fg,
onOpen = onOpenAnotherPdf,
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerScreen.kt
index 37498cb..8dc2760 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerScreen.kt
@@ -115,7 +115,8 @@ import com.chethan616.clearpdf.ui.components.GlassTitlePill
import com.chethan616.clearpdf.ui.components.LiquidIconButton
import com.chethan616.clearpdf.ui.components.ViewerChromeGlass
import com.chethan616.clearpdf.ui.components.LiquidSaveSheet
-import com.chethan616.clearpdf.ui.components.liquidGlassPanel
+import com.chethan616.clearpdf.ui.components.viewerChromeGlass
+import com.chethan616.clearpdf.ui.components.viewerGlass
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
import com.chethan616.clearpdf.ui.utils.rememberUISensor
import com.chethan616.clearpdf.ui.viewmodel.PdfViewerViewModel
@@ -387,7 +388,7 @@ fun PdfViewerScreen(
verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically)
) {
Column(
- Modifier.fillMaxWidth().liquidGlassPanel(backdrop, uiSensor).padding(28.dp),
+ Modifier.fillMaxWidth().viewerGlass(backdrop, viewerChromeGlass(isDarkMode)).padding(28.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
@@ -410,7 +411,7 @@ fun PdfViewerScreen(
modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp).imePadding()
) {
Column(
- Modifier.fillMaxWidth().liquidGlassPanel(backdrop, uiSensor).padding(16.dp),
+ Modifier.fillMaxWidth().viewerGlass(backdrop, viewerChromeGlass(isDarkMode)).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
BasicText(stringResource(R.string.pdf_password_title), style = TextStyle(text, 17.sp, fontWeight = FontWeight.SemiBold))
@@ -960,7 +961,6 @@ fun PdfViewerScreen(
fg = chromeFg,
fgSoft = chromeFgSoft,
surface = chromeGlass,
- field = chromeField,
onQueryChange = { q -> findQuery = q; viewModel.searchText(q) },
onPrevMatch = { viewModel.prevMatch(); lastInteractionAtMs = System.currentTimeMillis() },
onNextMatch = { viewModel.nextMatch(); lastInteractionAtMs = System.currentTimeMillis() },
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt
index 5b1b59c..30d93d8 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SpreadsheetViewerScreen.kt
@@ -90,7 +90,8 @@ import com.chethan616.clearpdf.ui.components.GlassScreenScaffold
import com.chethan616.clearpdf.ui.components.LiquidButton
import com.chethan616.clearpdf.ui.components.LiquidIconButton
import com.chethan616.clearpdf.ui.components.ShareMorphButton
-import com.chethan616.clearpdf.ui.components.liquidGlassPanel
+import com.chethan616.clearpdf.ui.components.viewerChromeGlass
+import com.chethan616.clearpdf.ui.components.viewerGlass
import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
import com.chethan616.clearpdf.ui.utils.rememberUISensor
@@ -149,7 +150,7 @@ fun SpreadsheetViewerScreen(
val searchFocus = remember { FocusRequester() }
val gridListState = rememberLazyListState()
// Theme-adaptive glass surface for the top-bar pill / buttons → true liquid-glass refraction.
- val chromeGlass = if (isDark) Color(0xFF20242C).copy(0.7f) else Color.White.copy(0.55f)
+ val chromeGlass = viewerChromeGlass(isDark)
val sheets = state.sheets
val idx = sheetIndex.coerceIn(0, sheets.lastIndex.coerceAtLeast(0))
@@ -254,7 +255,7 @@ fun SpreadsheetViewerScreen(
Column(
Modifier
.fillMaxWidth().padding(28.dp)
- .liquidGlassPanel(backdrop, uiSensor)
+ .viewerGlass(backdrop, chromeGlass)
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {}
.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(14.dp)
@@ -339,7 +340,6 @@ fun SpreadsheetViewerScreen(
if (currentSheet != null && !showSearch) {
ShareMorphButton(
backdrop = backdrop,
- uiSensor = uiSensor,
glass = chromeGlass,
fg = text,
onOpen = { viewModel.exportToPdf(context) { u -> u?.let(onOpenPdf) } },
@@ -370,7 +370,6 @@ fun SpreadsheetViewerScreen(
// Translucent, not the old opaque slab colour — the search pill is glass now, and
// an opaque surface would kill its refraction.
surface = chromeGlass,
- field = if (isDark) Color.White.copy(0.08f) else Color.Black.copy(0.06f),
onQueryChange = { searchQuery = it },
onPrevMatch = { goToMatch(-1) },
onNextMatch = { goToMatch(1) },
@@ -419,7 +418,7 @@ private fun SheetPickerPopup(
) {
Column(
Modifier.fillMaxWidth().widthIn(max = 360.dp)
- .liquidGlassPanel(backdrop, uiSensor)
+ .viewerGlass(backdrop, viewerChromeGlass(isDark))
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {}
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(2.dp)