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
What's New is its own full screen instead of a pop-up
chethan616ed348baf1a05
diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.kt b/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.ktindex 68d5cc8..6a429c6 100644--- a/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.kt+++ b/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.kt@@ -136,14 +136,13 @@ fun DocsApp(shortcutRoute: String? = null, incomingPdfUri: android.net.Uri? = nuelse -> systemDark}- // Once per update: what changed since the version this user last saw. Never alongside the- // first-run tour (that already covers everything), and it takes the star prompt's turn.- var showWhatsNew by rememberSaveable {- mutableStateOf(!needsOnboarding && OnboardingManager.shouldShowWhatsNew(context))- }- androidx.compose.runtime.SideEffect { com.chethan616.clearpdf.ui.components.WhatsNewGate.showing = showWhatsNew }- val appVersionName = remember(context) {- runCatching { context.packageManager.getPackageInfo(context.packageName, 0).versionName }.getOrNull().orEmpty()+ // Once per update, the app opens on the What's New page: what changed since the version this+ // user last saw. Never alongside the first-run tour (that already covers everything), and, like+ // the tour, never when a share or shortcut is waiting. It also takes the star prompt's turn.+ // Read once, for the same start-destination reason as `needsOnboarding`.+ val showWhatsNew = remember {+ !needsOnboarding && shortcutRoute == null && incomingPdfUri == null &&+ OnboardingManager.shouldShowWhatsNew(context)}LaunchedEffect(context) {@@ -366,7 +365,11 @@ fun DocsApp(shortcutRoute: String? = null, incomingPdfUri: android.net.Uri? = nu}},incomingPdfUri = incomingPdfUri,- startDestination = if (needsOnboarding) ROUTE_ONBOARDING else "home",+ startDestination = when {+ needsOnboarding -> ROUTE_ONBOARDING+ showWhatsNew -> com.chethan616.clearpdf.ui.navigation.ROUTE_WHATS_NEW+ else -> "home"+ },// In place: persist + update the hoisted state, which re-provides LocalResources// above, so every `stringResource` in the flow re-resolves. No recreate, or the// tour would relaunch at page one mid-flow.@@ -496,16 +499,6 @@ fun DocsApp(shortcutRoute: String? = null, incomingPdfUri: android.net.Uri? = nu}}- com.chethan616.clearpdf.ui.components.WhatsNewSheet(- visible = showWhatsNew,- versionName = appVersionName,- backdrop = contentBackdrop,- onDismiss = {- OnboardingManager.markWhatsNewSeen(context)- showWhatsNew = false- }- )-// Last child: above the tab bar and dialogs, outside the layer it samples.GlassOverlayLayer(overlayHost, contentBackdrop)}diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/components/WhatsNewSheet.kt b/app/src/main/java/com/chethan616/clearpdf/ui/components/WhatsNewSheet.ktdeleted file mode 100644index 12e8599..0000000--- a/app/src/main/java/com/chethan616/clearpdf/ui/components/WhatsNewSheet.kt+++ /dev/null@@ -1,121 +0,0 @@-package com.chethan616.clearpdf.ui.components--import androidx.compose.animation.core.Animatable-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.Spacer-import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.heightIn-import androidx.compose.foundation.rememberScrollState-import androidx.compose.foundation.text.BasicText-import androidx.compose.foundation.verticalScroll-import androidx.compose.material.icons.Icons-import androidx.compose.material.icons.rounded.AutoAwesome-import androidx.compose.material.icons.rounded.BugReport-import androidx.compose.material.icons.rounded.EditNote-import androidx.compose.material.icons.rounded.IosShare-import androidx.compose.material.icons.rounded.TableChart-import androidx.compose.material.icons.rounded.Vibration-import androidx.compose.runtime.Composable-import androidx.compose.runtime.LaunchedEffect-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.remember-import androidx.compose.runtime.setValue-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.graphics.Color-import androidx.compose.ui.graphics.graphicsLayer-import androidx.compose.ui.graphics.vector.ImageVector-import androidx.compose.ui.platform.LocalDensity-import androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.TextStyle-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.unit.dp-import androidx.compose.ui.unit.sp-import com.chethan616.clearpdf.R-import com.chethan616.clearpdf.ui.theme.LiquidGlassColors-import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode-import com.kyant.backdrop.Backdrop-import kotlinx.coroutines.delay--/** Whether the What's New sheet is up — first-use tutorials wait until it has been dismissed. */-object WhatsNewGate {- var showing by mutableStateOf(false)-}--private class WhatsNewItem(val icon: ImageVector, val accent: Color, val title: Int, val desc: Int)--private val WhatsNewItems = listOf(- WhatsNewItem(Icons.Rounded.EditNote, LiquidGlassColors.Blue, R.string.whats_new_edit_title, R.string.whats_new_edit_desc),- WhatsNewItem(Icons.Rounded.AutoAwesome, LiquidGlassColors.Teal, R.string.whats_new_glass_title, R.string.whats_new_glass_desc),- WhatsNewItem(Icons.Rounded.IosShare, LiquidGlassColors.Green, R.string.whats_new_share_title, R.string.whats_new_share_desc),- WhatsNewItem(Icons.Rounded.Vibration, LiquidGlassColors.Purple, R.string.whats_new_feel_title, R.string.whats_new_feel_desc),- WhatsNewItem(Icons.Rounded.TableChart, LiquidGlassColors.Orange, R.string.whats_new_sheets_title, R.string.whats_new_sheets_desc),- WhatsNewItem(Icons.Rounded.BugReport, LiquidGlassColors.Red, R.string.whats_new_fixes_title, R.string.whats_new_fixes_desc)-)--/**- * The once-per-update "What's new" sheet, on the app's glass dialog: a springy entrance, then the- * feature rows land one after another (~45 ms apart, a soft overshoot each).- */-@Composable-fun WhatsNewSheet(- visible: Boolean,- versionName: String,- backdrop: Backdrop,- onDismiss: () -> Unit-) {- val isDark = LocalIsDarkMode.current- val ink = LiquidGlassColors.text(isDark)- val sub = LiquidGlassColors.secondary(isDark)- GlassDialog(- visible = visible,- onDismiss = onDismiss,- backdrop = backdrop,- title = stringResource(R.string.whats_new_title, versionName),- actions = {- GlassDialogAction(stringResource(R.string.whats_new_continue), onDismiss, primary = true)- }- ) {- BasicText(stringResource(R.string.whats_new_subtitle), style = TextStyle(sub, 13.sp))- Spacer(Modifier.height(14.dp))- Column(- Modifier.fillMaxWidth().heightIn(max = 420.dp).verticalScroll(rememberScrollState()),- verticalArrangement = Arrangement.spacedBy(14.dp)- ) {- WhatsNewItems.forEachIndexed { i, item -> WhatsNewRow(item, i, ink, sub) }- }- }-}--@Composable-private fun WhatsNewRow(item: WhatsNewItem, index: Int, ink: Color, sub: Color) {- val enter = remember { Animatable(0f) }- LaunchedEffect(Unit) {- delay(180L + 45L * index)- enter.animateTo(1f, GlassMotion.pop())- }- val lift = with(LocalDensity.current) { 12.dp.toPx() }- Row(- Modifier- .fillMaxWidth()- .graphicsLayer {- val e = enter.value- alpha = e.coerceIn(0f, 1f)- translationY = (1f - e) * lift- val s = 0.92f + 0.08f * e- scaleX = s; scaleY = s- },- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(12.dp)- ) {- AccentIconTile(item.icon, item.accent, size = 38, iconSize = 20)- Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {- BasicText(stringResource(item.title), style = TextStyle(ink, 15.sp, FontWeight.SemiBold))- BasicText(stringResource(item.desc), style = TextStyle(sub, 12.5.sp, lineHeight = 16.sp))- }- }-}diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/navigation/DocsNavGraph.kt b/app/src/main/java/com/chethan616/clearpdf/ui/navigation/DocsNavGraph.ktindex 423cce5..ca338b3 100644--- a/app/src/main/java/com/chethan616/clearpdf/ui/navigation/DocsNavGraph.kt+++ b/app/src/main/java/com/chethan616/clearpdf/ui/navigation/DocsNavGraph.kt@@ -31,6 +31,7 @@ import com.chethan616.clearpdf.ui.screen.ImagesToPdfScreenimport com.chethan616.clearpdf.ui.screen.HomeScreenimport com.chethan616.clearpdf.ui.screen.MergePdfScreenimport com.chethan616.clearpdf.ui.screen.OnboardingScreen+import com.chethan616.clearpdf.ui.screen.WhatsNewScreenimport com.chethan616.clearpdf.ui.screen.SpreadsheetViewerScreenimport com.chethan616.clearpdf.ui.screen.ImageEditorScreenimport com.chethan616.clearpdf.ui.viewmodel.SpreadsheetViewModel@@ -73,6 +74,8 @@ import com.chethan616.clearpdf.ui.utils.DocumentOpenOrigin/** Public so `DocsApp` can pick it as the start destination on a first run. */const val ROUTE_ONBOARDING = "onboarding"+/** Public so `DocsApp` can open on it once after an update. */+const val ROUTE_WHATS_NEW = "whats_new"private const val ROUTE_HOME = "home"private const val ROUTE_TOOLS = "tools"@@ -361,6 +364,22 @@ fun DocsNavGraph()}+ // ── Once per update ──++ composable(ROUTE_WHATS_NEW) {+ val whatsNewContext = LocalContext.current+ WhatsNewScreen(+ backdrop = backdrop,+ onContinue = {+ com.chethan616.clearpdf.data.repository.OnboardingManager.markWhatsNewSeen(whatsNewContext)+ navController.navigate(ROUTE_HOME) {+ popUpTo(ROUTE_WHATS_NEW) { inclusive = true }+ launchSingleTop = true+ }+ }+ )+ }+// ── Main tabs ──composable(ROUTE_HOME) {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 a838528..693a917 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@@ -583,7 +583,7 @@ fun HomeScreen(LaunchedEffect(selectedRecent) { if (selectedRecent != null && showRecentsTour) finishRecentsTour() }com.chethan616.clearpdf.ui.components.GlassGuideCallout(visible = showRecentsTour && recentFilesEnabled && recents.isNotEmpty() && !searchActive &&- selectedRecent == null && !com.chethan616.clearpdf.ui.components.WhatsNewGate.showing,+ selectedRecent == null,title = stringResource(R.string.tour_recents_menu_title),message = stringResource(R.string.tour_recents_menu_message),backdrop = backdrop,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.ktindex 8e93e48..3316bc7 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@@ -276,7 +276,7 @@ fun SettingsScreen(SettingsNavRow(Icons.Rounded.Wallpaper, LiquidGlassColors.Indigo, stringResource(R.string.settings_personalization), null, ink, sub) { page = PagePersonal }}com.chethan616.clearpdf.ui.components.GlassGuideCallout(- visible = showGlassTour && !com.chethan616.clearpdf.ui.components.WhatsNewGate.showing,+ visible = showGlassTour,title = stringResource(R.string.tour_glass_title),message = stringResource(R.string.tour_glass_message),backdrop = backdrop,diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/screen/WhatsNewScreen.kt b/app/src/main/java/com/chethan616/clearpdf/ui/screen/WhatsNewScreen.ktnew file mode 100644index 0000000..8a332e1--- /dev/null+++ b/app/src/main/java/com/chethan616/clearpdf/ui/screen/WhatsNewScreen.kt@@ -0,0 +1,222 @@+package com.chethan616.clearpdf.ui.screen++import androidx.activity.compose.BackHandler+import androidx.compose.animation.core.Animatable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.text.BasicText+import androidx.compose.foundation.verticalScroll+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.rounded.AutoAwesome+import androidx.compose.material.icons.rounded.BugReport+import androidx.compose.material.icons.rounded.EditNote+import androidx.compose.material.icons.rounded.IosShare+import androidx.compose.material.icons.rounded.TableChart+import androidx.compose.material.icons.rounded.Vibration+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.CompositingStrategy+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import com.chethan616.clearpdf.R+import com.chethan616.clearpdf.ui.components.AccentIconTile+import com.chethan616.clearpdf.ui.components.GlassMotion+import com.chethan616.clearpdf.ui.components.LiquidButton+import com.chethan616.clearpdf.ui.components.viewerGlass+import com.chethan616.clearpdf.ui.theme.LiquidGlassColors+import com.chethan616.clearpdf.ui.theme.LocalIsDarkMode+import com.kyant.backdrop.backdrops.LayerBackdrop+import kotlinx.coroutines.coroutineScope+import kotlinx.coroutines.delay+import kotlinx.coroutines.launch++private class WhatsNewItem(val icon: ImageVector, val accent: Color, val title: Int, val desc: Int)++private val WhatsNewItems = listOf(+ WhatsNewItem(Icons.Rounded.EditNote, LiquidGlassColors.Blue, R.string.whats_new_edit_title, R.string.whats_new_edit_desc),+ WhatsNewItem(Icons.Rounded.AutoAwesome, LiquidGlassColors.Teal, R.string.whats_new_glass_title, R.string.whats_new_glass_desc),+ WhatsNewItem(Icons.Rounded.IosShare, LiquidGlassColors.Green, R.string.whats_new_share_title, R.string.whats_new_share_desc),+ WhatsNewItem(Icons.Rounded.Vibration, LiquidGlassColors.Purple, R.string.whats_new_feel_title, R.string.whats_new_feel_desc),+ WhatsNewItem(Icons.Rounded.TableChart, LiquidGlassColors.Orange, R.string.whats_new_sheets_title, R.string.whats_new_sheets_desc),+ WhatsNewItem(Icons.Rounded.BugReport, LiquidGlassColors.Red, R.string.whats_new_fixes_title, R.string.whats_new_fixes_desc)+)++/**+ * The once-per-update "What's new" page, iOS style: a hero badge, a big title and the version, then+ * one glass panel listing the changes and a vivid Continue. It sits on the wallpaper like onboarding,+ * so it uses the same ink and glass recipe. Back counts as Continue, so the page never comes back+ * for an update the user has already dismissed.+ */+@Composable+fun WhatsNewScreen(+ backdrop: LayerBackdrop,+ onContinue: () -> Unit+) {+ val context = LocalContext.current+ val isDark = LocalIsDarkMode.current+ // Full-strength ink: the header sits straight on the wallpaper (see OnboardingScreen).+ val ink = LiquidGlassColors.text(isDark)+ val inkSoft = LiquidGlassColors.secondary(isDark)+ val glass = if (isDark) Color(0xFF20242C).copy(0.80f) else Color.White.copy(0.72f)+ val versionName = remember(context) {+ runCatching { context.packageManager.getPackageInfo(context.packageName, 0).versionName }.getOrNull().orEmpty()+ }+ val density = LocalDensity.current.density++ BackHandler(onBack = onContinue)++ // One progress per element; scale, rise and alpha all derive from it.+ val hero = remember { Animatable(0f) }+ val header = remember { Animatable(0f) }+ val panel = remember { Animatable(0f) }+ LaunchedEffect(Unit) {+ delay(60)+ coroutineScope {+ launch { hero.animateTo(1f, GlassMotion.pop()) }+ delay(70)+ launch { header.animateTo(1f, GlassMotion.morph()) }+ delay(70)+ launch { panel.animateTo(1f, GlassMotion.settle()) }+ }+ }++ Box(Modifier.fillMaxSize()) {+ Column(+ Modifier+ .fillMaxSize()+ .verticalScroll(rememberScrollState())+ .statusBarsPadding()+ .padding(horizontal = 20.dp)+ // Bottom clears the Continue button.+ .padding(top = 48.dp, bottom = 132.dp),+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ Box(+ Modifier.graphicsLayer {+ val e = hero.value+ alpha = e.coerceIn(0f, 1f)+ val s = 0.6f + 0.4f * e+ scaleX = s; scaleY = s+ }+ ) {+ AccentIconTile(Icons.Rounded.AutoAwesome, LiquidGlassColors.Blue, size = 72, iconSize = 38)+ }++ Spacer(Modifier.height(20.dp))++ Column(+ Modifier.graphicsLayer {+ val e = header.value+ alpha = e.coerceIn(0f, 1f)+ translationY = (1f - e) * 16f * density+ },+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ BasicText(+ stringResource(R.string.whats_new_title),+ style = TextStyle(ink, 30.sp, FontWeight.Bold, textAlign = TextAlign.Center)+ )+ // Flat text, not a glass chip: this whole block rises in, and glass must not move.+ if (versionName.isNotEmpty()) {+ BasicText(+ stringResource(R.string.settings_version_label) + " " + versionName,+ style = TextStyle(ink.copy(0.8f), 13.sp, FontWeight.SemiBold)+ )+ }+ BasicText(+ stringResource(R.string.whats_new_subtitle),+ style = TextStyle(ink.copy(0.86f), 15.sp, textAlign = TextAlign.Center, lineHeight = 21.sp)+ )+ }++ Spacer(Modifier.height(24.dp))++ // Glass fades in place (never translates); the rows inside it are flat and rise in turn.+ Column(+ Modifier+ .fillMaxWidth()+ .graphicsLayer {+ alpha = panel.value.coerceIn(0f, 1f)+ compositingStrategy = CompositingStrategy.ModulateAlpha+ }+ .viewerGlass(backdrop, glass)+ .padding(vertical = 18.dp, horizontal = 16.dp),+ verticalArrangement = Arrangement.spacedBy(18.dp)+ ) {+ WhatsNewItems.forEachIndexed { i, item -> WhatsNewRow(item, i, ink, inkSoft) }+ }+ }++ Box(+ Modifier+ .align(Alignment.BottomCenter)+ .fillMaxWidth()+ .navigationBarsPadding()+ .padding(horizontal = 28.dp)+ .padding(bottom = 28.dp)+ ) {+ LiquidButton(+ onClick = onContinue,+ backdrop = backdrop,+ tint = LiquidGlassColors.Blue,+ modifier = Modifier.fillMaxWidth()+ ) {+ BasicText(+ stringResource(R.string.whats_new_continue),+ style = TextStyle(Color.White, 16.sp, FontWeight.Bold),+ maxLines = 1+ )+ }+ }+ }+}++@Composable+private fun WhatsNewRow(item: WhatsNewItem, index: Int, ink: Color, inkSoft: Color) {+ val enter = remember { Animatable(0f) }+ LaunchedEffect(Unit) {+ delay(260L + 30L * index)+ enter.animateTo(1f, GlassMotion.pop())+ }+ val lift = with(LocalDensity.current) { 14.dp.toPx() }+ Row(+ Modifier+ .fillMaxWidth()+ .graphicsLayer {+ val e = enter.value+ alpha = e.coerceIn(0f, 1f)+ translationY = (1f - e) * lift+ },+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ AccentIconTile(item.icon, item.accent, size = 44, iconSize = 22)+ Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {+ BasicText(stringResource(item.title), style = TextStyle(ink, 15.sp, FontWeight.SemiBold))+ BasicText(stringResource(item.desc), style = TextStyle(inkSoft, 12.5.sp, lineHeight = 17.sp))+ }+ }+}diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 6b181dc..c4f079b 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -774,7 +774,7 @@<string name="glass_reset">Reset to default</string><string name="settings_haptics">Haptic feedback</string><string name="settings_haptics_desc">A light tick when you tap buttons and pick options</string>- <string name="whats_new_title">What\'s new in %1$s</string>+ <string name="whats_new_title">What\'s new</string><string name="whats_new_subtitle">Here\'s what changed since your last version.</string><string name="whats_new_edit_title">Edit PDF text</string><string name="whats_new_edit_desc">Rewrite any line in its own font. Tap it with the Text tool, or long-press a word.</string>