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
feat: rebuild Settings in Apple-HIG style + wallpaper toggle
Chethan616712e4a383226
diff --git a/app/src/main/java/com/chethan616/clearpdf/data/repository/Preferences.kt b/app/src/main/java/com/chethan616/clearpdf/data/repository/Preferences.ktindex 8415dc2..7cd476d 100644--- a/app/src/main/java/com/chethan616/clearpdf/data/repository/Preferences.kt+++ b/app/src/main/java/com/chethan616/clearpdf/data/repository/Preferences.kt@@ -113,10 +113,17 @@ object AppSettingsManager {private const val KEY_NOTIFICATIONS = "notifications"private const val KEY_DEFAULT_QUALITY = "default_quality"private const val KEY_THEME_MODE = "theme_mode" // 0: System, 1: Light, 2: Dark+ private const val KEY_SHOW_WALLPAPER = "show_wallpaper"private fun prefs(context: Context): SharedPreferences =context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)+ fun getShowWallpaper(context: Context): Boolean =+ prefs(context).getBoolean(KEY_SHOW_WALLPAPER, true)++ fun setShowWallpaper(context: Context, value: Boolean) =+ prefs(context).edit().putBoolean(KEY_SHOW_WALLPAPER, value).apply()+fun getAutoCompress(context: Context): Boolean =prefs(context).getBoolean(KEY_AUTO_COMPRESS, true)diff --git a/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.kt b/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.ktindex 1f5b366..ecff721 100644--- a/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.kt+++ b/app/src/main/java/com/chethan616/clearpdf/ui/DocsApp.kt@@ -3,6 +3,7 @@ package com.chethan616.clearpdf.uiimport android.content.Intentimport android.net.Uriimport androidx.compose.foundation.Image+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.isSystemInDarkThemeimport androidx.compose.foundation.layout.Arrangement@@ -74,6 +75,7 @@ fun DocsApp(shortcutRoute: String? = null, incomingPdfUri: android.net.Uri? = nu}var themeMode by rememberSaveable { mutableIntStateOf(AppSettingsManager.getThemeMode(context)) }+ var showWallpaper by rememberSaveable { mutableStateOf(AppSettingsManager.getShowWallpaper(context)) }var showStarPrompt by rememberSaveable { mutableStateOf(false) }val systemDark = isSystemInDarkTheme()val isDarkMode = when (themeMode) {@@ -163,12 +165,24 @@ fun DocsApp(shortcutRoute: String? = null, incomingPdfUri: android.net.Uri? = nu// the wallpaper-only `backdrop`; it lives INSIDE this layer but samples a// different backdrop, so there is no glass-on-glass feedback loop.Box(Modifier.fillMaxSize().layerBackdrop(contentBackdrop)) {- Image(- painterResource(if (!isDarkMode) R.drawable.wallpaper_light else R.drawable.wallpaper_dark),- contentDescription = null,- modifier = Modifier.layerBackdrop(backdrop).fillMaxSize(),- contentScale = ContentScale.Crop- )+ if (showWallpaper) {+ Image(+ painterResource(if (!isDarkMode) R.drawable.wallpaper_light else R.drawable.wallpaper_dark),+ contentDescription = null,+ modifier = Modifier.layerBackdrop(backdrop).fillMaxSize(),+ contentScale = ContentScale.Crop+ )+ } else {+ // Wallpaper off (user experiment): fall back to a flat iOS+ // system-grouped-background so the glass surfaces still have a+ // base to sample and the app reads as a clean Apple settings look.+ Box(+ Modifier+ .layerBackdrop(backdrop)+ .fillMaxSize()+ .background(if (!isDarkMode) Color(0xFFF2F2F7) else Color(0xFF000000))+ )+ }DocsNavGraph(navController = navController,backdrop = backdrop,@@ -181,6 +195,11 @@ fun DocsApp(shortcutRoute: String? = null, incomingPdfUri: android.net.Uri? = nuthemeMode = itAppSettingsManager.setThemeMode(context, it)},+ showWallpaper = showWallpaper,+ onShowWallpaperChanged = {+ showWallpaper = it+ AppSettingsManager.setShowWallpaper(context, it)+ },selectedLocale = selectedLocale,onLocaleChanged = { code ->val normalized = com.chethan616.clearpdf.ui.utils.LocaleHelper.normalizeForUi(code)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 046f5d9..c0800ea 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@@ -107,6 +107,8 @@ fun DocsNavGraph(onDarkModeChanged: (Boolean) -> Unit,themeMode: Int,onThemeModeChanged: (Int) -> Unit,+ showWallpaper: Boolean = true,+ onShowWallpaperChanged: (Boolean) -> Unit = {},selectedLocale: String,onLocaleChanged: (String) -> Unit,incomingPdfUri: Uri? = null@@ -238,6 +240,8 @@ fun DocsNavGraph(onDarkModeChanged = onDarkModeChanged,themeMode = themeMode,onThemeModeChanged = onThemeModeChanged,+ showWallpaper = showWallpaper,+ onShowWallpaperChanged = onShowWallpaperChanged,selectedLocale = selectedLocale,onLocaleChanged = onLocaleChanged)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 60f9343..a8e3c43 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@@ -9,12 +9,10 @@ import androidx.compose.animation.core.FastOutSlowInEasingimport androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.animation.core.tweenimport androidx.compose.foundation.background-import androidx.compose.foundation.borderimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.ColumnScopeimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.WindowInsets@@ -22,31 +20,30 @@ import androidx.compose.foundation.layout.asPaddingValuesimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.navigationBarsimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.statusBarsPaddingimport androidx.compose.foundation.rememberScrollState-import androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.foundation.text.BasicTextimport androidx.compose.foundation.verticalScrollimport androidx.compose.material.icons.Icons-import androidx.compose.material.icons.rounded.AutoFixHigh+import androidx.compose.material.icons.rounded.Check+import androidx.compose.material.icons.rounded.ChevronRightimport androidx.compose.material.icons.rounded.Code+import androidx.compose.material.icons.rounded.Compressimport androidx.compose.material.icons.rounded.DarkModeimport androidx.compose.material.icons.rounded.Downloadimport androidx.compose.material.icons.rounded.FileCopyimport androidx.compose.material.icons.rounded.FolderOpen-import androidx.compose.material.icons.rounded.FolderSpecialimport androidx.compose.material.icons.rounded.HighQuality-import androidx.compose.material.icons.rounded.Infoimport androidx.compose.material.icons.rounded.Language-import androidx.compose.material.icons.rounded.LightModeimport androidx.compose.material.icons.rounded.Notifications-import androidx.compose.material.icons.rounded.PhoneAndroid+import androidx.compose.material.icons.rounded.Shieldimport androidx.compose.material.icons.rounded.Star-import androidx.compose.material.icons.rounded.Tune+import androidx.compose.material.icons.rounded.Wallpaperimport androidx.compose.material3.Iconimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffect@@ -66,19 +63,13 @@ import androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.TextStyleimport androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflow-import androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport androidx.compose.ui.unit.spimport com.chethan616.clearpdf.Rimport com.chethan616.clearpdf.data.repository.AppSettingsManagerimport com.chethan616.clearpdf.data.repository.GitHubStarPromptManagerimport com.chethan616.clearpdf.data.repository.SaveLocationManager-import com.chethan616.clearpdf.ui.components.GlassChip-import com.chethan616.clearpdf.ui.components.GlassSectionHeader-import com.chethan616.clearpdf.ui.components.LiquidButton-import com.chethan616.clearpdf.ui.components.LiquidGlassTopBarimport com.chethan616.clearpdf.ui.components.LiquidSliderimport com.chethan616.clearpdf.ui.components.LiquidToggleimport com.chethan616.clearpdf.ui.components.glassSection@@ -86,14 +77,24 @@ import com.chethan616.clearpdf.ui.utils.rememberUISensorimport com.kyant.backdrop.backdrops.LayerBackdropimport kotlinx.coroutines.delay-// ── Shared design tokens (Item 4 spirit, scoped to Settings) ────────────────-// Centralised so every section shares the same rhythm; no more per-block magic-// numbers drifting apart.-private val InnerRadius = 16.dp-private val SectionGap = 16.dp-private val SectionPadding = 20.dp-private val AccentBlue = Color(0xFF0088FF)-private val AccentGreen = Color(0xFF00C853)+/**+ * Settings — rebuilt from scratch in the iOS-Settings "inset grouped" idiom (Apple HIG):+ * a large navigation title, grouped rounded cards with uppercase section headers and gray+ * footnotes, colored SF-Symbol-style icon tiles, inset hairline separators, and native-feeling+ * segmented controls / switches. The card surface uses the app's shared glass so it reads well+ * over both the wallpaper and the flat background (see the Background toggle at the bottom).+ */++// iOS system accent palette for the icon tiles.+private val SysBlue = Color(0xFF007AFF)+private val SysGreen = Color(0xFF34C759)+private val SysIndigo = Color(0xFF5856D6)+private val SysOrange = Color(0xFFFF9500)+private val SysPurple = Color(0xFFAF52DE)+private val SysRed = Color(0xFFFF3B30)+private val SysTeal = Color(0xFF5AC8FA)+private val SysYellow = Color(0xFFFFCC00)+private val SysGray = Color(0xFF8E8E93)@Composablefun SettingsScreen(@@ -102,45 +103,34 @@ fun SettingsScreen(onDarkModeChanged: (Boolean) -> Unit = {},themeMode: Int = 0,onThemeModeChanged: (Int) -> Unit = {},+ showWallpaper: Boolean = true,+ onShowWallpaperChanged: (Boolean) -> Unit = {},selectedLocale: String = "en",onLocaleChanged: (String) -> Unit = {}) {val isLight = !isDarkMode- val text = if (isLight) Color(0xFF222222) else Color(0xFFF0F0F0)- val sub = if (isLight) Color(0xFF888888) else Color(0xFFAAAAAA)- val label = if (isLight) Color(0xFF444444) else Color(0xFFCCCCCC)- val uiSensor = rememberUISensor()+ // Apple label colors.+ val label = if (isLight) Color(0xFF000000) else Color(0xFFFFFFFF)+ val secondary = if (isLight) Color(0xFF3C3C43).copy(0.60f) else Color(0xFFEBEBF5).copy(0.60f)+ val tertiary = if (isLight) Color(0xFF3C3C43).copy(0.45f) else Color(0xFFEBEBF5).copy(0.45f)val context = LocalContext.currentval density = LocalDensity.current.density- val openRepo = remember(context) {- { openExternalLink(context, GitHubStarPromptManager.REPO_URL) }- }- // ── Backing state (unchanged persistence calls) ─────────────────────────var autoCompress by remember { mutableStateOf(AppSettingsManager.getAutoCompress(context)) }var keepOriginal by remember { mutableStateOf(AppSettingsManager.getKeepOriginal(context)) }var notifications by remember { mutableStateOf(AppSettingsManager.getNotifications(context)) }var defaultQuality by remember { mutableFloatStateOf(AppSettingsManager.getDefaultQuality(context)) }-- // Debounce quality slider persistence to prevent lag.LaunchedEffect(defaultQuality) {- delay(300L)- AppSettingsManager.setDefaultQuality(context, defaultQuality)+ delay(300L); AppSettingsManager.setDefaultQuality(context, defaultQuality)}var saveUri by remember { mutableStateOf(SaveLocationManager.getSaveUri(context)) }-val folderPicker = rememberLauncherForActivityResult(contract = ActivityResultContracts.OpenDocumentTree()) { uri: Uri? ->if (uri != null) {- val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or- Intent.FLAG_GRANT_WRITE_URI_PERMISSION- try {- context.contentResolver.takePersistableUriPermission(uri, flags)- } catch (_: Exception) {- // Some providers reject persistable flags; fallback still stores the chosen URI.- }+ val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION+ try { context.contentResolver.takePersistableUriPermission(uri, flags) } catch (_: Exception) {}val displayPath = uri.lastPathSegment?.replace("primary:", "") ?: uri.toString()SaveLocationManager.setSaveLocation(context, uri, displayPath)saveUri = uri@@ -149,439 +139,408 @@ fun SettingsScreen(var isVisible by remember { mutableStateOf(false) }LaunchedEffect(Unit) { isVisible = true }+ val fade by animateFloatAsState(+ if (isVisible) 1f else 0f,+ tween(durationMillis = 420, easing = FastOutSlowInEasing),+ label = "settingsFade"+ )+ val rise by animateFloatAsState(+ if (isVisible) 0f else 14f,+ tween(durationMillis = 420, easing = FastOutSlowInEasing),+ label = "settingsRise"+ )Column(Modifier.fillMaxSize().statusBarsPadding()- .padding(16.dp)- .verticalScroll(rememberScrollState()),- verticalArrangement = Arrangement.spacedBy(SectionGap)+ .verticalScroll(rememberScrollState())+ .graphicsLayer { alpha = fade; translationY = rise * density }) {- Box(reveal(0, isVisible, density)) {- LiquidGlassTopBar(- title = stringResource(R.string.settings_title),- backdrop = backdrop,- uiSensor = uiSensor,- modifier = Modifier.fillMaxWidth()- )- }+ // Large navigation title.+ BasicText(+ stringResource(R.string.settings_title),+ style = TextStyle(label, 34.sp, fontWeight = FontWeight.Bold),+ modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 8.dp, bottom = 10.dp)+ )// ── Appearance ──────────────────────────────────────────────────────- SettingsSection(- title = stringResource(R.string.settings_appearance),- icon = Icons.Rounded.Tune,- iconTint = AccentBlue,- isLight = isLight,- titleColor = text,- modifier = reveal(1, isVisible, density)- ) {- SegmentedSelector(- options = listOf(- SegOption("0", stringResource(R.string.settings_theme_auto), Icons.Rounded.PhoneAndroid, AccentBlue),- SegOption("1", stringResource(R.string.settings_theme_light), Icons.Rounded.LightMode, Color(0xFFFFA726)),- SegOption("2", stringResource(R.string.settings_theme_dark), Icons.Rounded.DarkMode, Color(0xFF7C4DFF))- ),- selectedId = themeMode.toString(),- isLight = isLight,- backdrop = backdrop,- onSelect = { onThemeModeChanged(it.toInt()) }- )- BasicText(- when (themeMode) {- 1 -> stringResource(R.string.settings_theme_light_desc)- 2 -> stringResource(R.string.settings_theme_dark_desc)- else -> stringResource(R.string.settings_theme_auto_desc)- },- style = TextStyle(sub, 12.sp)+ SettingsGroup(header = stringResource(R.string.settings_appearance), isLight = isLight, secondary = secondary) {+ listOf<@Composable () -> Unit>(+ {+ SegmentedRow(+ options = listOf(+ stringResource(R.string.settings_theme_auto),+ stringResource(R.string.settings_theme_light),+ stringResource(R.string.settings_theme_dark)+ ),+ selectedIndex = themeMode,+ isLight = isLight,+ label = label,+ onSelect = onThemeModeChanged+ )+ })}// ── Language ────────────────────────────────────────────────────────- SettingsSection(- title = stringResource(R.string.settings_language),- icon = Icons.Rounded.Language,- iconTint = AccentBlue,- isLight = isLight,- titleColor = text,- modifier = reveal(2, isVisible, density)- ) {- SegmentedSelector(- options = listOf(- SegOption("en", stringResource(R.string.language_english), null, AccentBlue),- SegOption("pt-BR", stringResource(R.string.language_portuguese), null, AccentBlue)- ),- selectedId = selectedLocale,- isLight = isLight,- backdrop = backdrop,- onSelect = onLocaleChanged+ SettingsGroup(header = stringResource(R.string.settings_language), isLight = isLight, secondary = secondary) {+ listOf<@Composable () -> Unit>(+ {+ val codes = listOf("en", "pt-BR")+ SegmentedRow(+ options = listOf(+ stringResource(R.string.language_english),+ stringResource(R.string.language_portuguese)+ ),+ selectedIndex = codes.indexOf(selectedLocale).coerceAtLeast(0),+ isLight = isLight,+ label = label,+ onSelect = { onLocaleChanged(codes[it]) }+ )+ })}- // ── Files: save location ────────────────────────────────────────────- SettingsSection(- title = stringResource(R.string.settings_save_location),- icon = Icons.Rounded.FolderOpen,- iconTint = AccentBlue,- isLight = isLight,- titleColor = text,- modifier = reveal(3, isVisible, density)+ // ── Files ───────────────────────────────────────────────────────────+ SettingsGroup(+ header = stringResource(R.string.settings_save_location),+ isLight = isLight, secondary = secondary,+ footer = if (saveUri != null)+ (saveUri!!.lastPathSegment?.replace("primary:", "") ?: saveUri.toString())+ else stringResource(R.string.settings_default_path)) {- val isDefault = saveUri == null- SegmentedSelector(- options = listOf(- SegOption("default", stringResource(R.string.settings_save_downloads), Icons.Rounded.Download, AccentBlue),- SegOption("custom", stringResource(R.string.settings_save_custom), Icons.Rounded.FolderSpecial, AccentGreen)- ),- selectedId = if (isDefault) "default" else "custom",- isLight = isLight,- backdrop = backdrop,- onSelect = { id ->- if (id == "default") {- if (!isDefault) { SaveLocationManager.clearSaveLocation(context); saveUri = null }- } else {- folderPicker.launch(null)- }+ listOf<@Composable () -> Unit>(+ {+ SettingsRow(+ icon = Icons.Rounded.Download, iconTint = SysBlue,+ title = stringResource(R.string.settings_save_downloads),+ label = label, secondary = secondary,+ trailing = { if (saveUri == null) SelectedCheck() },+ onClick = { if (saveUri != null) { SaveLocationManager.clearSaveLocation(context); saveUri = null } }+ )+ },+ {+ SettingsRow(+ icon = Icons.Rounded.FolderOpen, iconTint = SysOrange,+ title = stringResource(R.string.settings_save_custom),+ label = label, secondary = secondary,+ trailing = { if (saveUri != null) SelectedCheck() else Chevron(tertiary) },+ onClick = { folderPicker.launch(null) }+ )})+ }- // Path details card.- val accent = if (saveUri != null) AccentGreen else AccentBlue- Row(- Modifier- .fillMaxWidth()- .clip(RoundedCornerShape(InnerRadius))- .background(if (isLight) Color.Black.copy(0.03f) else Color.White.copy(0.05f))- .border(1.dp, if (isLight) Color.Black.copy(0.05f) else Color.White.copy(0.08f), RoundedCornerShape(InnerRadius))- .padding(14.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(12.dp)- ) {- Box(- Modifier.size(38.dp).clip(CircleShape).background(accent.copy(0.14f)),- contentAlignment = Alignment.Center- ) {- Icon(- if (saveUri != null) Icons.Rounded.FolderSpecial else Icons.Rounded.Download,- null, Modifier.size(19.dp), accent+ SettingsGroup(header = stringResource(R.string.settings_file_handling), isLight = isLight, secondary = secondary) {+ listOf<@Composable () -> Unit>(+ {+ ToggleRow(+ icon = Icons.Rounded.Compress, iconTint = SysGreen,+ title = stringResource(R.string.settings_auto_compress),+ subtitle = stringResource(R.string.settings_auto_compress_desc),+ checked = autoCompress, label = label, secondary = secondary, backdrop = backdrop,+ onCheckedChange = { autoCompress = it; AppSettingsManager.setAutoCompress(context, it) })- }- Column(Modifier.weight(1f)) {- BasicText(- if (saveUri != null) stringResource(R.string.settings_custom_directory)- else stringResource(R.string.settings_default_directory),- style = TextStyle(label, 13.sp, fontWeight = FontWeight.SemiBold)+ },+ {+ ToggleRow(+ icon = Icons.Rounded.FileCopy, iconTint = SysTeal,+ title = stringResource(R.string.settings_keep_original),+ subtitle = stringResource(R.string.settings_keep_original_desc),+ checked = keepOriginal, label = label, secondary = secondary, backdrop = backdrop,+ onCheckedChange = { keepOriginal = it; AppSettingsManager.setKeepOriginal(context, it) }+ )+ },+ {+ ToggleRow(+ icon = Icons.Rounded.Notifications, iconTint = SysRed,+ title = stringResource(R.string.settings_notifications),+ subtitle = stringResource(R.string.settings_notifications_desc),+ checked = notifications, label = label, secondary = secondary, backdrop = backdrop,+ onCheckedChange = { notifications = it; AppSettingsManager.setNotifications(context, it) })- val path = if (saveUri != null)- saveUri!!.lastPathSegment?.replace("primary:", "") ?: saveUri.toString()- else stringResource(R.string.settings_default_path)- BasicText(path, style = TextStyle(sub, 12.sp), maxLines = 2, overflow = TextOverflow.Ellipsis)+ },+ {+ // Quality slider cell (label + value on top, slider below — iOS control-cell style).+ Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ IconTile(Icons.Rounded.HighQuality, SysIndigo)+ BasicText(stringResource(R.string.settings_compression_quality), style = TextStyle(label, 17.sp), modifier = Modifier.weight(1f))+ BasicText("${(defaultQuality * 100).toInt()}%", style = TextStyle(secondary, 16.sp))+ }+ LiquidSlider(+ value = { defaultQuality },+ onValueChange = {+ val snapped = ((it * 100f).toInt() / 100f).coerceIn(0f, 1f)+ if (snapped != defaultQuality) defaultQuality = snapped+ },+ valueRange = 0f..1f, visibilityThreshold = 0.005f,+ backdrop = backdrop, modifier = Modifier.fillMaxWidth()+ )+ }}- }- }-- // ── Files: handling toggles ─────────────────────────────────────────- SettingsSection(- title = stringResource(R.string.settings_file_handling),- icon = Icons.Rounded.AutoFixHigh,- iconTint = Color(0xFF1976D2),- isLight = isLight,- titleColor = text,- contentSpacing = 2.dp,- modifier = reveal(4, isVisible, density)- ) {- SettingsToggleRow(- icon = Icons.Rounded.AutoFixHigh,- title = stringResource(R.string.settings_auto_compress),- desc = stringResource(R.string.settings_auto_compress_desc),- checked = autoCompress,- onCheckedChange = { autoCompress = it; AppSettingsManager.setAutoCompress(context, it) },- backdrop = backdrop, labelColor = label, subColor = sub- )- SettingsDivider(isLight)- SettingsToggleRow(- icon = Icons.Rounded.FileCopy,- title = stringResource(R.string.settings_keep_original),- desc = stringResource(R.string.settings_keep_original_desc),- checked = keepOriginal,- onCheckedChange = { keepOriginal = it; AppSettingsManager.setKeepOriginal(context, it) },- backdrop = backdrop, labelColor = label, subColor = sub- )- SettingsDivider(isLight)- SettingsToggleRow(- icon = Icons.Rounded.Notifications,- title = stringResource(R.string.settings_notifications),- desc = stringResource(R.string.settings_notifications_desc),- checked = notifications,- onCheckedChange = { notifications = it; AppSettingsManager.setNotifications(context, it) },- backdrop = backdrop, labelColor = label, subColor = sub)}- // ── Files: compression quality ──────────────────────────────────────- SettingsSection(- title = stringResource(R.string.settings_compression_quality),- icon = Icons.Rounded.HighQuality,- iconTint = Color(0xFF1976D2),- isLight = isLight,- titleColor = text,- modifier = reveal(5, isVisible, density),- trailing = { GlassChip("${(defaultQuality * 100).toInt()}%", Color(0xFF1976D2)) }+ // ── Personalization (Background toggle — user experiment) ────────────+ SettingsGroup(+ header = stringResource(R.string.settings_personalization),+ isLight = isLight, secondary = secondary) {- LiquidSlider(- value = { defaultQuality },- onValueChange = {- val snapped = ((it * 100f).toInt() / 100f).coerceIn(0f, 1f)- if (snapped != defaultQuality) defaultQuality = snapped- },- valueRange = 0f..1f,- visibilityThreshold = 0.005f,- backdrop = backdrop,- modifier = Modifier.fillMaxWidth()+ listOf<@Composable () -> Unit>(+ {+ ToggleRow(+ icon = Icons.Rounded.Wallpaper, iconTint = SysPurple,+ title = stringResource(R.string.settings_background),+ subtitle = stringResource(R.string.settings_background_desc),+ checked = showWallpaper, label = label, secondary = secondary, backdrop = backdrop,+ onCheckedChange = onShowWallpaperChanged+ )+ })- Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {- BasicText(stringResource(R.string.settings_smaller_size), style = TextStyle(sub.copy(0.7f), 11.sp))- BasicText(stringResource(R.string.settings_higher_quality), style = TextStyle(sub.copy(0.7f), 11.sp))- }}// ── About ───────────────────────────────────────────────────────────- Column(- reveal(6, isVisible, density)- .fillMaxWidth()- .glassSection(isLight)- .padding(24.dp),- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(12.dp)+ SettingsGroup(+ header = stringResource(R.string.settings_about),+ isLight = isLight, secondary = secondary,+ footer = stringResource(R.string.settings_made_by)) {- Box(- Modifier.size(56.dp).clip(CircleShape).background(AccentBlue.copy(0.12f)),- contentAlignment = Alignment.Center- ) {- Icon(Icons.Rounded.Info, null, Modifier.size(28.dp), AccentBlue)- }- BasicText("ClearPDF", style = TextStyle(text, 20.sp, fontWeight = FontWeight.Bold))- BasicText(stringResource(R.string.settings_version), style = TextStyle(sub, 13.sp))- BasicText(stringResource(R.string.settings_made_by), style = TextStyle(sub, 13.sp, textAlign = TextAlign.Center))-- Spacer(Modifier.height(4.dp))-- LiquidButton(- onClick = openRepo,- backdrop = backdrop,- tint = Color(0xFFFFC107),- modifier = Modifier.fillMaxWidth()- ) {- Row(- horizontalArrangement = Arrangement.spacedBy(8.dp),- verticalAlignment = Alignment.CenterVertically- ) {- Icon(Icons.Rounded.Star, null, Modifier.size(18.dp), Color.White)- BasicText(stringResource(R.string.settings_star_github), style = TextStyle(Color.White, 14.sp, fontWeight = FontWeight.SemiBold))+ listOf<@Composable () -> Unit>(+ {+ SettingsRow(+ icon = Icons.Rounded.Star, iconTint = SysYellow,+ title = stringResource(R.string.settings_star_github),+ label = label, secondary = secondary,+ trailing = { Chevron(tertiary) },+ onClick = { openExternalLink(context, GitHubStarPromptManager.REPO_URL) }+ )+ },+ {+ SettingsRow(+ icon = Icons.Rounded.Shield, iconTint = SysGreen,+ title = stringResource(R.string.settings_privacy_policy),+ label = label, secondary = secondary,+ trailing = { Chevron(tertiary) },+ onClick = { openExternalLink(context, "https://github.com/Chethan616/ClearPDF/blob/main/PRIVACY.md") }+ )+ },+ {+ SettingsRow(+ icon = null, iconTint = SysGray,+ title = stringResource(R.string.settings_version_label),+ label = label, secondary = secondary,+ trailing = { BasicText(appVersion(), style = TextStyle(secondary, 16.sp)) }+ )}- }- BasicText(- stringResource(R.string.settings_open_source),- style = TextStyle(sub.copy(0.7f), 11.sp, textAlign = TextAlign.Center))}// ── Licenses ────────────────────────────────────────────────────────- SettingsSection(- title = stringResource(R.string.settings_licenses),- icon = Icons.Rounded.Code,- iconTint = label,- isLight = isLight,- titleColor = text,- contentSpacing = 12.dp,- modifier = reveal(7, isVisible, density)+ SettingsGroup(+ header = stringResource(R.string.settings_licenses),+ isLight = isLight, secondary = secondary,+ footer = stringResource(R.string.settings_license_notice)) {- LicenseItem(- name = "AndroidLiquidGlass", author = "Kyant", license = "Apache License 2.0",- url = "https://github.com/Kyant0/AndroidLiquidGlass",- labelColor = label, subColor = sub,- onOpen = { openExternalLink(context, "https://github.com/Kyant0/AndroidLiquidGlass") }- )- LicenseItem(- name = "Pdf_Tools", author = "Karna14314", license = "PDF viewer zoom/pan reference",- url = "https://github.com/Karna14314/Pdf_Tools",- labelColor = label, subColor = sub,- onOpen = { openExternalLink(context, "https://github.com/Karna14314/Pdf_Tools") }- )- SettingsDivider(isLight)- BasicText(- stringResource(R.string.settings_license_notice),- style = TextStyle(sub.copy(0.7f), 11.sp, lineHeight = 16.sp)+ listOf<@Composable () -> Unit>(+ {+ SettingsRow(+ icon = Icons.Rounded.Code, iconTint = SysGray,+ title = "AndroidLiquidGlass",+ subtitle = stringResource(R.string.settings_license_author, "Kyant") + " · Apache 2.0",+ label = label, secondary = secondary,+ trailing = { Chevron(tertiary) },+ onClick = { openExternalLink(context, "https://github.com/Kyant0/AndroidLiquidGlass") }+ )+ },+ {+ SettingsRow(+ icon = Icons.Rounded.Code, iconTint = SysGray,+ title = "Pdf_Tools",+ subtitle = stringResource(R.string.settings_license_author, "Karna14314"),+ label = label, secondary = secondary,+ trailing = { Chevron(tertiary) },+ onClick = { openExternalLink(context, "https://github.com/Karna14314/Pdf_Tools") }+ )+ })}- // Dynamic bottom spacer: tab bar + actual nav-bar inset + breathing room.- Spacer(Modifier.height(- WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() + 84.dp- ))+ Spacer(Modifier.height(WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() + 96.dp))}}-// ── Reusable primitives ─────────────────────────────────────────────────────+// ── Apple-HIG building blocks ────────────────────────────────────────────────-/** Staggered fade + rise entrance, indexed so each section leads the next. */+/** A grouped, inset card with an uppercase header and optional gray footnote. */@Composable-private fun reveal(index: Int, visible: Boolean, density: Float): Modifier {- val spec = tween<Float>(durationMillis = 560 + index * 22, delayMillis = index * 60, easing = FastOutSlowInEasing)- val alpha by animateFloatAsState(if (visible) 1f else 0f, spec, label = "revealA$index")- val dy by animateFloatAsState(if (visible) 0f else 18f + index * 4f, spec, label = "revealY$index")- return Modifier.graphicsLayer { this.alpha = alpha; translationY = dy * density }+private fun SettingsGroup(+ header: String?,+ isLight: Boolean,+ secondary: Color,+ footer: String? = null,+ rows: () -> List<@Composable () -> Unit>+) {+ val separator = if (isLight) Color(0xFF3C3C43).copy(0.18f) else Color(0xFF545458).copy(0.40f)+ val list = rows()+ Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp)) {+ if (header != null) {+ BasicText(+ header.uppercase(),+ style = TextStyle(secondary, 13.sp, fontWeight = FontWeight.Medium, letterSpacing = 0.4.sp),+ modifier = Modifier.padding(start = 4.dp, top = 18.dp, bottom = 7.dp)+ )+ } else {+ Spacer(Modifier.height(18.dp))+ }+ Column(Modifier.fillMaxWidth().glassSection(isLight, radius = 16.dp)) {+ list.forEachIndexed { i, row ->+ if (i > 0) Box(Modifier.padding(start = 60.dp).fillMaxWidth().height(0.7.dp).background(separator))+ row()+ }+ }+ if (footer != null) {+ BasicText(+ footer,+ style = TextStyle(secondary, 12.sp, lineHeight = 16.sp),+ modifier = Modifier.padding(start = 4.dp, end = 4.dp, top = 7.dp)+ )+ }+ }}-/** A glass card with an M3 rounded-icon-tile header and an optional trailing slot. */+/** Standard tappable row: leading icon tile, title (+ optional subtitle), trailing control. */@Composable-private fun SettingsSection(- title: String,- icon: ImageVector,+private fun SettingsRow(+ icon: ImageVector?,iconTint: Color,- isLight: Boolean,- titleColor: Color,- modifier: Modifier = Modifier,- contentSpacing: Dp = 14.dp,+ title: String,+ label: Color,+ secondary: Color,+ subtitle: String? = null,trailing: (@Composable () -> Unit)? = null,- content: @Composable ColumnScope.() -> Unit+ onClick: (() -> Unit)? = null) {- Column(- modifier+ Row(+ Modifier.fillMaxWidth()- .glassSection(isLight)- .padding(SectionPadding),- verticalArrangement = Arrangement.spacedBy(contentSpacing)+ .then(if (onClick != null) Modifier.clickable { onClick() } else Modifier)+ .heightIn(min = 52.dp)+ .padding(horizontal = 16.dp, vertical = 8.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(12.dp)) {- GlassSectionHeader(title, icon, iconTint, titleColor, trailing = trailing)- content()+ if (icon != null) IconTile(icon, iconTint)+ Column(Modifier.weight(1f)) {+ BasicText(title, style = TextStyle(label, 17.sp), maxLines = 1, overflow = TextOverflow.Ellipsis)+ if (subtitle != null) BasicText(subtitle, style = TextStyle(secondary, 13.sp), maxLines = 2, overflow = TextOverflow.Ellipsis)+ }+ trailing?.invoke()}}-/** Equal-weight segmented control shared by theme / language / save-location. */-private data class SegOption(val id: String, val label: String, val icon: ImageVector?, val activeColor: Color)-+/** A row whose trailing control is an iOS switch. */@Composable-private fun SegmentedSelector(- options: List<SegOption>,- selectedId: String,- isLight: Boolean,+private fun ToggleRow(+ icon: ImageVector,+ iconTint: Color,+ title: String,+ subtitle: String?,+ checked: Boolean,+ label: Color,+ secondary: Color,backdrop: LayerBackdrop,- onSelect: (String) -> Unit+ onCheckedChange: (Boolean) -> Unit) {- Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(10.dp)) {- options.forEach { option ->- val isSelected = selectedId == option.id- val contentColor = if (isSelected) Color.White else (if (isLight) Color(0xFF2C2C2E) else Color(0xFFE0E0E0))- LiquidButton(- onClick = { onSelect(option.id) },- backdrop = backdrop,- tint = if (isSelected) option.activeColor else Color.Transparent,- surfaceColor = if (isSelected) option.activeColor.copy(0.18f)- else (if (isLight) Color.White.copy(0.70f) else Color.White.copy(0.10f)),- modifier = Modifier.weight(1f)- ) {- Row(- Modifier.fillMaxWidth().padding(vertical = 4.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(5.dp, Alignment.CenterHorizontally)- ) {- if (option.icon != null) {- Icon(option.icon, null, Modifier.size(16.dp), contentColor)- }- BasicText(- option.label,- style = TextStyle(- contentColor, 13.sp,- fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Medium- ),- maxLines = 1,- overflow = TextOverflow.Ellipsis,- modifier = Modifier.weight(1f, fill = false)- )- }- }- }- }+ SettingsRow(+ icon = icon, iconTint = iconTint, title = title, subtitle = subtitle,+ label = label, secondary = secondary,+ trailing = { LiquidToggle(selected = { checked }, onSelect = onCheckedChange, backdrop = backdrop) },+ onClick = { onCheckedChange(!checked) }+ )}+/** The iconic iOS Settings rounded-square colored icon tile. */@Composable-private fun SettingsDivider(isLight: Boolean) {+private fun IconTile(icon: ImageVector, tint: Color) {Box(- Modifier.fillMaxWidth().padding(vertical = 4.dp).height(1.dp)- .background(if (isLight) Color.Black.copy(0.04f) else Color.White.copy(0.06f))- )+ Modifier.size(29.dp).clip(RoundedCornerShape(7.dp)).background(tint),+ contentAlignment = Alignment.Center+ ) {+ Icon(icon, null, Modifier.size(18.dp), Color.White)+ }}-private fun openExternalLink(context: Context, url: String) {- runCatching {- val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {- addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)- }- context.startActivity(intent)- }+@Composable+private fun Chevron(color: Color) {+ Icon(Icons.Rounded.ChevronRight, null, Modifier.size(20.dp), color)}@Composable-private fun SettingsToggleRow(- icon: ImageVector,- title: String,- desc: String,- checked: Boolean,- onCheckedChange: (Boolean) -> Unit,- backdrop: LayerBackdrop,- labelColor: Color,- subColor: Color+private fun SelectedCheck() {+ Icon(Icons.Rounded.Check, null, Modifier.size(20.dp), SysBlue)+}++/** iOS UISegmentedControl-style control, sized as a full-width grouped cell. */+@Composable+private fun SegmentedRow(+ options: List<String>,+ selectedIndex: Int,+ isLight: Boolean,+ label: Color,+ onSelect: (Int) -> Unit) {+ val trackColor = if (isLight) Color(0xFF767680).copy(0.12f) else Color(0xFF767680).copy(0.24f)+ val selectedPill = if (isLight) Color.White else Color(0xFF636366)Row(Modifier.fillMaxWidth()- .clip(RoundedCornerShape(12.dp))- .clickable { onCheckedChange(!checked) }- .padding(vertical = 6.dp, horizontal = 4.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(12.dp)+ .padding(16.dp)+ .clip(RoundedCornerShape(9.dp))+ .background(trackColor)+ .padding(2.dp),+ horizontalArrangement = Arrangement.spacedBy(2.dp)) {- Box(- Modifier.size(34.dp).clip(CircleShape).background(labelColor.copy(0.08f)),- contentAlignment = Alignment.Center- ) {- Icon(icon, null, Modifier.size(18.dp), labelColor)- }- Column(Modifier.weight(1f)) {- BasicText(title, style = TextStyle(labelColor, 15.sp, fontWeight = FontWeight.Medium))- BasicText(desc, style = TextStyle(subColor, 12.sp))+ options.forEachIndexed { i, opt ->+ val selected = i == selectedIndex+ Box(+ Modifier+ .weight(1f)+ .clip(RoundedCornerShape(7.dp))+ .background(if (selected) selectedPill else Color.Transparent)+ .clickable { onSelect(i) }+ .padding(vertical = 7.dp),+ contentAlignment = Alignment.Center+ ) {+ BasicText(+ opt,+ style = TextStyle(+ label, 13.sp,+ fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Medium+ ),+ maxLines = 1, overflow = TextOverflow.Ellipsis+ )+ }}- LiquidToggle(selected = { checked }, onSelect = onCheckedChange, backdrop = backdrop)}}@Composable-private fun LicenseItem(- name: String,- author: String,- license: String,- url: String,- labelColor: Color,- subColor: Color,- onOpen: (() -> Unit)? = null-) {- Column(- verticalArrangement = Arrangement.spacedBy(4.dp),- modifier = Modifier- .fillMaxWidth()- .clip(RoundedCornerShape(10.dp))- .then(if (onOpen != null) Modifier.clickable { onOpen() } else Modifier)- .padding(vertical = 4.dp)- ) {- Row(- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(6.dp)- ) {- BasicText(name, style = TextStyle(labelColor, 14.sp, fontWeight = FontWeight.Medium))- BasicText(stringResource(R.string.settings_license_author, author), style = TextStyle(subColor, 12.sp))- }- BasicText(license, style = TextStyle(subColor, 11.sp))- BasicText(url, style = TextStyle(AccentBlue, 11.sp))+private fun appVersion(): String {+ val context = LocalContext.current+ return remember {+ runCatching {+ val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)+ pInfo.versionName ?: "1.0"+ }.getOrDefault("1.0")+ }+}++private fun openExternalLink(context: Context, url: String) {+ runCatching {+ context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ })}}diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xmlindex 45aa9f9..9865a88 100644--- a/app/src/main/res/values-pt-rBR/strings.xml+++ b/app/src/main/res/values-pt-rBR/strings.xml@@ -374,4 +374,9 @@<string name="watermark_diagonal">Diagonal (45°)</string><string name="watermark_apply">Aplicar marca d\'água</string><string name="watermark_applying">Aplicando…</string>+ <string name="settings_personalization">Personalização</string>+ <string name="settings_background">Plano de fundo</string>+ <string name="settings_background_desc">Mostrar a imagem de fundo atrás do app</string>+ <string name="settings_privacy_policy">Política de Privacidade</string>+ <string name="settings_version_label">Versão</string></resources>diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xmlindex e4919e1..20527aa 100644--- a/app/src/main/res/values-pt/strings.xml+++ b/app/src/main/res/values-pt/strings.xml@@ -374,4 +374,9 @@<string name="watermark_diagonal">Diagonal (45°)</string><string name="watermark_apply">Aplicar marca d\'água</string><string name="watermark_applying">Aplicando…</string>+ <string name="settings_personalization">Personalização</string>+ <string name="settings_background">Plano de fundo</string>+ <string name="settings_background_desc">Mostrar a imagem de fundo atrás do app</string>+ <string name="settings_privacy_policy">Política de Privacidade</string>+ <string name="settings_version_label">Versão</string></resources>diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 1b4427f..4976da7 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -65,6 +65,11 @@<string name="watermark_diagonal">Diagonal (45°)</string><string name="watermark_apply">Apply Watermark</string><string name="watermark_applying">Applying…</string>+ <string name="settings_personalization">Personalization</string>+ <string name="settings_background">Background</string>+ <string name="settings_background_desc">Show the wallpaper image behind the app</string>+ <string name="settings_privacy_policy">Privacy Policy</string>+ <string name="settings_version_label">Version</string><string name="tool_pdf_to_images_desc">Render each page to a high-quality image you can save or share.</string><string name="pdf_to_images_format">Image format</string><string name="pdf_to_images_convert">Convert to images</string>