diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt index 1e57de2466..92cfa91308 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt @@ -48,6 +48,8 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.clearAndSetSemantics +import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewParameter @@ -371,7 +373,7 @@ private fun EmojiReactionsRow( ) { Icon( resourceId = CommonDrawables.ic_add_reaction, - contentDescription = "Emojis", + contentDescription = stringResource(id = CommonStrings.a11y_react_with_other_emojis), tint = MaterialTheme.colorScheme.secondary, modifier = Modifier .size(24.dp) @@ -398,11 +400,18 @@ private fun EmojiButton( } else { Color.Transparent } + val description = if (isHighlighted) { + stringResource(id = CommonStrings.a11y_remove_reaction_with, emoji) + } else { + stringResource(id = CommonStrings.a11y_react_with, emoji) + } Box( modifier = modifier .size(48.dp) - .background(backgroundColor, CircleShape), - + .background(backgroundColor, CircleShape) + .clearAndSetSemantics { + contentDescription = description + }, contentAlignment = Alignment.Center ) { Text( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMediaView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMediaView.kt index 96e721e815..145b8ac56e 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMediaView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/LocalMediaView.kt @@ -44,6 +44,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -69,6 +70,7 @@ import io.element.android.libraries.designsystem.utils.CommonDrawables import io.element.android.libraries.designsystem.utils.KeepScreenOn import io.element.android.libraries.designsystem.utils.OnLifecycleEvent import io.element.android.libraries.theme.ElementTheme +import io.element.android.libraries.ui.strings.CommonStrings import me.saket.telephoto.zoomable.ZoomSpec import me.saket.telephoto.zoomable.ZoomableState import me.saket.telephoto.zoomable.coil.ZoomableAsyncImage @@ -135,7 +137,7 @@ private fun MediaImageView( modifier = modifier.fillMaxSize(), state = zoomableImageState, model = localMedia?.uri, - contentDescription = "Image", + contentDescription = stringResource(id = CommonStrings.common_image), contentScale = ContentScale.Fit, ) } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/pdf/PdfViewer.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/pdf/PdfViewer.kt index 41a111d97d..9940d22542 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/pdf/PdfViewer.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/media/local/pdf/PdfViewer.kt @@ -35,9 +35,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import io.element.android.libraries.designsystem.text.roundToPx import io.element.android.libraries.designsystem.text.toDp +import io.element.android.libraries.ui.strings.CommonStrings import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import me.saket.telephoto.zoomable.zoomable @@ -98,7 +100,7 @@ private fun PdfPageView( is PdfPage.State.Loaded -> { Image( bitmap = state.bitmap.asImageBitmap(), - contentDescription = "Page ${pdfPage.pageIndex}", + contentDescription = stringResource(id = CommonStrings.a11y_page_n, pdfPage.pageIndex), contentScale = ContentScale.FillWidth, modifier = modifier.fillMaxWidth() ) diff --git a/libraries/ui-strings/src/main/res/values/localazy.xml b/libraries/ui-strings/src/main/res/values/localazy.xml index c2f969551c..4f18ef9c4a 100644 --- a/libraries/ui-strings/src/main/res/values/localazy.xml +++ b/libraries/ui-strings/src/main/res/values/localazy.xml @@ -4,19 +4,24 @@ "Hide password" "Mentions only" "Muted" + "Page %1$d" "Pause" "PIN field" "Play" "Poll" "Ended poll" + "React with %1$s" + "React with other emojis" + "Read by %1$s and %2$s" "Read by %1$s" + "Tap to show all" + "Remove reaction with %1$s" "Send files" "Show password" "Start a call" "User menu" "Record voice message." "Stop recording" - "Read by %1$s and %2$s" "Accept" "Add to timeline" "Back"