Improves accessibility talkback on MessageAudioItem

This commit is contained in:
ericdecanini 2022-03-28 11:01:31 +02:00
parent 8aaaf80262
commit 931c0e9826
2 changed files with 11 additions and 7 deletions

View file

@ -76,7 +76,8 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
contentUploadStateTrackerBinder.bind(attributes.informationData.eventId, isLocalFile, holder.progressLayout)
} else {
holder.audioPlaybackControlButton.setImageResource(R.drawable.ic_cross)
holder.audioPlaybackControlButton.contentDescription = holder.view.context.getString(R.string.error_audio_message_unable_to_play)
holder.audioPlaybackControlButton.contentDescription =
holder.view.context.getString(R.string.error_audio_message_unable_to_play, filename)
holder.progressLayout.isVisible = false
}
}
@ -105,19 +106,22 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
private fun renderIdleState(holder: Holder) {
holder.audioPlaybackControlButton.setImageResource(R.drawable.ic_play_pause_play)
holder.audioPlaybackControlButton.contentDescription = holder.view.context.getString(R.string.a11y_play_audio_message)
holder.audioPlaybackControlButton.contentDescription =
holder.view.context.getString(R.string.a11y_play_audio_message, filename)
holder.audioPlaybackTime.text = formatPlaybackTime(duration)
}
private fun renderPlayingState(holder: Holder, state: AudioMessagePlaybackTracker.Listener.State.Playing) {
holder.audioPlaybackControlButton.setImageResource(R.drawable.ic_play_pause_pause)
holder.audioPlaybackControlButton.contentDescription = holder.view.context.getString(R.string.a11y_pause_audio_message)
holder.audioPlaybackControlButton.contentDescription =
holder.view.context.getString(R.string.a11y_pause_audio_message, filename)
holder.audioPlaybackTime.text = formatPlaybackTime(state.playbackTime)
}
private fun renderPausedState(holder: Holder, state: AudioMessagePlaybackTracker.Listener.State.Paused) {
holder.audioPlaybackControlButton.setImageResource(R.drawable.ic_play_pause_play)
holder.audioPlaybackControlButton.contentDescription = holder.view.context.getString(R.string.a11y_play_audio_message)
holder.audioPlaybackControlButton.contentDescription =
holder.view.context.getString(R.string.a11y_play_audio_message, filename)
holder.audioPlaybackTime.text = formatPlaybackTime(state.playbackTime)
}

View file

@ -2860,9 +2860,9 @@
<string name="error_voice_message_cannot_reply_or_edit">Cannot reply or edit while voice message is active</string>
<string name="voice_message_reply_content">Voice Message (%1$s)</string>
<string name="a11y_play_audio_message">Play Audio Message</string>
<string name="a11y_pause_audio_message">Pause Audio Message</string>
<string name="error_audio_message_unable_to_play">Pause Audio Message</string>
<string name="a11y_play_audio_message">Play %1$s</string>
<string name="a11y_pause_audio_message">Pause %1$s</string>
<string name="error_audio_message_unable_to_play">Unable to play %1$s</string>
<string name="audio_message_reply_content">%1$s (%2$s)</string>
<string name="upgrade_room_for_restricted">Anyone in %s will be able to find and join this room - no need to manually invite everyone. Youll be able to change this in room settings anytime.</string>