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
Reduce glass rendering cost while scrolling recents
Chethan61627084c3821bb
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassPanel.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassPanel.ktindex e0330ca..0f94159 100644--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassPanel.kt+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidGlassPanel.kt@@ -28,7 +28,8 @@ fun Modifier.liquidGlassPanel(// When set, overrides the theme-based tint. Used by the PDF viewer chrome, which// renders white text over a backdrop that may be a bright page — it needs a dark,// mostly-opaque base so text stays readable while the glass refraction is kept.- containerColorOverride: Color? = null+ containerColorOverride: Color? = null,+ reducedEffects: Boolean = false): Modifier {val isDarkMode = LocalIsDarkMode.currentval isLightTheme = !isDarkMode@@ -39,8 +40,15 @@ fun Modifier.liquidGlassPanel(shape = { RoundedRectangle(28f.dp) },effects = {vibrancy()- blur(8f.dp.toPx())- lens(20f.dp.toPx(), 40f.dp.toPx(), depthEffect = true)+ if (reducedEffects) {+ // Large surfaces that move over live content are the most expensive glass layers.+ // A smaller blur and no depth map preserve translucency while cutting their scroll cost.+ blur(3f.dp.toPx())+ lens(12f.dp.toPx(), 24f.dp.toPx(), depthEffect = false)+ } else {+ blur(8f.dp.toPx())+ lens(20f.dp.toPx(), 40f.dp.toPx(), depthEffect = true)+ }},highlight = { Highlight(style = HighlightStyle.Default(angle = uiSensor.gravityAngle, falloff = 2f)) },shadow = { Shadow(radius = 8f.dp, color = Color.Black.copy(alpha = 0.1f)) },diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/HomeScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/HomeScreen.ktindex 2399615..6c0ffc2 100644--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/HomeScreen.kt+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/HomeScreen.kt@@ -340,7 +340,7 @@ fun HomeScreen(Modifier.fillMaxWidth().then(entrance.entranceModifier(2, density))- .liquidGlassPanel(backdrop, uiSensor)+ .liquidGlassPanel(backdrop, uiSensor, reducedEffects = true)// The container's own minimise animation. `animateContentSize` sits INSIDE the// glass (after `liquidGlassPanel`, which is a pure draw modifier that paints at// whatever size it measures), so the glass tracks the animated height frame by