Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.
Rust androiddocument-scannerdocximage-editorjetpack-composekotlinliquid-glassofflineopen-sourcepdfpdf-compressorpdf-editorpdf-mergerpdf-readerpdf-splitterpdf-toolspdf-viewerpptxspreadsheet-editorxlsx
Viewer bar choice, no menu dim, glass reactions under Adaptive luminance (#158)
chethan616553a540fa9dd
diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppIcons.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppIcons.ktindex 8fe8476..898e7d2 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppIcons.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppIcons.kt@@ -95,6 +95,8 @@ object LucideIcons {val Images: ImageVector get() = Icons.Rounded.PhotoLibraryval Info: ImageVector get() = Icons.Rounded.Infoval Layers: ImageVector get() = Icons.Rounded.Layers+ /** A window with its own bar: the viewer's bars beside the page, not over it. */+ val BarsBesidePage: ImageVector get() = Icons.Rounded.WebAssetval LayoutGrid: ImageVector get() = Icons.Rounded.GridViewval Link: ImageVector get() = Icons.Rounded.Linkval List: ImageVector get() = Icons.AutoMirrored.Rounded.Listdiff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.ktindex 8b5d387..a38b6f9 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt@@ -909,6 +909,19 @@ class AppViewModel(app: Application, private val saved: SavedStateHandle) : Andrprivate var nightModeDefaultState by mutableStateOf(appPrefs.getBoolean("nightMode", false))val savedNightMode: Boolean get() = nightModeDefaultState+ /**+ * Where the viewer's bars sit (View settings ▸ Toolbars; remembered app-wide): beside the page (the+ * page area runs between the top row and the dock, so they never cover it), or over it (the page+ * runs under both, as the viewer first had it).+ */+ var barsOverPage by mutableStateOf(appPrefs.getBoolean("barsOverPage", false))+ private set++ fun updateBarsOverPage(on: Boolean) {+ barsOverPage = on+ appPrefs.edit().putBoolean("barsOverPage", on).apply()+ }+/** Two pages side by side in continuous mode (View settings; remembered app-wide). */var twoPages by mutableStateOf(appPrefs.getBoolean("twoPages", false))private setdiff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.ktindex f4a285d..65c41ed 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt@@ -252,6 +252,8 @@ fun PdfSheet(shape = RoundedRectangle(34.dp),wash = sheetWash,blur = 18.dp,+ // with Adaptive luminance on, over a page of print it lifts and frosts (no grey smudges)+ assist = com.chethan616.clearpdf.ui.glass.rememberGlassLuminance(),) {val haptics = com.chethan616.clearpdf.ui.glass.LocalHaptics.currentBox(diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.ktindex d71077f..2c87ab0 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt@@ -60,9 +60,10 @@ class GlassLuminance internal constructor(initial: Float, internal val layer: Gr/*** 0 (calm: the wallpaper, an empty page) … 1 (busy: lines of text, a photo) behind the glass. Read* while drawing: a busy backdrop takes a thicker wash and frost, so what is behind does not ghost- * through the words on the glass (#158), while a calm one stays as clear as it was.+ * through the words on the glass (#158), while a calm one stays as clear as it was. Only with+ * Adaptive luminance on (Settings ▸ Liquid glass): off, the glass is the preset's and nothing else.*/- val busy: Float get() = busyAnim.value+ val busy: Float get() = if (GlassSettings.adaptive) busyAnim.value else 0f/** Whether the glass sits over something light, so its ink should be dark. */var onLight by mutableStateOf(initial > 0.5f)@@ -241,6 +242,7 @@ fun BackdropEffectScope.adaptiveGlassEffects(saturation = style.saturation,)blur(blurPx * style.blur * (if (l > 0f) lerp(1f, 1.5f, l) else lerp(1f, 0.6f, -l)) * (1f + 0.6f * busy.coerceIn(0f, 1f)))+ pageLift(pageLiftAmount(luminance, busy))lens(refractionHeightPx * style.refractionHeight,refractionAmountPx * style.refractionAmount,@@ -267,9 +269,29 @@ fun adaptiveWash(luminance: Float, busy: Float = 0f): Color {else Color.Black.copy(alpha = lerp(lerp(0.10f, 0.34f, -l), 0.60f, b))}+/**+ * Glass over a light page of print lifts it: brighter and flatter, so the frosted print behind reads+ * as white glass, not as grey smudges (black text blurred averages to grey). Apple's glass brightens+ * over light content the same way. [amount] 0 (the wallpaper, a dark page: nothing) … 1 (white page+ * of print). The lens and colour are untouched.+ */+fun BackdropEffectScope.pageLift(amount: Float) {+ val a = amount.coerceIn(0f, 1f)+ if (a <= 0.01f) return+ // contrast pivots on mid grey, so lowering it alone greys the white too: the brightness puts+ // white back at white (0.5 * (1 - contrast)) and a touch over, and the print lifts toward it+ val contrast = lerp(1f, 0.5f, a)+ colorControls(brightness = 0.5f * (1f - contrast) + 0.03f * a, contrast = contrast)+}++/** How much a reading asks for [pageLift]: light behind (from 0.55 up) and busy with print. */+fun pageLiftAmount(luminance: Float, busy: Float): Float =+ ((luminance - 0.55f) / 0.3f).coerceIn(0f, 1f) * busy.coerceIn(0f, 1f)+/*** A dark hairline for glass over something near-white (a page): its white rim light vanishes there, so* without one a light menu or bar has no edge at all on a white page (#158). None over anything darker.+ * Callers draw it only with Adaptive luminance on ([adaptiveEdge]).*/fun lightEdge(luminance: Float): Color {// measured on a phone: a menu over a white page with the viewer's dark header band above reads@@ -278,19 +300,14 @@ fun lightEdge(luminance: Float): Color {return if (a <= 0.005f) Color.Unspecified else Color.Black.copy(alpha = a)}-/**- * How much an open menu dims the page around it ([open] 0 … 1): over a light page of print a little (at- * most 16% black), so the white menu stands off a white page; over the wallpaper, or anything darker,- * not at all (#158).- */-fun menuScrimAlpha(luminance: Float, open: Float, busy: Float): Float =- 0.16f * open.coerceIn(0f, 1f) * ((luminance - 0.5f) / 0.25f).coerceIn(0f, 1f) * busy.coerceIn(0f, 1f)-/** The tallest a menu grows: its own most, or 72% of the screen, so its last row is never off-screen. */@Composablefun menuMaxHeight(designed: androidx.compose.ui.unit.Dp): androidx.compose.ui.unit.Dp =minOf(designed, (androidx.compose.ui.platform.LocalConfiguration.current.screenHeightDp * 0.72f).dp)+/** [lightEdge] while Adaptive luminance is on; none while it is off. */+fun adaptiveEdge(luminance: Float): Color = if (GlassSettings.adaptive) lightEdge(luminance) else Color.Unspecified+/** Draws [edge] (from [lightEdge]) along [shape]'s outline, about a dp of it showing inside. */fun androidx.compose.ui.graphics.drawscope.DrawScope.drawGlassEdge(shape: androidx.compose.ui.graphics.Shape, edge: Color) {if (edge == Color.Unspecified || edge.alpha <= 0f) returndiff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.ktindex 3b2ebea..5bf6635 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveInk.kt@@ -157,6 +157,22 @@ internal class InkFrame(* double weight, just outside its left and right edges level with its centre, where the icon* itself sits. A control straddling a page edge so follows what is beside its glyph.*/+ /**+ * How much the ground round [box] jumps between light and dark: the spread of the same samples as+ * [cornerLuminance]. Print (black on white) spreads wide; the aurora, a photo's sky, a blank page don't.+ */+ fun cornerSpread(box: Rect, inset: Float): Float {+ val d = inset.coerceAtMost(minOf(box.width, box.height) * 0.14f)+ val cy = box.center.y+ val s = doubleArrayOf(+ luminanceAt(box.left + d, box.top + d), luminanceAt(box.right - d, box.top + d),+ luminanceAt(box.left + d, box.bottom - d), luminanceAt(box.right - d, box.bottom - d),+ luminanceAt(box.left - d * 0.6f, cy), luminanceAt(box.right + d * 0.6f, cy),+ luminanceAt(box.center.x, box.top + d), luminanceAt(box.center.x, box.bottom - d),+ )+ return (s.max() - s.min()).toFloat()+ }+fun cornerLuminance(box: Rect, inset: Float): Float {val d = inset.coerceAtMost(minOf(box.width, box.height) * 0.14f)val corners = luminanceAt(box.left + d, box.top + d) + luminanceAt(box.right - d, box.top + d) +@@ -243,10 +259,13 @@ fun rememberSurroundLuminance(): SurroundLuminance? {* One control's ink: put [modifier] on the control (first, so it measures the resting box). [edge] is* the hairline its glass takes over a near-white page, where its white rim light alone leaves no edge.*/-class InkProbe(val modifier: Modifier, val color: Color, val edge: Color = Color.Unspecified) {+class InkProbe(val modifier: Modifier, val color: Color, val edge: Color = Color.Unspecified, val lift: Float = 0f) {val soft: Color get() = color.copy(alpha = 0.62f)}+/** The hairline's full strength over a page ([InkProbe.edge]); its share of it says how much on one a control is. */+const val PageEdgeAlpha = 0.14f+/** Ink over a light background. */val InkOnLight = Color(0xFF15171C)@@ -263,6 +282,8 @@ fun rememberAdaptiveInk(fallback: Color): InkProbe {var measured by remember { mutableStateOf(false) }// over a page (near white), not merely over light: the light theme's aurora stays edgelessvar onPage by remember { mutableStateOf(false) }+ // over light print (light, and jumping between black and white): its glass is lifted ([pageLift])+ var onPrint by remember { mutableStateOf(false) }val box = remember { arrayOfNulls<Rect>(1) }val currentFallback by rememberUpdatedState(fallbackOnLight)val inset = with(LocalDensity.current) { 5.dp.toPx() }@@ -287,6 +308,8 @@ fun rememberAdaptiveInk(fallback: Color): InkProbe {else -> onLight}onPage = if (onPage) lum > 0.86f else lum > 0.92f+ val spread = frame.cornerSpread(b, inset)+ onPrint = if (onPrint) lum > 0.5f && spread > 0.1f else lum > 0.55f && spread > 0.14fmeasured = true}}@@ -298,9 +321,13 @@ fun rememberAdaptiveInk(fallback: Color): InkProbe {else -> Color.White}val color by animateColorAsState(target, tween(200), label = "adaptiveInk")- val edgeAlpha by androidx.compose.animation.core.animateFloatAsState(if (sampler != null && measured && onPage) 0.14f else 0f, tween(200), label = "adaptiveEdge")+ // the hairline over a white page, and over light print too, where the lifted glass is white on white+ // both only with Adaptive luminance on (Settings ▸ Liquid glass): off, a control is the preset's glass+ val adaptive = GlassSettings.adaptive+ val edgeAlpha by androidx.compose.animation.core.animateFloatAsState(if (adaptive && sampler != null && measured && (onPage || onPrint)) PageEdgeAlpha else 0f, tween(200), label = "adaptiveEdge")+ val lift by androidx.compose.animation.core.animateFloatAsState(if (adaptive && sampler != null && measured && onPrint) 1f else 0f, tween(260), label = "adaptiveLift")val modifier = remember { Modifier.onGloballyPositioned { box[0] = it.boundsInWindow() } }- return InkProbe(modifier, color, if (edgeAlpha > 0.005f) Color.Black.copy(alpha = edgeAlpha) else Color.Unspecified)+ return InkProbe(modifier, color, if (edgeAlpha > 0.005f) Color.Black.copy(alpha = edgeAlpha) else Color.Unspecified, lift)}private tailrec fun Context.findActivity(): Activity? = when (this) {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.ktindex 7a2c9f2..fe84bb2 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt@@ -49,6 +49,7 @@ import androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport com.chethan616.clearpdf.ui.theme.clearimport com.kyant.backdrop.drawBackdrop+import com.kyant.backdrop.effects.blurimport androidx.compose.foundation.shape.CircleShapeimport androidx.compose.ui.graphics.Shapeimport androidx.compose.ui.graphics.SolidColor@@ -82,6 +83,8 @@ private fun Modifier.glassControl(aroundOut: ((SurroundLuminance?) -> Unit)? = null,/** A hairline round it ([InkProbe.edge]), read while drawing. */edge: () -> Color = { Color.Unspecified },+ /** How much it is over light print ([InkProbe.lift]): its glass is lifted to white, read while drawing. */+ lift: () -> Float = { 0f },): Modifier {val backdrop = LocalBackdrop.currentif (clear.clean) {@@ -135,6 +138,8 @@ private fun Modifier.glassControl(effects = {if (around != null) adaptiveGlassEffects(style, around.value, blur.toPx(), 12f.dp.toPx(), 24f.dp.toPx())else glassEffects(style, blur.toPx(), 12f.dp.toPx(), 24f.dp.toPx())+ // over a white page of print: a little frost and lifted to white glass, not grey smudges+ lift().let { if (it > 0.01f) { blur(6.dp.toPx() * it); pageLift(it) } }},highlight = { glassHighlight(style) },layerBlock = { liquidPressTransform(highlight) },@@ -202,7 +207,7 @@ fun rememberBeat(action: () -> Unit, millis: Long = BackBeatMillis): () -> Unit* (Settings ▸ liquid glass), so it shows what's under it, the page in the viewer.*/@Composable-fun Modifier.glassBar(shape: Shape = ChromeCapsule, surface: Color = Color.Unspecified, blur: Dp = 2.dp, edge: Color = Color.Unspecified): Modifier {+fun Modifier.glassBar(shape: Shape = ChromeCapsule, surface: Color = Color.Unspecified, blur: Dp = 2.dp, edge: Color = Color.Unspecified, lift: Float = 0f): Modifier {if (clear.clean) {val panel = clear.solidPanelreturn clip(shape).background(if (surface.isSpecified) surface.compositeOver(panel) else panel)@@ -214,6 +219,7 @@ fun Modifier.glassBar(shape: Shape = ChromeCapsule, surface: Color = Color.Unspe// the user's own glass (Settings ▸ Liquid glass), as every other surface wears itval style = if (around != null) GlassSettings.style.adaptiveBase else GlassSettings.styleval currentEdge by rememberUpdatedState(edge)+ val currentLift by rememberUpdatedState(lift)return this.then(around?.modifier ?: Modifier).drawBackdrop(@@ -223,6 +229,8 @@ fun Modifier.glassBar(shape: Shape = ChromeCapsule, surface: Color = Color.Unspeeffects = {if (around != null) adaptiveGlassEffects(style, around.value, blur.toPx(), 12f.dp.toPx(), 24f.dp.toPx())else glassEffects(style, blur.toPx(), 12f.dp.toPx(), 24f.dp.toPx())+ // over a white page of print: a little frost and lifted to white glass, not grey smudges+ currentLift.let { if (it > 0.01f) { blur(6.dp.toPx() * it); pageLift(it) } }},highlight = { glassHighlight(style) },layerBlock = { liquidPressTransform(highlight) },@@ -260,7 +268,7 @@ fun GlassPill(Row(modifier.then(probe.modifier)- .glassControl(ChromeCapsule, onClick, onLongClick, tint, if (tintAt != null) Color.Unspecified else surface, blur, label, tap = tap, bloom = true, tintAt = tintAt, edge = { probe.edge })+ .glassControl(ChromeCapsule, onClick, onLongClick, tint, if (tintAt != null) Color.Unspecified else surface, blur, label, tap = tap, bloom = true, tintAt = tintAt, edge = { probe.edge }, lift = { probe.lift }).height(height).padding(horizontal = horizontalPadding),horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally),@@ -402,7 +410,7 @@ fun GlassCircle(// stepped aside while its glass is a menu: not drawn at all (a layer's alpha alone left it in// the copy of the screen the menu's glass bends, where the lens smeared its glyph).drawWithContent { if (at?.let { MorphAnchors.hides(it) } != true) drawContent() }- .size(size).glassControl(CircleShape, onClick, onLongClick, tint, surface, 2.dp, label, fill = if (solid && tint.isSpecified) ({ tint }) else null, tap = tap, bloom = true, candyBase = false, aroundOut = { around[0] = it }, edge = { probe.edge }),+ .size(size).glassControl(CircleShape, onClick, onLongClick, tint, surface, 2.dp, label, fill = if (solid && tint.isSpecified) ({ tint }) else null, tap = tap, bloom = true, candyBase = false, aroundOut = { around[0] = it }, edge = { probe.edge }, lift = { probe.lift }),contentAlignment = Alignment.Center,) { content() }}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.ktindex 7f6fcec..59d381d 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt@@ -361,10 +361,6 @@ internal fun LiquidMorphSurface(fun washIn() = ((p.value - 0.08f) / 0.4f).coerceIn(0f, 1f)// the luminance reading copies the backdrop: every few frames is plenty (its ink eases anyway)val frame = remember { intArrayOf(0) }- // a breath of dim on the page around the open menu, over a light page only- if (luminance != null) androidx.compose.foundation.layout.Box(- Modifier.fillMaxSize().drawBehind { drawRect(Color.Black, alpha = menuScrimAlpha(luminance.value, washIn(), luminance.busy) * fade.value) },- )fun RuntimeShader.shapeUniforms(g: Geo) {setFloatUniform("circle", local.center.x - stage.left, local.center.y - stage.top, g.circleR, 0f)@@ -424,7 +420,7 @@ internal fun LiquidMorphSurface(surface.shapeUniforms(g)drawRect(ShaderBrush(surface))// a dark hairline round the opened menu over a white page, where its rim light is lost- val edge = lightEdge(lum)+ val edge = adaptiveEdge(lum)if (edge != Color.Unspecified && w > 0f) drawRoundRect(edge.copy(alpha = edge.alpha * w),topLeft = androidx.compose.ui.geometry.Offset(g.menu.left - stage.left, g.menu.top - stage.top),@@ -545,7 +541,7 @@ private fun com.kyant.backdrop.BackdropEffectScope.morphEffects(style: GlassStyl// Frosted frosted), lifted only a little over light. Frost, milk and flattening come in with what// is behind it: over a page of print ([busy]) they rise until the rows read, over the calm// aurora they stay away, so the menu is liquid glass rather than a frosted card (#158).- val menuBrightness = if (l > 0f) lerp(0.04f, lerp(0.12f, 0.3f, k), l) else lerp(if (dark) -0.12f else 0.04f, -0.24f, -l)+ val menuBrightness = if (l > 0f) lerp(0.04f, lerp(0.12f, 0.42f, k), l) else lerp(if (dark) -0.12f else 0.04f, -0.24f, -l)// the button's end: plain glass, or (Adaptive luminance) the adaptive button's own colour and frost,// as adaptiveGlassEffects sets them from the reading around the buttonval b = buttonLuminance?.let { signedLum(it.coerceIn(0f, 1f)) }@@ -553,7 +549,7 @@ private fun com.kyant.backdrop.BackdropEffectScope.morphEffects(style: GlassStylval buttonContrast = if (b != null && b > 0f) lerp(1f, 0.25f, b) else 1fcolorControls(brightness = lerp(buttonBrightness, menuBrightness, o),- contrast = lerp(buttonContrast, if (l > 0f) lerp(1f, lerp(0.85f, 0.5f, k), l) else 1f, o),+ contrast = lerp(buttonContrast, if (l > 0f) lerp(1f, lerp(0.85f, 0.35f, k), l) else 1f, o),saturation = style.saturation,)val buttonBlur = 2f * dp * style.blur * (if (b == null) 1f else if (b > 0f) lerp(1f, 1.5f, b) else lerp(1f, 0.6f, -b))diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.ktindex cc2d6d4..8d59977 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt@@ -321,8 +321,6 @@ private fun RectMorphSurface(// black pages, a white document, the aurora): the glyph and rows always stand outval luminance = rememberGlassLuminance(enabled = true)val inkColor = adaptiveInk(luminance, clear.ink)- // a breath of dim on the page around the open menu, over a light page only- if (luminance != null) Box(Modifier.fillMaxSize().drawBehind { drawRect(Color.Black, alpha = menuScrimAlpha(luminance.value, tall.value, luminance.busy) * fade.value) })Layout(content = {CompositionLocalProvider(LocalGlassInk provides inkColor, LocalMenuInk provides inkColor) {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.ktindex 3e87b95..f98cacb 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt@@ -340,8 +340,6 @@ private val MenuDarkWash = Color(0xFF101014).copy(alpha = 0.54f)fun MenuCard(modifier: Modifier = Modifier, shape: androidx.compose.ui.graphics.Shape = RoundedRectangle(24.dp), content: @Composable ColumnScope.() -> Unit) {val c = clearval luminance = rememberGlassLuminance()- // Adaptive luminance off: still read what is behind, but only to frost over print (#158)- val assist = if (luminance == null) rememberGlassLuminance(enabled = true) else nullGlassCard(// unseen for the frame or two it takes to read what is behind it (see [GlassLuminance])modifier.graphicsLayer { alpha = if (luminance == null || luminance.measured) 1f else 0f },@@ -349,10 +347,9 @@ fun MenuCard(modifier: Modifier = Modifier, shape: androidx.compose.ui.graphics.wash = if (c.dark) MenuDarkWash else MenuLightWash,blur = 16.dp,// the user's own glass (Settings ▸ Liquid glass), lifted or dimmed a touch for its ink, as every- // other surface; over print the assist frosts it (it used to be a fixed frost of its own)+ // other surface (it used to be a fixed frost of its own); Adaptive luminance adds the reststyleOverride = GlassSettings.style.copy(brightness = GlassSettings.style.brightness + if (c.dark) -0.3f else 0.08f),luminance = luminance,- assist = assist,) {val ink = adaptiveInk(luminance, c.ink)CompositionLocalProvider(LocalGlassInk provides ink, LocalMenuInk provides ink) { content() }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.ktindex 394618b..1d94dc5 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@@ -103,7 +103,7 @@ fun Modifier.glass(onDrawBackdrop = luminance.recorder,onDrawSurface = {drawRect(adaptiveWash(luminance.value, luminance.busy).glassTint(style))- drawGlassEdge(shape, lightEdge(luminance.value))+ drawGlassEdge(shape, adaptiveEdge(luminance.value))},)// Adaptive luminance on: a still surface (a bar, a panel, a sheet) takes its frost and light@@ -129,14 +129,18 @@ fun Modifier.glass(shadow = null,effects = {glassEffects(style, blur.toPx(), lensHeight.toPx(), lensAmount.toPx())- if (assist != null && assist.busy > 0.01f) blur(18.dp.toPx() * assist.busy)+ if (assist != null && assist.busy > 0.01f) {+ blur(18.dp.toPx() * assist.busy)+ pageLift(pageLiftAmount(assist.value, assist.busy))+ }},highlight = { glassHighlight(style) },onDrawBackdrop = assist?.recorder ?: { it() },onDrawSurface = {if (wash.isSpecified) drawRect(wash.glassTint(style))if (dim.isSpecified) drawRect(dim)- if (assist != null && assist.busy > 0.01f) drawRect(if (clearDark) Color.Black else Color.White, alpha = 0.5f * assist.busy)+ // over print: milk over a light page (the lift has whitened it already, so less is needed)+ if (assist != null && assist.busy > 0.01f) drawRect(if (clearDark) Color.Black else Color.White, alpha = 0.35f * assist.busy)},)}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.ktindex 0bd152a..0e37e82 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt@@ -1036,7 +1036,7 @@ fun MindMapEditor(vm: AppViewModel, id: String) {if (editing != null) finishEdit()vm.closeNote()}, immediate = true)- Row(Modifier.weight(1f).height(44.dp).then(ink.modifier).glassBar(edge = ink.edge).padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically) {+ Row(Modifier.weight(1f).height(44.dp).then(ink.modifier).glassBar(edge = ink.edge, lift = ink.lift).padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically) {Icon(LucideIcons.Network, null, tint = Candy.Grape, modifier = Modifier.size(17.dp))Spacer(Modifier.width(8.dp))Text(@@ -1072,7 +1072,7 @@ fun MindMapEditor(vm: AppViewModel, id: String) {when {typing != null -> {Row(- Modifier.fillMaxWidth().heightIn(min = 58.dp).then(ink.modifier).glassBar(RoundedCornerShape29, edge = ink.edge).padding(start = 18.dp, end = 7.dp, top = 7.dp, bottom = 7.dp),+ Modifier.fillMaxWidth().heightIn(min = 58.dp).then(ink.modifier).glassBar(RoundedCornerShape29, edge = ink.edge, lift = ink.lift).padding(start = 18.dp, end = 7.dp, top = 7.dp, bottom = 7.dp),verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.spacedBy(6.dp),) {@@ -1135,7 +1135,7 @@ fun MindMapEditor(vm: AppViewModel, id: String) {chosen != null -> {AnimatedVisibility(palette && chosen !== doc.root, enter = fadeIn() + expandVertically(), exit = fadeOut() + shrinkVertically()) {Row(- Modifier.then(ink.modifier).glassBar(edge = ink.edge).padding(horizontal = 12.dp, vertical = 10.dp),+ Modifier.then(ink.modifier).glassBar(edge = ink.edge, lift = ink.lift).padding(horizontal = 12.dp, vertical = 10.dp),horizontalArrangement = Arrangement.spacedBy(10.dp),verticalAlignment = Alignment.CenterVertically,) {@@ -1146,7 +1146,7 @@ fun MindMapEditor(vm: AppViewModel, id: String) {}}Row(- Modifier.then(ink.modifier).glassBar(edge = ink.edge).padding(horizontal = 6.dp, vertical = 4.dp),+ Modifier.then(ink.modifier).glassBar(edge = ink.edge, lift = ink.lift).padding(horizontal = 6.dp, vertical = 4.dp),verticalAlignment = Alignment.CenterVertically,) {CompositionLocalProvider(LocalGlassInk provides ink.color) {diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.ktindex ec097b7..e846786 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt@@ -1150,7 +1150,7 @@ private fun exifFrame(file: File): PhotoFrame {@Composableprivate fun ModeSwitch(mode: Mode, modifier: Modifier, onPick: (Mode) -> Unit) {val ink = rememberGlassInk(Color.White)- BoxWithConstraints(modifier.height(48.dp).then(ink.modifier).glassBar(edge = ink.edge).padding(4.dp)) {+ BoxWithConstraints(modifier.height(48.dp).then(ink.modifier).glassBar(edge = ink.edge, lift = ink.lift).padding(4.dp)) {val each = maxWidth / Mode.entries.sizeval x by animateDpAsState(each * mode.ordinal, spring(dampingRatio = 0.78f, stiffness = 520f), label = "modeLight")Box(Modifier.offset(x = x).width(each).fillMaxHeight().clip(ChromeCapsule).background(Candy.Sky))diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.ktindex 4a45fb3..a724a39 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt@@ -767,7 +767,7 @@ fun SheetViewer(vm: AppViewModel, doc: OpenDocument) {Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 6.dp), verticalAlignment = Alignment.CenterVertically) {GlassCircle(onClick = { vm.closeDocument() }, label = stringResource(R.string.common_back)) { GlassIcon(LucideIcons.ChevronLeft, null, Modifier.size(22.dp)) }Spacer(Modifier.size(10.dp))- Column(Modifier.weight(1f).then(chrome.modifier).glassBar(edge = chrome.edge).padding(horizontal = 16.dp, vertical = 6.dp)) {+ Column(Modifier.weight(1f).then(chrome.modifier).glassBar(edge = chrome.edge, lift = chrome.lift).padding(horizontal = 16.dp, vertical = 6.dp)) {Text(doc.title, style = ClearType.BodyStrong, color = LocalGlassInk.current, maxLines = 1, overflow = TextOverflow.Ellipsis)grid.sheets.getOrNull(grid.current)?.let { Text(it.name + if (doc.info.dirty) " · " + stringResource(R.string.sheet_edited) else "", style = ClearType.Caption, color = LocalGlassInk.current.copy(alpha = 0.62f), maxLines = 1) }}diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.ktindex 5e1b970..25962d4 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt@@ -145,8 +145,6 @@ fun ViewerTopBar(modifier = Modifier.weight(1f).onGloballyPositioned { titleAnchor = it.boundsInWindow() }.graphicsLayer { alpha = contentAlpha.coerceIn(0f, 1f) },height = 48.dp,- // frosted enough that a page heading scrolled behind the title doesn't read through it- blur = 10.dp,horizontalPadding = 16.dp,) {val ink = LocalGlassInk.current@@ -295,8 +293,7 @@ fun SearchBar(layout(full, placeable.height) { placeable.place(0, 0) }}.then(ink.modifier)- // frosted more than the dock: page text scrolls behind the words typed here (#158)- .glassBar(blur = 10.dp, edge = ink.edge).padding(start = 16.dp, end = 4.dp)+ .glassBar(edge = ink.edge, lift = ink.lift).padding(start = 16.dp, end = 4.dp).graphicsLayer { alpha = ((progress().coerceIn(0f, 1f) - 0.35f) / 0.45f).coerceIn(0f, 1f) },verticalAlignment = Alignment.CenterVertically,) {@@ -404,7 +401,7 @@ fun QuickToolbar() {val ink = rememberGlassInk(clear.ink)Row(- Modifier.weight(1f).fillMaxHeight().then(ink.modifier).glassBar(edge = ink.edge).padding(horizontal = 6.dp),+ Modifier.weight(1f).fillMaxHeight().then(ink.modifier).glassBar(edge = ink.edge, lift = ink.lift).padding(horizontal = 6.dp),horizontalArrangement = Arrangement.SpaceEvenly,verticalAlignment = Alignment.CenterVertically,) {@@ -493,7 +490,7 @@ fun SubToolbar(content: @Composable () -> Unit) {BoxWithConstraints(Modifier.fillMaxWidth().height(BottomBarHeight).padding(horizontal = 12.dp, vertical = 8.dp), contentAlignment = Alignment.Center) {val ink = rememberGlassInk(clear.ink)Row(- Modifier.widthIn(max = maxWidth).fillMaxHeight().then(ink.modifier).glassBar(edge = ink.edge).horizontalScroll(scroll).padding(horizontal = 8.dp),+ Modifier.widthIn(max = maxWidth).fillMaxHeight().then(ink.modifier).glassBar(edge = ink.edge, lift = ink.lift).horizontalScroll(scroll).padding(horizontal = 8.dp),horizontalArrangement = Arrangement.Center,verticalAlignment = Alignment.CenterVertically,) { CompositionLocalProvider(LocalSubToolbarScroll provides scroll, LocalGlassInk provides ink.color) { content() } }diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.ktindex b8b0e89..b7facb4 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt@@ -143,16 +143,21 @@ fun ViewerScreen(vm: AppViewModel, doc: OpenDocument) {var quickExtraPx by remember { mutableIntStateOf(0) }val bottomPx = with(density) { if (ctl.tool == ViewerTool.None) QuickBarHeight.toPx() + quickExtraPx else BottomBarHeight.toPx() }// keyed on the document too: one opened over another (Create, Combine) has a fresh page view- LaunchedEffect(doc, statusPx, navPx, ctl.tool, vm.readingMode, bottomPx) {+ LaunchedEffect(doc, statusPx, navPx, ctl.tool, vm.readingMode, bottomPx, vm.barsOverPage) {// Keep the page viewport fixed while Find replaces the top bar. Releasing the bottom-bar// space here shifts every page at the same time as the search pill animates.val bottomShown = !vm.readingMode- // the first page starts at the top of the screen, under the camera; the glass row floats over- // it as over the rest (no empty band above it)- doc.viewer.setPadding(- top = 0f,- bottom = if (bottomShown) bottomPx + navPx else navPx,- )+ if (vm.barsOverPage) {+ // over the page: it runs from the top of the screen, under the camera, and on under the+ // dock; the glass bars float over it (only the gesture bar is kept clear)+ doc.viewer.setPadding(top = 0f, bottom = navPx)+ } else {+ // beside the page: the page area runs between the top row and the dock, so neither covers it+ doc.viewer.setPadding(+ top = if (vm.readingMode) statusPx else statusPx + topPx,+ bottom = if (bottomShown) bottomPx + navPx else navPx,+ )+ }}// Reopen where the reader left off.diff --git a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.ktindex 7bf7fa7..e435040 100644--- a/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt+++ b/android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt@@ -215,6 +215,15 @@ fun ViewSettingsSheet(vm: AppViewModel, doc: OpenDocument) {vm.openReadingMode(doc)}}+ // where the bars sit: beside the page, never over it, or floating over it+ Text(+ stringResource(R.string.sheet_toolbars), style = ClearType.Label, color = clear.inkSoft,+ modifier = Modifier.padding(start = 24.dp, top = 12.dp, bottom = 6.dp),+ )+ Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ LayoutChoice(LucideIcons.BarsBesidePage, stringResource(R.string.sheet_bars_beside), !vm.barsOverPage) { vm.updateBarsOverPage(false) }+ LayoutChoice(LucideIcons.Layers, stringResource(R.string.sheet_bars_over), vm.barsOverPage) { vm.updateBarsOverPage(true) }+ }Spacer(Modifier.height(6.dp))SheetSection {// Keep this sheet mounted while the page inversion changes so the switch's touch@@ -250,7 +259,13 @@ private fun androidx.compose.foundation.layout.RowScope.LayoutChoice(icon: Image) {Icon(icon, null, tint = if (chosen) Candy.Sky else c.inkSoft, modifier = Modifier.size(26.dp))Spacer(Modifier.height(8.dp))- Text(label, style = ClearType.Label.copy(fontSize = 12.5.sp), color = if (chosen) Candy.Sky else c.ink, maxLines = 2, textAlign = TextAlign.Center, overflow = TextOverflow.Ellipsis)+ // a one-word name ("Continuous") shrinks to fit its line rather than break mid-word+ androidx.compose.foundation.text.BasicText(+ label,+ style = ClearType.Label.copy(fontSize = 12.5.sp, color = if (chosen) Candy.Sky else c.ink, textAlign = TextAlign.Center),+ maxLines = if (' ' in label.trim()) 2 else 1,+ autoSize = androidx.compose.foundation.text.TextAutoSize.StepBased(minFontSize = 9.sp, maxFontSize = 12.5.sp),+ )}}diff --git a/android/app/src/main/res/values-ar/strings.xml b/android/app/src/main/res/values-ar/strings.xmlindex 42392d3..32f9222 100644--- a/android/app/src/main/res/values-ar/strings.xml+++ b/android/app/src/main/res/values-ar/strings.xml@@ -415,6 +415,9 @@<string name="sheet_add_star">تمييز الملف</string><string name="sheet_remove_star">إلغاء التمييز</string><string name="sheet_view_settings">إعدادات العرض</string>+ <string name="sheet_toolbars">أشرطة الأدوات</string>+ <string name="sheet_bars_beside">بجانب الصفحة</string>+ <string name="sheet_bars_over">فوق الصفحة</string><string name="sheet_pages">الصفحات</string><string name="sheet_attachments">المرفقات</string><string name="sheet_bookmarks_contents">الإشارات المرجعية والفهرس</string>diff --git a/android/app/src/main/res/values-de/strings.xml b/android/app/src/main/res/values-de/strings.xmlindex 4bfe4d1..c78c15b 100644--- a/android/app/src/main/res/values-de/strings.xml+++ b/android/app/src/main/res/values-de/strings.xml@@ -609,6 +609,9 @@<string name="sheet_add_star">Zu Favoriten hinzufügen</string><string name="sheet_remove_star">Aus Favoriten entfernen</string><string name="sheet_view_settings">Anzeigeeinstellungen</string>+ <string name="sheet_toolbars">Symbolleisten</string>+ <string name="sheet_bars_beside">Neben der Seite</string>+ <string name="sheet_bars_over">Über der Seite</string><string name="sheet_pages">Seiten</string><string name="sheet_attachments">Anhänge</string><string name="sheet_bookmarks_contents">Lesezeichen und Inhaltsverzeichnis</string>diff --git a/android/app/src/main/res/values-es/strings.xml b/android/app/src/main/res/values-es/strings.xmlindex 6df10f4..e7dcdab 100644--- a/android/app/src/main/res/values-es/strings.xml+++ b/android/app/src/main/res/values-es/strings.xml@@ -616,6 +616,9 @@<string name="sheet_add_star">Añadir a destacados</string><string name="sheet_remove_star">Quitar de destacados</string><string name="sheet_view_settings">Ajustes de vista</string>+ <string name="sheet_toolbars">Barras de herramientas</string>+ <string name="sheet_bars_beside">Junto a la página</string>+ <string name="sheet_bars_over">Sobre la página</string><string name="sheet_pages">Páginas</string><string name="sheet_attachments">Archivos adjuntos</string><string name="sheet_bookmarks_contents">Marcadores e índice</string>diff --git a/android/app/src/main/res/values-fr/strings.xml b/android/app/src/main/res/values-fr/strings.xmlindex 2867a4c..cf8c953 100644--- a/android/app/src/main/res/values-fr/strings.xml+++ b/android/app/src/main/res/values-fr/strings.xml@@ -561,6 +561,9 @@<string name="sheet_add_star">Ajouter aux favoris</string><string name="sheet_remove_star">Retirer des favoris</string><string name="sheet_view_settings">Réglages d\'affichage</string>+ <string name="sheet_toolbars">Barres d\'outils</string>+ <string name="sheet_bars_beside">À côté de la page</string>+ <string name="sheet_bars_over">Sur la page</string><string name="sheet_pages">Pages</string><string name="sheet_attachments">Pièces jointes</string><string name="sheet_bookmarks_contents">Signets et table des matières</string>diff --git a/android/app/src/main/res/values-it/strings.xml b/android/app/src/main/res/values-it/strings.xmlindex 916eace..99b4020 100644--- a/android/app/src/main/res/values-it/strings.xml+++ b/android/app/src/main/res/values-it/strings.xml@@ -604,6 +604,9 @@<string name="sheet_add_star">Aggiungi ai preferiti</string><string name="sheet_remove_star">Rimuovi dai preferiti</string><string name="sheet_view_settings">Impostazioni di visualizzazione</string>+ <string name="sheet_toolbars">Barre degli strumenti</string>+ <string name="sheet_bars_beside">Accanto alla pagina</string>+ <string name="sheet_bars_over">Sopra la pagina</string><string name="sheet_pages">Pagine</string><string name="sheet_attachments">Allegati</string><string name="sheet_bookmarks_contents">Segnalibri e indice</string>diff --git a/android/app/src/main/res/values-pt-rBR/strings.xml b/android/app/src/main/res/values-pt-rBR/strings.xmlindex 850059b..48e79fd 100644--- a/android/app/src/main/res/values-pt-rBR/strings.xml+++ b/android/app/src/main/res/values-pt-rBR/strings.xml@@ -390,6 +390,9 @@<string name="sheet_add_star">Adicionar aos favoritos</string><string name="sheet_remove_star">Remover dos favoritos</string><string name="sheet_view_settings">Configurações de visualização</string>+ <string name="sheet_toolbars">Barras de ferramentas</string>+ <string name="sheet_bars_beside">Ao lado da página</string>+ <string name="sheet_bars_over">Sobre a página</string><string name="sheet_pages">Páginas</string><string name="sheet_attachments">Anexos</string><string name="sheet_bookmarks_contents">Favoritos e sumário</string>diff --git a/android/app/src/main/res/values-pt/strings.xml b/android/app/src/main/res/values-pt/strings.xmlindex d23ebd7..e451c1e 100644--- a/android/app/src/main/res/values-pt/strings.xml+++ b/android/app/src/main/res/values-pt/strings.xml@@ -392,6 +392,9 @@<string name="sheet_add_star">Adicionar estrela</string><string name="sheet_remove_star">Remover a estrela</string><string name="sheet_view_settings">Definições de visualização</string>+ <string name="sheet_toolbars">Barras de ferramentas</string>+ <string name="sheet_bars_beside">Ao lado da página</string>+ <string name="sheet_bars_over">Sobre a página</string><string name="sheet_pages">Páginas</string><string name="sheet_attachments">Anexos</string><string name="sheet_bookmarks_contents">Marcadores e índice</string>diff --git a/android/app/src/main/res/values-ru/strings.xml b/android/app/src/main/res/values-ru/strings.xmlindex d73b9da..42a237d 100644--- a/android/app/src/main/res/values-ru/strings.xml+++ b/android/app/src/main/res/values-ru/strings.xml@@ -402,6 +402,9 @@<string name="sheet_add_star">В избранное</string><string name="sheet_remove_star">Убрать из избранного</string><string name="sheet_view_settings">Настройки просмотра</string>+ <string name="sheet_toolbars">Панели инструментов</string>+ <string name="sheet_bars_beside">Рядом со страницей</string>+ <string name="sheet_bars_over">Поверх страницы</string><string name="sheet_pages">Страницы</string><string name="sheet_attachments">Вложения</string><string name="sheet_bookmarks_contents">Закладки и оглавление</string>diff --git a/android/app/src/main/res/values-zh-rCN/strings.xml b/android/app/src/main/res/values-zh-rCN/strings.xmlindex 946f0d4..31c5a29 100644--- a/android/app/src/main/res/values-zh-rCN/strings.xml+++ b/android/app/src/main/res/values-zh-rCN/strings.xml@@ -650,6 +650,9 @@<string name="sheet_add_star">收藏</string><string name="sheet_remove_star">取消收藏</string><string name="sheet_view_settings">视图设置</string>+ <string name="sheet_toolbars">工具栏</string>+ <string name="sheet_bars_beside">在页面旁边</string>+ <string name="sheet_bars_over">浮于页面上</string><string name="sheet_pages">页面</string><string name="sheet_attachments">附件</string><string name="sheet_bookmarks_contents">书签和目录</string>diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xmlindex d21a8db..a021846 100644--- a/android/app/src/main/res/values/strings.xml+++ b/android/app/src/main/res/values/strings.xml@@ -661,6 +661,9 @@<string name="sheet_add_star">Add a star</string><string name="sheet_remove_star">Remove the star</string><string name="sheet_view_settings">View settings</string>+ <string name="sheet_toolbars">Toolbars</string>+ <string name="sheet_bars_beside">Beside the page</string>+ <string name="sheet_bars_over">Over the page</string><string name="sheet_pages">Pages</string><string name="sheet_attachments">Attachments</string><string name="sheet_bookmarks_contents">Bookmarks & Table of Contents</string>