fix #236, adding some content descriptions for Talkback

This commit is contained in:
tibbi
2021-11-28 20:03:13 +01:00
parent 23fc427b00
commit 681f6534e7
7 changed files with 32 additions and 4 deletions

View File

@ -158,6 +158,7 @@ class CallActivity : SimpleActivity() {
val newRoute = if (isSpeakerOn) CallAudioState.ROUTE_SPEAKER else CallAudioState.ROUTE_EARPIECE
CallManager.inCallService?.setAudioRoute(newRoute)
call_toggle_speaker.contentDescription = getString(if (isSpeakerOn) R.string.turn_speaker_off else R.string.turn_speaker_on)
}
private fun toggleMicrophone() {
@ -166,6 +167,7 @@ class CallActivity : SimpleActivity() {
call_toggle_microphone.setImageDrawable(getDrawable(drawable))
audioManager.isMicrophoneMute = !isMicrophoneOn
CallManager.inCallService?.setMuted(!isMicrophoneOn)
call_toggle_microphone.contentDescription = getString(if (isMicrophoneOn) R.string.turn_microphone_off else R.string.turn_microphone_on)
}
private fun toggleDialpadVisibility() {

View File

@ -299,6 +299,7 @@ class MainActivity : SimpleActivity() {
skippedTabs++
} else {
val tab = main_tabs_holder.newTab().setIcon(getTabIcon(index))
tab.contentDescription = getTabContentDescription(index)
val wasAlreadySelected = selectedTabIndex > -1 && selectedTabIndex == index - skippedTabs
val shouldSelect = !isAnySelected && wasAlreadySelected
if (shouldSelect) {
@ -324,6 +325,16 @@ class MainActivity : SimpleActivity() {
return resources.getColoredDrawableWithColor(drawableId, config.textColor)
}
private fun getTabContentDescription(position: Int): String {
val stringId = when (position) {
0 -> R.string.contacts_tab
1 -> R.string.favorites_tab
else -> R.string.call_history_tab
}
return resources.getString(stringId)
}
private fun refreshItems(openLastTab: Boolean = false) {
if (isDestroyed || isFinishing) {
return