From 74ee288fd49c40f9179a206c9dcd97279c24b3be Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 8 Oct 2026 14:51:51 -0400 Subject: [PATCH] DRY pass #2, batch 6, F19: Hint, the quiet line under a field (#5372) Panel.kt Hint(text, modifier): bodySmall in onSurfaceVariant. That is the secondary line that the sync pairing form, the sync screen, the update card and the share sheet each wrote as a full Text(...) at 14 sites. Sites that add more than a modifier (the link preview's two-line clamp) stay as they are. So does ShareSheet's own Muted, which is bodyMedium. Co-Authored-By: Claude Opus 5.5 --- .../java/com/fabledsword/inkwell/ui/Panel.kt | 14 ++++++++++ .../com/fabledsword/inkwell/ui/ShareSheet.kt | 6 +---- .../com/fabledsword/inkwell/ui/SyncPairing.kt | 24 +++-------------- .../com/fabledsword/inkwell/ui/SyncScreen.kt | 26 ++++--------------- .../com/fabledsword/inkwell/ui/UpdateCard.kt | 22 +++------------- 5 files changed, 28 insertions(+), 64 deletions(-) diff --git a/android/app/src/main/java/com/fabledsword/inkwell/ui/Panel.kt b/android/app/src/main/java/com/fabledsword/inkwell/ui/Panel.kt index 7d161a3..744c3d5 100644 --- a/android/app/src/main/java/com/fabledsword/inkwell/ui/Panel.kt +++ b/android/app/src/main/java/com/fabledsword/inkwell/ui/Panel.kt @@ -175,6 +175,20 @@ fun ConfirmDialog( ) } +/** Secondary text under a field or a heading: smaller, and in the quieter ink. */ +@Composable +fun Hint( + text: String, + modifier: Modifier = Modifier, +) { + Text( + text = text, + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = modifier, + ) +} + /** The three tones a panel or notice can take, mapped onto the note palette. */ enum class Tone { NEUTRAL, WARN, ERROR } diff --git a/android/app/src/main/java/com/fabledsword/inkwell/ui/ShareSheet.kt b/android/app/src/main/java/com/fabledsword/inkwell/ui/ShareSheet.kt index 9097aab..8d4c27b 100644 --- a/android/app/src/main/java/com/fabledsword/inkwell/ui/ShareSheet.kt +++ b/android/app/src/main/java/com/fabledsword/inkwell/ui/ShareSheet.kt @@ -222,11 +222,7 @@ private fun TargetName( Column(modifier = modifier) { Text(text = title, style = MaterialTheme.typography.bodyLarge) detail?.let { - Text( - text = it, - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(it) } } } diff --git a/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncPairing.kt b/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncPairing.kt index 494674f..f8b9ff6 100644 --- a/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncPairing.kt +++ b/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncPairing.kt @@ -201,11 +201,7 @@ private fun SignInFields( singleLine = true, keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), ) - Text( - text = stringResource(R.string.sync_device_name_help), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.sync_device_name_help)) } else { PlainTextField( value = token, @@ -218,11 +214,7 @@ private fun SignInFields( imeAction = ImeAction.Done, ), ) - Text( - text = stringResource(R.string.sync_token_help), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.sync_token_help)) } } @@ -260,11 +252,7 @@ private fun AddressSection( Text(stringResource(R.string.sync_check)) } } - Text( - text = stringResource(R.string.sync_address_help), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.sync_address_help)) } /** Everything the probe produced: progress, failure, what answered, and the risk. */ @@ -311,11 +299,7 @@ private fun ProbeCard( fontWeight = FontWeight.SemiBold, ) version?.let { - Text( - text = stringResource(R.string.sync_server_version, it), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.sync_server_version, it)) } Text( text = describeCompatibility(compatibility), diff --git a/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncScreen.kt b/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncScreen.kt index 185f4e6..e5925e8 100644 --- a/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncScreen.kt +++ b/android/app/src/main/java/com/fabledsword/inkwell/ui/SyncScreen.kt @@ -145,10 +145,8 @@ private fun BuildLine() { val context = LocalContext.current val unknown = stringResource(R.string.build_unknown) val version = remember(context) { context.installedVersionName() ?: unknown } - Text( + Hint( text = version, - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(bottom = 16.dp), ) } @@ -182,11 +180,7 @@ private fun LinkedPanel( fontWeight = FontWeight.SemiBold, ) state.linkedAs?.let { - Text( - text = stringResource(R.string.sync_linked_as, it), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.sync_linked_as, it)) } Text( text = @@ -199,11 +193,7 @@ private fun LinkedPanel( color = MaterialTheme.colorScheme.onSurfaceVariant, ) if (state.pending) { - Text( - text = stringResource(R.string.sync_unsent), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.sync_unsent)) } } @@ -224,11 +214,7 @@ private fun LinkedPanel( state.lastOutcome?.let { outcome -> if (state.syncError == null) { - Text( - text = syncSummary(outcome), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(syncSummary(outcome)) } // Rejections are the server refusing a SPECIFIC change. Surfaced, never // swallowed, because only a person can resolve them. @@ -268,10 +254,8 @@ private fun LinkedPanel( onOutcome = onInstallOutcome, ) - Text( + Hint( text = stringResource(R.string.sync_footer), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(vertical = 8.dp), ) diff --git a/android/app/src/main/java/com/fabledsword/inkwell/ui/UpdateCard.kt b/android/app/src/main/java/com/fabledsword/inkwell/ui/UpdateCard.kt index c675c29..39ff1f8 100644 --- a/android/app/src/main/java/com/fabledsword/inkwell/ui/UpdateCard.kt +++ b/android/app/src/main/java/com/fabledsword/inkwell/ui/UpdateCard.kt @@ -68,18 +68,10 @@ fun UpdateCard( } Column(modifier = Modifier.fillMaxWidth().padding(top = 4.dp)) { - Text( - text = stringResource(R.string.update_installed_version, state.installedVersion), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.update_installed_version, state.installedVersion)) if (!state.selfUpdates) { - Text( - text = stringResource(R.string.update_debug_build), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.update_debug_build)) return@Column } @@ -95,11 +87,7 @@ fun UpdateCard( style = MaterialTheme.typography.bodyMedium, ) } else if (state.upToDate) { - Text( - text = stringResource(R.string.update_current), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Hint(stringResource(R.string.update_current)) } if (state.working) { @@ -204,10 +192,8 @@ private val BANNER_SPINNER = 18.dp */ @Composable fun UnlinkedUpdateNote() { - Text( + Hint( text = stringResource(R.string.update_needs_server), - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, // Carries the bottom breathing room the connect button used to provide, // now that it is the last thing on the unlinked screen. modifier = Modifier.padding(top = 8.dp, bottom = 24.dp),