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.

Context menus stay legible under any glass tint; roomier quick-action tiles

chethan616ac57d8222719
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassDropdown.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassDropdown.kt
index 3ff2432..9e0cc2e 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassDropdown.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassDropdown.kt
@@ -77,7 +77,9 @@ import kotlin.math.roundToInt
fun Modifier.glassMenu(
backdrop: Backdrop,
dark: Boolean,
- shape: () -> Shape = { RoundedRectangle(24.dp) }
+ shape: () -> Shape = { RoundedRectangle(24.dp) },
+ /** Surface opacity; raise it for menus that float over vivid content (context menus). */
+ surfaceAlpha: Float = 0.62f
): Modifier = drawBackdrop(
backdrop = backdrop,
shape = shape,
@@ -87,7 +89,9 @@ fun Modifier.glassMenu(
highlight = { glassHighlight(GlassSettings.style) },
shadow = null,
onDrawSurface = {
- drawRect((if (dark) Color(0xFF1E1E1E).copy(0.62f) else Color(0xFFFAFAFA).copy(0.62f)).glassTint(GlassSettings.style))
+ // Menus carry text: the user's Tint can make them denser, never clearer than legible.
+ val a = maxOf(surfaceAlpha, (surfaceAlpha * GlassSettings.style.tint)).coerceAtMost(1f)
+ drawRect(if (dark) Color(0xFF1E1E1E).copy(a) else Color(0xFFFAFAFA).copy(a))
}
)
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/RecentContextMenu.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/RecentContextMenu.kt
index 789ed0a..8a137ca 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/RecentContextMenu.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/RecentContextMenu.kt
@@ -92,7 +92,7 @@ internal class RecentMenuAction(
val onClick: () -> Unit
)
-private val MenuWidth = 236.dp
+private val MenuWidth = 256.dp
/** How much of the entrance each successive item is delayed by, as a fraction of `progress`. */
private const val Stagger = 0.06f
@@ -243,7 +243,7 @@ private fun MenuPanel(
Column(
Modifier
.width(MenuWidth)
- .glassMenu(backdrop, dark = com.chethan616.clearpdf.ui.theme.LocalIsDarkMode.current, shape = { RoundedRectangle(22.dp) })
+ .glassMenu(backdrop, dark = com.chethan616.clearpdf.ui.theme.LocalIsDarkMode.current, shape = { RoundedRectangle(22.dp) }, surfaceAlpha = 0.88f)
// Swallow taps on the panel's padding so they don't fall through to the scrim.
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {}
.semantics { contentDescription = title }
@@ -288,7 +288,7 @@ private fun QuickTile(action: RecentMenuAction, fg: Color, modifier: Modifier, e
Icon(action.icon, null, Modifier.size(19.dp), action.tint)
BasicText(
action.label,
- style = TextStyle(fg, 10.5.sp, FontWeight.Medium, textAlign = TextAlign.Center),
+ style = TextStyle(fg, 10.5.sp, FontWeight.Medium, textAlign = TextAlign.Center, letterSpacing = (-0.1).sp),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)