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.

Revert scroll-adaptive liquid-glass perf work and its Copilot follow-up patch; keep bug fixes

Chethan6168733889bbfc7
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassPrimitives.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassPrimitives.kt
index af14dba..3663204 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassPrimitives.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/GlassPrimitives.kt
@@ -60,7 +60,11 @@ fun GlassBackButton(
backdrop: Backdrop,
foreground: Color,
modifier: Modifier = Modifier,
- surfaceColor: Color = Color.White.copy(alpha = 0.08f),
+ // Natural glass by default, same as every sibling LiquidIconButton (search, edit, save) in a
+ // header row -- a hardcoded Color.White.copy(0.08f) here added a faint light wash only the back
+ // circle had, which read fine in light theme but made it visibly off (a touch paler/flatter)
+ // from its neighbours in dark theme.
+ surfaceColor: Color = Color.Unspecified,
onLongPressBack: (() -> Unit)? = LocalBackToLibraryAction.current,
longPressLabel: String? = null
) {
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidBottomTabs.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidBottomTabs.kt
index 57f52ee..933410c 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidBottomTabs.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidBottomTabs.kt
@@ -17,6 +17,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
@@ -37,6 +38,7 @@ import androidx.compose.ui.util.fastCoerceIn
import androidx.compose.ui.util.fastRoundToInt
import androidx.compose.ui.util.lerp
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
+import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
import com.chethan616.clearpdf.ui.utils.DampedDragAnimation
import com.chethan616.clearpdf.ui.utils.InteractiveHighlight
import com.kyant.backdrop.Backdrop
@@ -70,12 +72,9 @@ fun LiquidBottomTabs(
) {
val isDarkMode = LocalIsDarkMode.current
val isLightTheme = !isDarkMode
- val accentColor =
- if (isLightTheme) Color(0xFF0088FF)
- else Color(0xFF0091FF)
- val containerColor =
- surfaceColor ?: if (isLightTheme) Color(0xFFFAFAFA).copy(0.4f)
- else Color(0xFF121212).copy(0.4f)
+ val accentColor = LiquidGlassColors.Blue
+ val containerColor = surfaceColor ?: if (isLightTheme) Color(0xFFFAFAFA).copy(0.4f)
+ else Color(0xFF121212).copy(0.4f)
val contentHeight = (barHeight - 8.dp).coerceAtLeast(0.dp)
val tabsBackdrop = rememberLayerBackdrop()
@@ -101,7 +100,8 @@ fun LiquidBottomTabs(
val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr
val animationScope = rememberCoroutineScope()
- var currentIndex by remember(selectedTabIndex) {
+ val selectedTabIndexState = rememberUpdatedState(selectedTabIndex)
+ var currentIndex by remember {
mutableIntStateOf(selectedTabIndex())
}
val dampedDragAnimation = remember(animationScope) {
@@ -135,8 +135,8 @@ fun LiquidBottomTabs(
}
)
}
- LaunchedEffect(selectedTabIndex) {
- snapshotFlow { selectedTabIndex() }
+ LaunchedEffect(Unit) {
+ snapshotFlow { selectedTabIndexState.value() }
.collectLatest { index ->
currentIndex = index
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidButton.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidButton.kt
index 65a45a8..7400fa6 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidButton.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidButton.kt
@@ -8,8 +8,6 @@ import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
-import androidx.compose.ui.draw.clip
-import androidx.compose.ui.draw.drawBehind
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
@@ -22,7 +20,6 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastCoerceAtMost
import androidx.compose.ui.util.lerp
-import com.chethan616.clearpdf.ui.theme.LocalIsScrolling
import com.chethan616.clearpdf.ui.utils.InteractiveHighlight
import com.kyant.backdrop.Backdrop
import com.kyant.backdrop.drawBackdrop
@@ -87,80 +84,58 @@ fun LiquidButton(
val interactiveHighlight = remember(animationScope) {
InteractiveHighlight(animationScope = animationScope)
}
- // A plain (non-deferred) read: this recomposes LiquidButton on scroll start/stop, which is rare
- // -- not on every frame -- so it's cheap, and it is the only way to skip drawBackdrop's own
- // backdrop CAPTURE, not just its vibrancy/blur/lens shaders. A screen like Settings has a few
- // dozen of these (every chip, pill, action button); reading this from inside `effects` instead
- // (as liquidGlassPanel does, where panel counts are much lower) still paid for that capture on
- // every one of them every scroll frame and left Settings at ~75-80% jank despite the shader skip.
- val isScrolling = LocalIsScrolling.current()
Row(
modifier
- .then(
- if (isScrolling) {
- Modifier.clip(Capsule).drawBehind {
- if (tint.isSpecified) {
- drawRect(Color.White.copy(alpha = 0.42f))
- drawRect(tint, blendMode = BlendMode.Hue)
- drawRect(tint.copy(alpha = 0.8f))
- }
- if (surfaceColor.isSpecified) {
- drawRect(surfaceColor)
- }
- }
- } else {
- Modifier.drawBackdrop(
- backdrop = backdrop,
- shape = { Capsule },
- effects = {
- vibrancy()
- blur(blurRadius.toPx())
- lens(12f.dp.toPx(), 24f.dp.toPx())
- },
- layerBlock = if (isInteractive) {
- {
- val width = size.width
- val height = size.height
+ .drawBackdrop(
+ backdrop = backdrop,
+ shape = { Capsule },
+ effects = {
+ vibrancy()
+ blur(blurRadius.toPx())
+ lens(12f.dp.toPx(), 24f.dp.toPx())
+ },
+ layerBlock = if (isInteractive) {
+ {
+ val width = size.width
+ val height = size.height
- val progress = interactiveHighlight.pressProgress
- val scale = lerp(1f, 1f + 4f.dp.toPx() / size.height, progress)
+ val progress = interactiveHighlight.pressProgress
+ val scale = lerp(1f, 1f + 4f.dp.toPx() / size.height, progress)
- val maxOffset = size.minDimension
- val initialDerivative = 0.05f
- val offset = interactiveHighlight.offset
- translationX = maxOffset * tanh(initialDerivative * offset.x / maxOffset)
- translationY = maxOffset * tanh(initialDerivative * offset.y / maxOffset)
+ val maxOffset = size.minDimension
+ val initialDerivative = 0.05f
+ val offset = interactiveHighlight.offset
+ translationX = maxOffset * tanh(initialDerivative * offset.x / maxOffset)
+ translationY = maxOffset * tanh(initialDerivative * offset.y / maxOffset)
- val maxDragScale = 4f.dp.toPx() / size.height
- val offsetAngle = atan2(offset.y, offset.x)
- scaleX =
- scale +
- maxDragScale * abs(cos(offsetAngle) * offset.x / size.maxDimension) *
- (width / height).fastCoerceAtMost(1f)
- scaleY =
- scale +
- maxDragScale * abs(sin(offsetAngle) * offset.y / size.maxDimension) *
- (height / width).fastCoerceAtMost(1f)
- }
- } else {
- null
- },
- onDrawSurface = {
- if (tint.isSpecified) {
- // "Get it" look everywhere: a tinted pill only read vivid over light content
- // (the tint composited onto white); over the dark wallpaper the same 75% tint
- // went murky. A soft white base first makes the colour come out bright and
- // saturated on any backdrop while the lens rim still refracts.
- drawRect(Color.White.copy(alpha = 0.42f))
- drawRect(tint, blendMode = BlendMode.Hue)
- drawRect(tint.copy(alpha = 0.8f))
- }
- if (surfaceColor.isSpecified) {
- drawRect(surfaceColor)
- }
- }
- )
+ val maxDragScale = 4f.dp.toPx() / size.height
+ val offsetAngle = atan2(offset.y, offset.x)
+ scaleX =
+ scale +
+ maxDragScale * abs(cos(offsetAngle) * offset.x / size.maxDimension) *
+ (width / height).fastCoerceAtMost(1f)
+ scaleY =
+ scale +
+ maxDragScale * abs(sin(offsetAngle) * offset.y / size.maxDimension) *
+ (height / width).fastCoerceAtMost(1f)
+ }
+ } else {
+ null
+ },
+ onDrawSurface = {
+ if (tint.isSpecified) {
+ // "Get it" look everywhere: a tinted pill only read vivid over light content
+ // (the tint composited onto white); over the dark wallpaper the same 75% tint
+ // went murky. A soft white base first makes the colour come out bright and
+ // saturated on any backdrop while the lens rim still refracts.
+ drawRect(Color.White.copy(alpha = 0.42f))
+ drawRect(tint, blendMode = BlendMode.Hue)
+ drawRect(tint.copy(alpha = 0.8f))
+ }
+ if (surfaceColor.isSpecified) {
+ drawRect(surfaceColor)
+ }
}
)
.clickable(
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.kt
index d6de405..e0330ca 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
@@ -2,12 +2,9 @@ package com.chethan616.clearpdf.ui.components
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
-import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
-import com.chethan616.clearpdf.ui.theme.LocalIsScrolling
import com.chethan616.clearpdf.ui.utils.UISensor
import com.kyant.backdrop.Backdrop
import com.kyant.backdrop.drawBackdrop
@@ -37,33 +34,17 @@ fun Modifier.liquidGlassPanel(
val isLightTheme = !isDarkMode
val containerColor = containerColorOverride
?: if (isLightTheme) Color(0xFFFAFAFA).copy(0.4f) else Color(0xFF1E1E1E).copy(0.4f)
- // A flatter, more opaque stand-in for the scrolling window: cheap to draw, and dense enough
- // that it doesn't flash a visibly different material for the ~100ms it's on screen.
- val scrollingColor = containerColor.copy(alpha = (containerColor.alpha * 2.25f).coerceAtMost(0.92f))
- // A plain (non-deferred) read, not LocalIsScrolling.current used inside a draw-phase lambda:
- // this recomposes on scroll start/stop (rare) so it can branch the modifier chain itself and
- // skip drawBackdrop's own backdrop CAPTURE while scrolling, not just its vibrancy/blur/lens
- // shaders. A screen with many panels (Settings has ~10) was still paying for that capture on
- // every one, every scroll frame, even with the shaders skipped -- see LiquidButton's own note,
- // where the same upgrade was needed for its many small per-chip/pill instances.
- val isScrolling = LocalIsScrolling.current()
- return this.then(
- if (isScrolling) {
- Modifier.clip(RoundedRectangle(28f.dp)).drawBehind { drawRect(scrollingColor) }
- } else {
- Modifier.drawBackdrop(
- backdrop = backdrop,
- shape = { RoundedRectangle(28f.dp) },
- effects = {
- vibrancy()
- 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)) },
- innerShadow = { InnerShadow(radius = 3f.dp, alpha = 0.3f) },
- onDrawSurface = { drawRect(containerColor) }
- )
- }
+ return this.drawBackdrop(
+ backdrop = backdrop,
+ shape = { RoundedRectangle(28f.dp) },
+ effects = {
+ vibrancy()
+ 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)) },
+ innerShadow = { InnerShadow(radius = 3f.dp, alpha = 0.3f) },
+ onDrawSurface = { drawRect(containerColor) }
)
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidIconButton.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidIconButton.kt
index 706ea41..2bf1460 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidIconButton.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/components/LiquidIconButton.kt
@@ -10,8 +10,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
-import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.isSpecified
@@ -19,7 +17,6 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastCoerceAtMost
import androidx.compose.ui.util.lerp
-import com.chethan616.clearpdf.ui.theme.LocalIsScrolling
import com.chethan616.clearpdf.ui.utils.InteractiveHighlight
import com.kyant.backdrop.Backdrop
import com.kyant.backdrop.drawBackdrop
@@ -53,71 +50,54 @@ fun LiquidIconButton(
val interactiveHighlight = remember(animationScope) {
InteractiveHighlight(animationScope = animationScope)
}
- // See LiquidButton's own note: a plain (non-deferred) read so this skips drawBackdrop's capture
- // entirely while scrolling, not just its shaders.
- val isScrolling = LocalIsScrolling.current()
Box(
modifier
.size(40.dp)
- .then(
- if (isScrolling) {
- Modifier.clip(CircleShape).drawBehind {
- if (tint.isSpecified) {
- drawRect(tint, blendMode = BlendMode.Hue)
- drawRect(tint.copy(alpha = 0.75f))
- }
- if (surfaceColor.isSpecified) {
- drawRect(surfaceColor)
- }
- }
- } else {
- Modifier.drawBackdrop(
- backdrop = backdrop,
- shape = { CircleShape },
- effects = {
- vibrancy()
- blur(2f.dp.toPx())
- lens(12f.dp.toPx(), 24f.dp.toPx())
- },
- layerBlock = if (isInteractive) {
- {
- val width = size.width
- val height = size.height
+ .drawBackdrop(
+ backdrop = backdrop,
+ shape = { CircleShape },
+ effects = {
+ vibrancy()
+ blur(2f.dp.toPx())
+ lens(12f.dp.toPx(), 24f.dp.toPx())
+ },
+ layerBlock = if (isInteractive) {
+ {
+ val width = size.width
+ val height = size.height
- val progress = interactiveHighlight.pressProgress
- val scale = lerp(1f, 1f + 4f.dp.toPx() / size.height, progress)
+ val progress = interactiveHighlight.pressProgress
+ val scale = lerp(1f, 1f + 4f.dp.toPx() / size.height, progress)
- val maxOffset = size.minDimension
- val initialDerivative = 0.05f
- val offset = interactiveHighlight.offset
- translationX = maxOffset * tanh(initialDerivative * offset.x / maxOffset)
- translationY = maxOffset * tanh(initialDerivative * offset.y / maxOffset)
+ val maxOffset = size.minDimension
+ val initialDerivative = 0.05f
+ val offset = interactiveHighlight.offset
+ translationX = maxOffset * tanh(initialDerivative * offset.x / maxOffset)
+ translationY = maxOffset * tanh(initialDerivative * offset.y / maxOffset)
- val maxDragScale = 4f.dp.toPx() / size.height
- val offsetAngle = atan2(offset.y, offset.x)
- scaleX =
- scale +
- maxDragScale * abs(cos(offsetAngle) * offset.x / size.maxDimension) *
- (width / height).fastCoerceAtMost(1f)
- scaleY =
- scale +
- maxDragScale * abs(sin(offsetAngle) * offset.y / size.maxDimension) *
- (height / width).fastCoerceAtMost(1f)
- }
- } else {
- null
- },
- onDrawSurface = {
- if (tint.isSpecified) {
- drawRect(tint, blendMode = BlendMode.Hue)
- drawRect(tint.copy(alpha = 0.75f))
- }
- if (surfaceColor.isSpecified) {
- drawRect(surfaceColor)
- }
- }
- )
+ val maxDragScale = 4f.dp.toPx() / size.height
+ val offsetAngle = atan2(offset.y, offset.x)
+ scaleX =
+ scale +
+ maxDragScale * abs(cos(offsetAngle) * offset.x / size.maxDimension) *
+ (width / height).fastCoerceAtMost(1f)
+ scaleY =
+ scale +
+ maxDragScale * abs(sin(offsetAngle) * offset.y / size.maxDimension) *
+ (height / width).fastCoerceAtMost(1f)
+ }
+ } else {
+ null
+ },
+ onDrawSurface = {
+ if (tint.isSpecified) {
+ drawRect(tint, blendMode = BlendMode.Hue)
+ drawRect(tint.copy(alpha = 0.75f))
+ }
+ if (surfaceColor.isSpecified) {
+ drawRect(surfaceColor)
+ }
}
)
.then(
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.kt
index a4dca1b..e75bfed 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
@@ -56,7 +56,6 @@ import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
-import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicText
import androidx.compose.material.icons.Icons
@@ -79,7 +78,6 @@ import androidx.compose.material.icons.rounded.Scanner
import androidx.compose.material.icons.rounded.Slideshow
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -129,7 +127,6 @@ import com.chethan616.clearpdf.ui.components.LiquidIconButton
import com.chethan616.clearpdf.ui.components.liquidGlassPanel
import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
-import com.chethan616.clearpdf.ui.theme.LocalIsScrolling
import com.chethan616.clearpdf.ui.utils.rememberUISensor
import com.chethan616.clearpdf.utils.DocKind
import com.chethan616.clearpdf.utils.docKindOf
@@ -288,12 +285,8 @@ fun HomeScreen(
onScan = onNavigateToScan
)
} else {
- val lazyListState = rememberLazyListState()
- val isScrolling = remember(lazyListState) { { lazyListState.isScrollInProgress } }
- CompositionLocalProvider(LocalIsScrolling provides isScrolling) {
LazyColumn(
Modifier.fillMaxSize(),
- state = lazyListState,
contentPadding = contentPadding,
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
@@ -482,7 +475,6 @@ fun HomeScreen(
Spacer(Modifier.height(TabBarClearance))
}
}
- }
}
}
@@ -776,13 +768,10 @@ private fun HomeLaunchpad(
val top = contentPadding.calculateTopPadding()
val bottom = contentPadding.calculateBottomPadding() + TabBarClearance
val visibleHeight = (maxHeight - top - bottom).coerceAtLeast(0.dp)
- val launchpadScroll = rememberScrollState()
- val isScrolling = remember(launchpadScroll) { { launchpadScroll.isScrollInProgress } }
- CompositionLocalProvider(LocalIsScrolling provides isScrolling) {
Column(
Modifier
.fillMaxSize()
- .verticalScroll(launchpadScroll)
+ .verticalScroll(rememberScrollState())
.padding(start = 16.dp, end = 16.dp, top = top, bottom = bottom)
.heightIn(min = visibleHeight),
verticalArrangement = Arrangement.Center,
@@ -864,7 +853,6 @@ private fun HomeLaunchpad(
}
}
}
- }
}
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
index 847555c..b37effe 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/SettingsScreen.kt
@@ -55,7 +55,6 @@ import androidx.compose.material.icons.rounded.Vibration
import androidx.compose.material.icons.rounded.Wallpaper
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
@@ -97,7 +96,6 @@ import com.chethan616.clearpdf.ui.components.ToolPrimaryButton
import com.chethan616.clearpdf.ui.components.liquidGlassPanel
import com.chethan616.clearpdf.ui.components.rememberScreenBackdrop
import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
-import com.chethan616.clearpdf.ui.theme.LocalIsScrolling
import com.chethan616.clearpdf.ui.theme.ToolAccents
import com.chethan616.clearpdf.ui.utils.rememberUISensor
import com.kyant.backdrop.Backdrop
@@ -194,7 +192,6 @@ fun SettingsScreen(
}
) { contentPadding ->
val scrollState = rememberScrollState()
- val isScrolling = remember(scrollState) { { scrollState.isScrollInProgress } }
val officeEngineRequester = remember { BringIntoViewRequester() }
LaunchedEffect(Unit) {
if (OfficeEngine.focusSettingsSection.value) {
@@ -203,7 +200,6 @@ fun SettingsScreen(
officeEngineRequester.bringIntoView()
}
}
- CompositionLocalProvider(LocalIsScrolling provides isScrolling) {
Column(
Modifier.fillMaxSize().verticalScroll(scrollState).padding(contentPadding),
verticalArrangement = Arrangement.spacedBy(16.dp)
@@ -475,7 +471,6 @@ fun SettingsScreen(
BasicText(stringResource(R.string.settings_license_notice), style = TextStyle(sub.copy(0.7f), 11.sp, lineHeight = 16.sp))
}
}
- }
}
}
// Outside the scaffold's captured layer so it refracts the live screen (wallpaper + content).
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 ba84f6b..2a25270 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
@@ -673,14 +673,11 @@ fun SpreadsheetViewerScreen(
// A single plain share button, not the reader's hold-and-swipe ShareMorph gesture — the
// sheet already has an explicit "export as PDF" entry point elsewhere in its tools, so this
- // one control only needs to do the one thing its icon says. Long-press keeps the PDF export
- // reachable (same as the back circle's long-press-for-library convention) instead of losing
- // it outright.
+ // one control only needs to do the one thing its icon says. No long-press: it used to open
+ // a PDF export, which surprised people tapping-and-holding by habit.
if (sheet != null && !showSearch && !editMode) {
LiquidIconButton(
onClick = { viewModel.shareableUri(context) { u -> u?.let { shareFile(context, it) } } },
- onLongClick = { viewModel.exportToPdf(context) { u -> u?.let(onOpenPdf) } },
- onLongClickLabel = stringResource(R.string.sheet_export_pdf),
backdrop = screenBackdrop.glass,
// bottom = 6.dp centers this 52dp button on the sheet dock's 44dp-tall, 10dp-bottom-
// padded capsule (10 + 44/2 = 32dp center; a 52dp button centers there at 32 - 26 = 6dp).
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/ToolsScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/ToolsScreen.kt
index 8c2bdb0..fb35953 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/ToolsScreen.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/ToolsScreen.kt
@@ -45,7 +45,6 @@ import androidx.compose.material.icons.rounded.PhotoSizeSelectLarge
import androidx.compose.material.icons.rounded.Reorder
import androidx.compose.material.icons.rounded.TextSnippet
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -69,7 +68,6 @@ import com.chethan616.clearpdf.ui.components.ToolTileWide
import com.chethan616.clearpdf.ui.components.liquidGlassPanel
import com.chethan616.clearpdf.ui.theme.LiquidGlassColors
import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode
-import com.chethan616.clearpdf.ui.theme.LocalIsScrolling
import com.chethan616.clearpdf.ui.theme.ToolAccents
import com.chethan616.clearpdf.ui.utils.UISensor
import com.chethan616.clearpdf.ui.utils.rememberUISensor
@@ -216,13 +214,10 @@ fun ToolsScreen(
},
label = "toolsSearchSwap"
) { showResults ->
- val scrollState = rememberScrollState()
- val isScrolling = remember(scrollState) { { scrollState.isScrollInProgress } }
- CompositionLocalProvider(LocalIsScrolling provides isScrolling) {
Column(
Modifier
.fillMaxSize()
- .verticalScroll(scrollState)
+ .verticalScroll(rememberScrollState())
.padding(contentPadding),
verticalArrangement = Arrangement.spacedBy(18.dp)
) {
@@ -261,7 +256,6 @@ fun ToolsScreen(
}
}
}
- }
}
}
}
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/theme/ThemeState.kt b/app/src/main/java/com/chethan616/clearpdf/ui/theme/ThemeState.kt
index 68a8ea8..5bba9c7 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/theme/ThemeState.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/theme/ThemeState.kt
@@ -1,7 +1,6 @@
package com.chethan616.clearpdf.ui.theme
import androidx.compose.runtime.compositionLocalOf
-import androidx.compose.runtime.staticCompositionLocalOf
/**
* CompositionLocal for app-wide dark mode state.
@@ -16,17 +15,3 @@ val LocalIsDarkMode = compositionLocalOf { false }
* every one of its call sites across the app.
*/
val LocalReducedGlassMotion = compositionLocalOf { false }
-
-/**
- * Deferred read of "is my nearest scroll container actively moving" (`ScrollState`/`LazyListState`'s
- * own `isScrollInProgress`, hoisted by the screen and provided here). `liquidGlassPanel` reads this
- * lambda from its DRAW phase -- same convention as `UISensor.gravityAngle` -- so toggling it only
- * invalidates that panel's draw, not a recomposition of the whole screen.
- *
- * Profiled on Tools: 4 simultaneous glass panels each re-running vibrancy+blur+lens every scroll
- * frame cost ~32% janky frames with the UI thread (not the GPU) as the bottleneck. Screens that
- * provide this skip those three shader passes while scrolling and fall back to a flat tinted fill,
- * restoring full glass the instant the scroll settles. `staticCompositionLocalOf` because providing
- * it (per screen, once) is far rarer than reading it (every panel, every frame).
- */
-val LocalIsScrolling = staticCompositionLocalOf<() -> Boolean> { { false } }