From 7902e21a4a542b9f982dbd76e0f76f676f08ce75 Mon Sep 17 00:00:00 2001 From: todd2982 <1664712+todd2982@users.noreply.github.com> Date: Sun, 23 Mar 2025 20:26:28 -0500 Subject: [PATCH] feat #1632: Accessibility updates (#1705) * Add description for node sort option button * Add description for location view button * Update description for channel url copy button * appease detekt --------- Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com> --- .../com/geeksville/mesh/ui/ChannelFragment.kt | 4 +- .../mesh/ui/components/NodeFilterTextField.kt | 2 +- .../com/geeksville/mesh/ui/map/MapFragment.kt | 49 ++++++++++--------- app/src/main/res/values/strings.xml | 2 + 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt index a55054b84..330b3c9a6 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt @@ -471,9 +471,9 @@ private fun EditChannelUrl( else -> Icons.TwoTone.ContentCopy }, contentDescription = when { - isError -> stringResource(R.string.share) + isError -> stringResource(R.string.copy) !isUrlEqual -> stringResource(R.string.send) - else -> stringResource(R.string.share) + else -> stringResource(R.string.copy) }, tint = if (isError) { MaterialTheme.colors.error diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/NodeFilterTextField.kt b/app/src/main/java/com/geeksville/mesh/ui/components/NodeFilterTextField.kt index b39e055bf..8586cd1cd 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/NodeFilterTextField.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/NodeFilterTextField.kt @@ -162,7 +162,7 @@ private fun NodeSortButton( IconButton(onClick = { expanded = true }) { Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_twotone_sort_24), - contentDescription = null, + contentDescription = stringResource(R.string.node_sort_button), modifier = Modifier.heightIn(max = 48.dp), tint = MaterialTheme.colors.onSurface ) diff --git a/app/src/main/java/com/geeksville/mesh/ui/map/MapFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/map/MapFragment.kt index dbaf47ba7..ed92a8701 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/map/MapFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/map/MapFragment.kt @@ -50,6 +50,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.platform.ViewCompositionStrategy +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.fragment.app.activityViewModels @@ -619,30 +620,32 @@ fun MapView( map.invalidate() }, modifier = Modifier.align(Alignment.BottomCenter) - ) else Column( - modifier = Modifier - .padding(top = 16.dp, end = 16.dp) - .align(Alignment.TopEnd), - verticalArrangement = Arrangement.spacedBy(8.dp), - ) { - MapButton( - onClick = ::showMapStyleDialog, - icon = Icons.Outlined.Layers, - contentDescription = R.string.map_style_selection, - ) - MapButton( - enabled = hasGps, - icon = if (myLocationOverlay == null) { - Icons.Outlined.MyLocation - } else { - Icons.Default.LocationDisabled - }, - contentDescription = null, + ) else { + Column( + modifier = Modifier + .padding(top = 16.dp, end = 16.dp) + .align(Alignment.TopEnd), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { - if (context.hasLocationPermission()) { - map.toggleMyLocation() - } else { - requestPermissionAndToggleLauncher.launch(context.getLocationPermissions()) + MapButton( + onClick = ::showMapStyleDialog, + icon = Icons.Outlined.Layers, + contentDescription = R.string.map_style_selection, + ) + MapButton( + enabled = hasGps, + icon = if (myLocationOverlay == null) { + Icons.Outlined.MyLocation + } else { + Icons.Default.LocationDisabled + }, + contentDescription = stringResource(R.string.toggle_my_position), + ) { + if (context.hasLocationPermission()) { + map.toggleMyLocation() + } else { + requestPermissionAndToggleLauncher.launch(context.getLocationPermissions()) + } } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f4f87548d..9fec523c2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -24,6 +24,7 @@ clear node filter Include unknown Show details + Node sorting options A-Z Channel Distance @@ -346,4 +347,5 @@ Mesh via UDP enabled UDP Config Last heard: %s
Last position: %s
Battery: %s]]>
+ Toggle my position