Add accessibility descriptions to voice note player view.

Fixes #11518
fork-5.53.8
Alex Hart 2021-08-03 09:57:44 -03:00
rodzic 2830132b24
commit 2d5492ffac
3 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -99,6 +99,7 @@ class VoiceNotePlayerView @JvmOverloads constructor(
background.colorFilter = SimpleColorFilter(ContextCompat.getColor(context, R.color.voice_note_player_view_background))
}
contentDescription = context.getString(R.string.VoiceNotePlayerView__navigate_to_voice_message)
setOnClickListener {
lastState?.let {
listener?.onNavigateToMessage(it.threadId, it.threadRecipientId, it.senderId, it.messageTimestamp, it.messagePositionInThread)
@ -171,6 +172,12 @@ class VoiceNotePlayerView @JvmOverloads constructor(
}
lottieDirection = direction
playPauseToggleView.contentDescription = if (direction == TO_PLAY) {
context.getString(R.string.VoiceNotePlayerView__play_voice_message)
} else {
context.getString(R.string.VoiceNotePlayerView__pause_voice_message)
}
playPauseToggleView.pauseAnimation()
playPauseToggleView.speed = (direction * 2).toFloat()
playPauseToggleView.resumeAnimation()

Wyświetl plik

@ -9,6 +9,7 @@
android:layout_width="36dp"
android:layout_height="0dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/VoiceNotePlayerView__pause_voice_message"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="@id/voice_note_player_info"
app:layout_constraintStart_toStartOf="parent"
@ -43,6 +44,7 @@
android:layout_height="36dp"
android:layout_marginEnd="8dp"
android:background="?selectableItemBackground"
android:contentDescription="@string/VoiceNotePlayerView__change_voice_message_speed"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/voice_note_player_close"
app:layout_constraintTop_toTopOf="parent">
@ -69,6 +71,7 @@
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="4dp"
android:contentDescription="@string/VoiceNotePlayerView__stop_voice_message"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="@id/voice_note_player_info"
app:layout_constraintEnd_toEndOf="parent"

Wyświetl plik

@ -3646,6 +3646,12 @@
<!-- VoiceNotePlayerView -->
<string name="VoiceNotePlayerView__s_dot_s">%1$s · %2$s</string>
<string name="VoiceNotePlayerView__stop_voice_message">Stop voice message</string>
<string name="VoiceNotePlayerView__change_voice_message_speed">Change voice message speed</string>
<string name="VoiceNotePlayerView__pause_voice_message">Pause voice message</string>
<string name="VoiceNotePlayerView__play_voice_message">Play voice message</string>
<string name="VoiceNotePlayerView__navigate_to_voice_message">Navigate to voice message</string>
<!-- AvatarPickerFragment -->
<string name="AvatarPickerFragment__avatar_preview">Avatar preview</string>