mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
A11Y: Improve talkback for video and image / preview not preview.
This commit is contained in:
+1
@@ -40,6 +40,7 @@ class DefaultLocalMediaRenderer(
|
|||||||
localMediaViewState = localMediaViewState,
|
localMediaViewState = localMediaViewState,
|
||||||
textFileViewer = textFileViewer,
|
textFileViewer = textFileViewer,
|
||||||
audioFocus = audioFocus,
|
audioFocus = audioFocus,
|
||||||
|
forPreview = true,
|
||||||
onClick = {},
|
onClick = {},
|
||||||
onOpenWith = null,
|
onOpenWith = null,
|
||||||
)
|
)
|
||||||
|
|||||||
+3
@@ -33,6 +33,7 @@ fun LocalMediaView(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
onOpenWith: (() -> Unit)?,
|
onOpenWith: (() -> Unit)?,
|
||||||
textFileViewer: TextFileViewer,
|
textFileViewer: TextFileViewer,
|
||||||
|
forPreview: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
isDisplayed: Boolean = true,
|
isDisplayed: Boolean = true,
|
||||||
isUserSelected: Boolean = false,
|
isUserSelected: Boolean = false,
|
||||||
@@ -45,6 +46,7 @@ fun LocalMediaView(
|
|||||||
localMediaViewState = localMediaViewState,
|
localMediaViewState = localMediaViewState,
|
||||||
localMedia = localMedia,
|
localMedia = localMedia,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
|
forPreview = forPreview,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
)
|
)
|
||||||
mimeType.isMimeTypeVideo() -> MediaVideoView(
|
mimeType.isMimeTypeVideo() -> MediaVideoView(
|
||||||
@@ -54,6 +56,7 @@ fun LocalMediaView(
|
|||||||
localMedia = localMedia,
|
localMedia = localMedia,
|
||||||
autoplay = isUserSelected,
|
autoplay = isUserSelected,
|
||||||
audioFocus = audioFocus,
|
audioFocus = audioFocus,
|
||||||
|
forPreview = forPreview,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
mimeType == MimeTypes.PlainText -> TextFileView(
|
mimeType == MimeTypes.PlainText -> TextFileView(
|
||||||
|
|||||||
+8
-1
@@ -30,6 +30,7 @@ import me.saket.telephoto.zoomable.rememberZoomableImageState
|
|||||||
fun MediaImageView(
|
fun MediaImageView(
|
||||||
localMediaViewState: LocalMediaViewState,
|
localMediaViewState: LocalMediaViewState,
|
||||||
localMedia: LocalMedia?,
|
localMedia: LocalMedia?,
|
||||||
|
forPreview: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
@@ -42,11 +43,16 @@ fun MediaImageView(
|
|||||||
} else {
|
} else {
|
||||||
val zoomableImageState = rememberZoomableImageState(localMediaViewState.zoomableState)
|
val zoomableImageState = rememberZoomableImageState(localMediaViewState.zoomableState)
|
||||||
localMediaViewState.isReady = zoomableImageState.isImageDisplayed
|
localMediaViewState.isReady = zoomableImageState.isImageDisplayed
|
||||||
|
val imageDescription = if (forPreview) {
|
||||||
|
stringResource(CommonStrings.a11y_photo_preview)
|
||||||
|
} else {
|
||||||
|
stringResource(CommonStrings.common_image)
|
||||||
|
}
|
||||||
ZoomableAsyncImage(
|
ZoomableAsyncImage(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
state = zoomableImageState,
|
state = zoomableImageState,
|
||||||
model = localMedia?.uri,
|
model = localMedia?.uri,
|
||||||
contentDescription = stringResource(id = CommonStrings.common_image),
|
contentDescription = imageDescription,
|
||||||
contentScale = ContentScale.Fit,
|
contentScale = ContentScale.Fit,
|
||||||
onClick = { onClick() }
|
onClick = { onClick() }
|
||||||
)
|
)
|
||||||
@@ -60,6 +66,7 @@ internal fun MediaImageViewPreview() = ElementPreview {
|
|||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
localMediaViewState = rememberLocalMediaViewState(),
|
localMediaViewState = rememberLocalMediaViewState(),
|
||||||
localMedia = null,
|
localMedia = null,
|
||||||
|
forPreview = false,
|
||||||
onClick = {},
|
onClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -77,6 +77,7 @@ fun MediaVideoView(
|
|||||||
localMedia: LocalMedia?,
|
localMedia: LocalMedia?,
|
||||||
autoplay: Boolean,
|
autoplay: Boolean,
|
||||||
audioFocus: AudioFocus?,
|
audioFocus: AudioFocus?,
|
||||||
|
forPreview: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val exoPlayer = rememberExoPlayer(forAudioOnly = false)
|
val exoPlayer = rememberExoPlayer(forAudioOnly = false)
|
||||||
@@ -88,6 +89,7 @@ fun MediaVideoView(
|
|||||||
localMedia = localMedia,
|
localMedia = localMedia,
|
||||||
autoplay = autoplay,
|
autoplay = autoplay,
|
||||||
audioFocus = audioFocus,
|
audioFocus = audioFocus,
|
||||||
|
forPreview = forPreview,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -102,6 +104,7 @@ private fun ExoPlayerMediaVideoView(
|
|||||||
localMedia: LocalMedia?,
|
localMedia: LocalMedia?,
|
||||||
autoplay: Boolean,
|
autoplay: Boolean,
|
||||||
audioFocus: AudioFocus?,
|
audioFocus: AudioFocus?,
|
||||||
|
forPreview: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
var mediaPlayerControllerState: MediaPlayerControllerState by remember {
|
var mediaPlayerControllerState: MediaPlayerControllerState by remember {
|
||||||
@@ -220,7 +223,11 @@ private fun ExoPlayerMediaVideoView(
|
|||||||
text = "A Video Player will render here",
|
text = "A Video Player will render here",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val videoDescription = stringResource(CommonStrings.a11y_video_preview)
|
val videoDescription = if (forPreview) {
|
||||||
|
stringResource(CommonStrings.a11y_video_preview)
|
||||||
|
} else {
|
||||||
|
stringResource(CommonStrings.common_video)
|
||||||
|
}
|
||||||
AndroidView(
|
AndroidView(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -359,5 +366,6 @@ internal fun MediaVideoViewPreview() = ElementPreview {
|
|||||||
localMedia = null,
|
localMedia = null,
|
||||||
audioFocus = null,
|
audioFocus = null,
|
||||||
autoplay = false,
|
autoplay = false,
|
||||||
|
forPreview = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -396,6 +396,7 @@ private fun MediaViewerPage(
|
|||||||
onOpenWith = onOpenWith,
|
onOpenWith = onOpenWith,
|
||||||
isUserSelected = isUserSelected,
|
isUserSelected = isUserSelected,
|
||||||
audioFocus = audioFocus,
|
audioFocus = audioFocus,
|
||||||
|
forPreview = false,
|
||||||
)
|
)
|
||||||
if (showThumbnail) {
|
if (showThumbnail) {
|
||||||
ThumbnailView(
|
ThumbnailView(
|
||||||
|
|||||||
Reference in New Issue
Block a user