Skip to content
Snippets Groups Projects
Commit 1963d431 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Accessibility: video player update shuffle/repeat content descriptions

parent fb1b6f09
No related branches found
No related tags found
1 merge request!1377Improve accessibility
......@@ -281,29 +281,35 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
PlaybackStateCompat.REPEAT_MODE_NONE -> {
repeatBinding.optionIcon.setImageResource(R.drawable.ic_repeat_one)
service.repeatType = PlaybackStateCompat.REPEAT_MODE_ONE
repeatBinding.root.contentDescription = repeatBinding.root.context.getString(R.string.repeat_single)
}
PlaybackStateCompat.REPEAT_MODE_ONE -> if (service.hasPlaylist()) {
repeatBinding.optionIcon.setImageResource(R.drawable.ic_repeat_all)
service.repeatType = PlaybackStateCompat.REPEAT_MODE_ALL
repeatBinding.root.contentDescription = repeatBinding.root.context.getString(R.string.repeat_all)
} else {
repeatBinding.optionIcon.setImageResource(R.drawable.ic_repeat)
service.repeatType = PlaybackStateCompat.REPEAT_MODE_NONE
repeatBinding.root.contentDescription = repeatBinding.root.context.getString(R.string.repeat)
}
PlaybackStateCompat.REPEAT_MODE_ALL -> {
repeatBinding.optionIcon.setImageResource(R.drawable.ic_repeat)
service.repeatType = PlaybackStateCompat.REPEAT_MODE_NONE
repeatBinding.root.contentDescription = repeatBinding.root.context.getString(R.string.repeat)
}
}
}
private fun setShuffle() {
shuffleBinding.optionIcon.setImageResource(if (service.isShuffling) R.drawable.ic_shuffle_on_48dp else R.drawable.ic_shuffle)
shuffleBinding.root.contentDescription = shuffleBinding.root.context.getString(if (service.isShuffling) R.string.shuffle_on else R.string.shuffle)
}
private fun initShuffle(binding: PlayerOptionItemBinding) {
shuffleBinding = binding
AppScope.launch(Dispatchers.Main) {
shuffleBinding.optionIcon.setImageResource(if (service.isShuffling) R.drawable.ic_shuffle_on_48dp else R.drawable.ic_shuffle)
shuffleBinding.root.contentDescription = shuffleBinding.root.context.getString(if (service.isShuffling) R.string.shuffle_on else R.string.shuffle)
}
}
......@@ -315,6 +321,11 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
PlaybackStateCompat.REPEAT_MODE_ALL -> R.drawable.ic_repeat_all
else -> R.drawable.ic_repeat
})
repeatBinding.root.contentDescription = repeatBinding.root.context.getString(when (service.repeatType) {
PlaybackStateCompat.REPEAT_MODE_ONE -> R.string.repeat_single
PlaybackStateCompat.REPEAT_MODE_ALL -> R.string.repeat_all
else -> R.string.repeat
})
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment