From 22bb0aae958e8458274be994f3e679cb226d2241 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 2 Nov 2026 23:30:37 +0100 Subject: feat(app): add the Compose entry screen Header with avatar, name and folder; password, username and one-time code with a countdown bar in the first group; extra fields in the second. FieldRow can start revealed (the "Show the password" setting) and shows masked values in JetBrains Mono, as the old screen did. Co-Authored-By: Claude Opus 5.5 --- .../main/kotlin/app/passwordstore/ui/compose/FieldRow.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'ui/compose/src') diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt index c49ec2bc..e632acc1 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt @@ -21,6 +21,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily import app.passwordstore.ui.compose.preview.ThemePreviews import app.passwordstore.ui.compose.theme.APSTheme import app.passwordstore.ui.compose.theme.SpacingLarge @@ -29,9 +31,12 @@ import app.passwordstore.ui.compose.theme.SpacingMedium /** Content descriptions for [FieldRow]'s buttons, supplied by the app's translated strings. */ public data class FieldRowLabels(val copy: String, val show: String, val hide: String) +/** Masked values (passwords) use a monospace face, so 0 and O, l and 1 stay apart. */ +private val Monospace = FontFamily(Font(R.font.jetbrainsmono_nl_regular)) + /** * A labelled value with an optional copy button. When [masked] is true the value is hidden behind - * dots until the reveal toggle is pressed. + * dots until the reveal toggle is pressed, unless [initiallyRevealed] shows it from the start. */ @Composable public fun FieldRow( @@ -40,9 +45,10 @@ public fun FieldRow( labels: FieldRowLabels, modifier: Modifier = Modifier, masked: Boolean = false, + initiallyRevealed: Boolean = false, onCopy: (() -> Unit)? = null, ) { - var revealed by rememberSaveable { mutableStateOf(false) } + var revealed by rememberSaveable { mutableStateOf(initiallyRevealed) } Row( modifier .fillMaxWidth() @@ -60,9 +66,10 @@ public fun FieldRow( style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, ) + val style = MaterialTheme.typography.bodyLarge Text( if (masked && !revealed) "•".repeat(10) else value, - style = MaterialTheme.typography.bodyLarge, + style = if (masked) style.copy(fontFamily = Monospace) else style, ) } if (masked) -- cgit v1.2.3