8fe28904f1b4
feat: text-size setting — small/medium/large font scale (v2.10.10)
- time
- 2026-08-02 23:38 UTC · 2 months ago
- machine
- koh2
- parent
- bcd1c9e62e50
↓ peach-android-8fe28904.tar.gzatlas at this save
files changed7 files
VERSION+1 −1app/src/main/java/com/peachpasswords/MainActivity.kt+1 −0app/src/main/java/com/peachpasswords/autofill/AutofillEntryPickerActivity.kt+3 −2app/src/main/java/com/peachpasswords/ui/settings/SettingsCardBodies.kt+9 −0app/src/main/java/com/peachpasswords/ui/settings/SettingsViewModel.kt+2 −1app/src/main/java/com/peachpasswords/ui/theme/PeachTheme.kt+20 −0app/src/main/java/com/peachpasswords/vault/VaultSettings.kt+2 −0app/src/main/java/com/peachpasswords/MainActivity.kt+1 −0
@@ -118,6 +118,7 @@118118 PeachTheme(119119 accent = accent,120120 reduceMotion = settings.reduceMotion,121+ textSize = settings.textSize,121122 ) {122123 WideScreenScale {123124 PeachAppNavHost(startDestination = start, isUnlocked = vault.isUnlocked, uiGateLocked = vault.uiGateLocked)app/src/main/java/com/peachpasswords/autofill/AutofillEntryPickerActivity.kt+3 −2
@@ -133,10 +133,11 @@133133 cardNameId = intentAutofillId(AutofillIntents.EXTRA_CARD_NAME_ID),134134 )135135 val parsed = resolveAutofillOrigin(this, rawParsed)136- val accent = vault.settings.value.accentColor.let { ACCENT_COLORS[it] } ?: DEFAULT_ACCENT136+ val settings = vault.settings.value137+ val accent = settings.accentColor.let { ACCENT_COLORS[it] } ?: DEFAULT_ACCENT137138 138139 setContent {139- PeachTheme(accent = accent) {140+ PeachTheme(accent = accent, textSize = settings.textSize) {140141 val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)141142 val scope = rememberCoroutineScope()142143 var unlocked by remember { mutableStateOf(vault.isUnlocked.value) }app/src/main/java/com/peachpasswords/ui/settings/SettingsCardBodies.kt+9 −0
@@ -276,6 +276,15 @@276276 )277277 }278278 }279+ SubLabel("TEXT SIZE", fg)280+ RowLine(fg) {281+ Name("Text size", fg)282+ Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {283+ Pill("small", s.textSize == "small", fg) { vm.setTextSize("small") }284+ Pill("medium", s.textSize == "medium", fg) { vm.setTextSize("medium") }285+ Pill("large", s.textSize == "large", fg) { vm.setTextSize("large") }286+ }287+ }279288 SubLabel("MOTION", fg)280289 RowLine(fg) {281290 Name("Reduce motion", fg)app/src/main/java/com/peachpasswords/ui/settings/SettingsViewModel.kt+2 −1
@@ -278,6 +278,7 @@278278 279279 fun setAccent(name: String) = mutate { it.copy(accentColor = name) }280280 fun setReduceMotion(on: Boolean) = mutate { it.copy(reduceMotion = on) }281+ fun setTextSize(size: String) = mutate { it.copy(textSize = size) }281282 fun setBreachMonitoring(on: Boolean) = mutate { it.copy(breachMonitoring = on) }282283 fun setBiometrics(on: Boolean) = mutate { it.copy(biometricsEnabled = on) }283284 fun setPasskeyProviderEnabled(on: Boolean) = mutate { it.copy(passkeyProviderEnabled = on) }@@ -332,7 +333,7 @@332333 CardId.Vault ->333334 "$entriesCount ${if (entriesCount == 1) "entry" else "entries"} · backups, history, cleanup"334335 CardId.Sync -> if (_isPro.value) "your devices, one vault" else "Pro · encrypted device sync"335- CardId.Appearance -> "${s.accentColor} · ${if (s.reduceMotion) "still" else "in motion"}"336+ CardId.Appearance -> "${s.accentColor} · ${s.textSize} · ${if (s.reduceMotion) "still" else "in motion"}"336337 CardId.Feedback -> "tell us what would make it better"337338 }338339 }app/src/main/java/com/peachpasswords/ui/theme/PeachTheme.kt+20 −0
@@ -7,7 +7,9 @@77 import androidx.compose.runtime.compositionLocalOf88 import androidx.compose.runtime.staticCompositionLocalOf99 import androidx.compose.ui.graphics.Color10+import androidx.compose.ui.platform.LocalDensity1011 import androidx.compose.ui.text.TextStyle12+import androidx.compose.ui.unit.Density1113 import androidx.compose.ui.text.font.FontStyle1214 import androidx.compose.ui.text.font.FontWeight1315 import androidx.compose.ui.unit.sp@@ -22,8 +24,25 @@2224 fun PeachTheme(2325 accent: Color = DEFAULT_ACCENT,2426 reduceMotion: Boolean = false,27+ textSize: String = "medium",2528 content: @Composable () -> Unit,2629 ) {30+ // V3 text size (browser's data-text-size parity): scale the ambient font31+ // scale. small=0.92 matches the extension's intent (its CSS ships no small32+ // rule); large=1.08 matches the extension's zoom exactly. Only ROOT themes33+ // should pass a non-default textSize — nested PeachTheme calls keep the34+ // 1.0 factor so the scale is applied exactly once.35+ val textScale = when (textSize) {36+ "small" -> 0.92f37+ "large" -> 1.08f38+ else -> 1f39+ }40+ val baseDensity = LocalDensity.current41+ val scaledDensity = if (textScale == 1f) {42+ baseDensity43+ } else {44+ Density(baseDensity.density, baseDensity.fontScale * textScale)45+ }2746 val colors = darkColorScheme(2847 primary = accent,2948 onPrimary = PeachColors.Bg,@@ -60,6 +79,7 @@6079 )6180 6281 CompositionLocalProvider(82+ LocalDensity provides scaledDensity,6383 LocalPeachAccent provides accent,6484 LocalReduceMotion provides reduceMotion,6585 LocalPeachColors provides peachDark(accent),app/src/main/java/com/peachpasswords/vault/VaultSettings.kt+2 −0
@@ -8,6 +8,8 @@88 val breachMonitoring: Boolean = true,99 val autoLockMinutes: Int? = null,1010 val reduceMotion: Boolean = false,11+ /** Browser-parity text size: "small" | "medium" | "large". */12+ val textSize: String = "medium",1113 val biometricsEnabled: Boolean = false,1214 val trashRetentionDays: Int? = null,1315 val sortOrder: String = "url-first",