chore: standardize resources and update documentation for Navigation 3 (#4961)

This commit is contained in:
James Rich 2026-03-31 16:25:37 -05:00 committed by GitHub
parent 1faa802fe6
commit 464a12b9f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 216 additions and 149 deletions

View file

@ -22,6 +22,9 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.channel_label
@Composable
fun ChannelInfo(
@ -32,7 +35,7 @@ fun ChannelInfo(
IconInfo(
modifier = modifier,
icon = Icons.Rounded.Tsunami,
contentDescription = "Channel",
contentDescription = stringResource(Res.string.channel_label),
text = channel.toString(),
contentColor = contentColor,
)

View file

@ -47,6 +47,7 @@ import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.a11y_label_value
import org.meshtastic.core.resources.copy
import org.meshtastic.core.ui.util.createClipEntry
import org.meshtastic.core.ui.util.thenIf
@ -65,6 +66,7 @@ fun InfoCard(
val coroutineScope = rememberCoroutineScope()
val shape = MaterialTheme.shapes.medium
val copyLabel = stringResource(Res.string.copy)
val contentDescriptionText = stringResource(Res.string.a11y_label_value, text, value)
Card(
modifier =
@ -77,7 +79,7 @@ fun InfoCard(
onClick = {},
role = Role.Button,
)
.semantics(mergeDescendants = true) { contentDescription = "$text: $value" },
.semantics(mergeDescendants = true) { contentDescription = contentDescriptionText },
shape = shape,
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow),
) {

View file

@ -52,6 +52,7 @@ import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.a11y_label_value
import org.meshtastic.core.resources.copy
import org.meshtastic.core.ui.util.createClipEntry
@ -94,6 +95,7 @@ internal fun InfoItem(
val clipboard: Clipboard = LocalClipboard.current
val coroutineScope = rememberCoroutineScope()
val copyLabel = stringResource(Res.string.copy)
val contentDescriptionText = stringResource(Res.string.a11y_label_value, label, value)
Column(
modifier =
@ -109,7 +111,7 @@ internal fun InfoItem(
.padding(horizontal = 20.dp, vertical = 8.dp)
.semantics(mergeDescendants = true) {
// Screen readers read as a unified data unit
contentDescription = "$label: $value"
contentDescription = contentDescriptionText
},
) {
Row(verticalAlignment = Alignment.CenterVertically) {

View file

@ -57,6 +57,7 @@ import org.meshtastic.core.model.DataPacket
import org.meshtastic.core.model.Node
import org.meshtastic.core.model.util.formatUptime
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.a11y_label_value
import org.meshtastic.core.resources.copy
import org.meshtastic.core.resources.details
import org.meshtastic.core.resources.encryption_error
@ -323,6 +324,7 @@ private fun PublicKeyItem(publicKeyBytes: ByteArray) {
}
val label = stringResource(Res.string.public_key)
val copyLabel = stringResource(Res.string.copy)
val contentDescriptionText = stringResource(Res.string.a11y_label_value, label, publicKeyBase64)
Column(
modifier =
@ -339,7 +341,7 @@ private fun PublicKeyItem(publicKeyBytes: ByteArray) {
role = Role.Button,
)
.padding(horizontal = 20.dp, vertical = 8.dp)
.semantics(mergeDescendants = true) { contentDescription = "$label: $publicKeyBase64" },
.semantics(mergeDescendants = true) { contentDescription = contentDescriptionText },
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(

View file

@ -35,6 +35,7 @@ import androidx.compose.ui.graphics.Color
import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.env_metrics_log
import org.meshtastic.core.resources.hardware_model
import org.meshtastic.core.resources.humidity
import org.meshtastic.core.resources.iaq
import org.meshtastic.core.resources.node_id
@ -167,7 +168,7 @@ fun HardwareInfo(
IconInfo(
modifier = modifier,
icon = Icons.Rounded.Router,
contentDescription = "Hardware Model",
contentDescription = stringResource(Res.string.hardware_model),
text = hwModel,
style = MaterialTheme.typography.labelSmall,
contentColor = contentColor,

View file

@ -42,6 +42,7 @@ import org.meshtastic.core.resources.latitude
import org.meshtastic.core.resources.longitude
import org.meshtastic.core.resources.sats
import org.meshtastic.core.resources.speed
import org.meshtastic.core.resources.speed_kmh
import org.meshtastic.core.resources.timestamp
import org.meshtastic.core.ui.util.formatPositionTime
import org.meshtastic.proto.Config
@ -92,7 +93,7 @@ fun PositionItem(compactWidth: Boolean, position: Position, system: Config.Displ
PositionText(position.sats_in_view.toString(), WEIGHT_10)
PositionText((position.altitude ?: 0).metersIn(system).toString(system), WEIGHT_15)
if (!compactWidth) {
PositionText("${position.ground_speed ?: 0} Km/h", WEIGHT_15)
PositionText(stringResource(Res.string.speed_kmh, position.ground_speed ?: 0), WEIGHT_15)
PositionText(formatString("%.0f°", (position.ground_track ?: 0) * HEADING_DEG), WEIGHT_15)
}
PositionText(position.formatPositionTime(), WEIGHT_40)