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.

Edit Shape on the glass dialog (all swatches fit, vivid Delete); compact recents menu; lighter Tools entrance; springier Settings push

Chethan6166d8bc3e4cb50
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerDialogs.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerDialogs.kt
index 12cac62..8e11fe1 100644
--- a/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerDialogs.kt
+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/PdfViewerDialogs.kt
@@ -418,27 +418,33 @@ internal fun AnnotationColorRow(
) {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
BasicText(stringResource(R.string.viewer_color), style = TextStyle(fgSoft, 12.sp, FontWeight.Medium))
+ // Every swatch fits the row (equal slots), and the selected one springs up with a ring.
Row(
Modifier
- .viewerGlass(backdrop, Color.White.copy(alpha = 0.07f), shape = { RoundedCornerShape(24.dp) })
- .padding(horizontal = 10.dp, vertical = 7.dp),
- horizontalArrangement = Arrangement.spacedBy(10.dp),
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(50))
+ .background(fgSoft.copy(alpha = 0.10f))
+ .padding(horizontal = 6.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
editorPalette.forEach { c ->
val isSel = c.value == selected.value
- Box(
- Modifier
- .size(if (isSel) 30.dp else 26.dp)
- .clip(CircleShape)
- .viewerGlass(backdrop, c.copy(alpha = 0.88f), shape = { CircleShape })
- .border(
- width = if (isSel) 2.5.dp else 1.dp,
- color = if (isSel) LiquidGlassColors.Blue else fgSoft.copy(alpha = 0.42f),
- shape = CircleShape
- )
- .clickable { onPick(c) }
- )
+ val s by animateFloatAsState(if (isSel) 1.15f else 1f, GlassMotion.pop(), label = "swatch")
+ Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
+ Box(
+ Modifier
+ .size(26.dp)
+ .graphicsLayer { scaleX = s; scaleY = s }
+ .clip(CircleShape)
+ .background(c)
+ .border(
+ width = if (isSel) 2.5.dp else 1.dp,
+ color = if (isSel) Color.White else fgSoft.copy(alpha = 0.3f),
+ shape = CircleShape
+ )
+ .clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) { onPick(c) }
+ )
+ }
}
}
}
@@ -465,56 +471,17 @@ internal fun ShapeEditorPopup(
var color by remember { mutableStateOf(initialColor) }
var shown by remember { mutableStateOf(false) }
LaunchedEffect(Unit) { shown = true }
-
- Box(Modifier.fillMaxSize()) {
- AnimatedVisibility(
- visible = shown,
- enter = fadeIn(tween(180)),
- exit = fadeOut(tween(140)),
- modifier = Modifier.fillMaxSize()
- ) {
- Box(
- Modifier
- .fillMaxSize()
- .background(Color.Black.copy(0.45f))
- .pointerInput(Unit) { detectTapGestures { onDismiss() } }
- )
- }
-
- AnimatedVisibility(
- visible = shown,
- enter = fadeIn(tween(200)),
- exit = fadeOut(tween(140)),
- modifier = Modifier.align(Alignment.Center).fillMaxWidth().imePadding()
- ) {
- Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
- Column(
- Modifier
- .fillMaxWidth(0.9f)
- .widthIn(max = 440.dp)
- .liquidGlassPanel(backdrop, uiSensor, surface)
- .padding(18.dp),
- verticalArrangement = Arrangement.spacedBy(16.dp)
- ) {
- BasicText(
- stringResource(R.string.viewer_edit_shape),
- style = TextStyle(fg, 16.sp, fontWeight = FontWeight.Bold)
- )
-
- AnnotationColorRow(selected = color, backdrop = backdrop, fgSoft = fgSoft, onPick = { color = it; onColorChange(it) })
-
- Row(
- Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.End),
- verticalAlignment = Alignment.CenterVertically
- ) {
- DestructiveGlassButton(stringResource(R.string.delete), onDelete, backdrop)
- LiquidButton(onClick = onDismiss, backdrop = backdrop, tint = LiquidGlassColors.Blue) {
- BasicText(stringResource(R.string.viewer_done), style = TextStyle(Color.White, 13.sp, FontWeight.Bold))
- }
- }
- }
- }
+ // The app's standard glass dialog: springy entrance, vivid red Delete + blue Done pills.
+ GlassDialog(
+ visible = shown,
+ onDismiss = onDismiss,
+ backdrop = backdrop,
+ title = stringResource(R.string.viewer_edit_shape),
+ actions = {
+ GlassDialogAction(stringResource(R.string.delete), onDelete, destructive = true)
+ GlassDialogAction(stringResource(R.string.viewer_done), onDismiss, primary = true)
}
+ ) {
+ AnnotationColorRow(selected = color, backdrop = backdrop, fgSoft = glassDialogInkSoft(), onPick = { color = it; onColorChange(it) })
}
}
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 80ef342..8687047 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
@@ -88,7 +88,7 @@ internal class RecentMenuAction(
val onClick: () -> Unit
)
-private val MenuWidth = 264.dp
+private val MenuWidth = 228.dp
/** How much of the entrance each successive item is delayed by, as a fraction of `progress`. */
private const val Stagger = 0.06f
@@ -238,7 +238,7 @@ private fun MenuPanel(
.glassMenu(backdrop, dark = com.chethan616.clearpdf.ui.theme.LocalIsDarkMode.current, shape = { RoundedRectangle(24.dp) })
// Swallow taps on the panel's padding so they don't fall through to the scrim.
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {}
- .padding(vertical = 10.dp)
+ .padding(vertical = 6.dp)
) {
BasicText(
title,
@@ -269,10 +269,10 @@ private fun MenuPanel(
scaleX = s; scaleY = s
}
) {
- Icon(action.icon, null, Modifier.size(18.dp), Color.White)
+ Icon(action.icon, null, Modifier.size(16.dp), Color.White)
BasicText(
action.label,
- style = TextStyle(Color.White, 15.sp, FontWeight.SemiBold),
+ style = TextStyle(Color.White, 14.sp, FontWeight.SemiBold),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
@@ -317,7 +317,7 @@ private fun MenuRow(action: RecentMenuAction, fg: Color, enter: () -> Float) {
Row(
Modifier
.fillMaxWidth()
- .height(48.dp)
+ .height(40.dp)
.graphicsLayer {
val e = enter()
alpha = e
@@ -348,15 +348,15 @@ private fun MenuRow(action: RecentMenuAction, fg: Color, enter: () -> Float) {
// Per-action accent chip: the colour carries the meaning, the label carries the words.
Box(
Modifier
- .size(30.dp)
+ .size(26.dp)
.drawBehind { drawCircle(action.tint.copy(alpha = if (action.destructive) 0.18f else 0.20f)) },
contentAlignment = Alignment.Center
) {
- Icon(action.icon, null, Modifier.size(17.dp), action.tint)
+ Icon(action.icon, null, Modifier.size(15.dp), action.tint)
}
BasicText(
label,
- style = TextStyle(ink, 15.sp, FontWeight.Medium),
+ style = TextStyle(ink, 14.sp, FontWeight.Medium),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
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 977619c..5e16048 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
@@ -233,7 +233,7 @@ fun SettingsScreen(
// Push / pop: the new page slides in from the side it lives on, on a soft spring.
val forward = targetState != PageIndex
val dir = if (forward) 1 else -1
- (fadeIn(tween(220)) + slideInHorizontally(spring(dampingRatio = 0.86f, stiffness = 420f)) { dir * it / 4 }) togetherWith
+ (fadeIn(tween(200)) + slideInHorizontally(spring(dampingRatio = 0.74f, stiffness = 380f)) { dir * it / 4 }) togetherWith
(fadeOut(tween(140)) + slideOutHorizontally(spring(dampingRatio = 1f, stiffness = 520f)) { -dir * it / 6 })
},
label = "settingsPage"
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 2d191f5..e04ec40 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
@@ -354,22 +354,17 @@ private fun Transition<Boolean>.glassFadeModifier(index: Int): Modifier {
*/
@Composable
private fun Transition<Boolean>.tileEntranceModifier(index: Int, density: Float): Modifier {
- val scale by animateFloat(
- transitionSpec = { tween(durationMillis = 420, delayMillis = StaggerStepMs * index, easing = EaseOutBack) },
- label = "tileScale$index"
- ) { if (it) 1f else 0.86f }
- val offsetY by animateFloat(
- transitionSpec = { tween(durationMillis = 420, delayMillis = StaggerStepMs * index, easing = EaseOutBack) },
- label = "tileOffset$index"
- ) { if (it) 0f else 18f }
- val alpha by animateFloat(
- transitionSpec = { tween(durationMillis = 260, delayMillis = StaggerStepMs * index, easing = FastOutSlowInEasing) },
- label = "tileAlpha$index"
+ // ONE animation per tile (it was three: scale, offset, alpha — ~66 running at once on entry);
+ // scale and lift ride the overshooting curve, alpha is derived and clamped so it never bounces.
+ val p by animateFloat(
+ transitionSpec = { tween(durationMillis = 440, delayMillis = StaggerStepMs * index, easing = EaseOutBack) },
+ label = "tileIn$index"
) { if (it) 1f else 0f }
return Modifier.graphicsLayer {
- this.alpha = alpha
- scaleX = scale
- scaleY = scale
- translationY = offsetY * density
+ this.alpha = (p * 1.7f).coerceIn(0f, 1f)
+ val s = 0.86f + 0.14f * p
+ scaleX = s
+ scaleY = s
+ translationY = (1f - p) * 18f * density
}
}