add content descriptions to dynamically created tabs

This commit is contained in:
tibbi 2021-11-17 20:22:53 +01:00
parent 06e55b6218
commit 5036876fab
2 changed files with 11 additions and 0 deletions

View File

@ -386,6 +386,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
skippedTabs++
} else {
val tab = main_tabs_holder.newTab().setIcon(getTabIcon(index))
tab.contentDescription = getTabContentDescription(index)
main_tabs_holder.addTab(tab, index - skippedTabs, getDefaultTab() == index - skippedTabs)
}
}

View File

@ -72,4 +72,14 @@ open class SimpleActivity : BaseSimpleActivity() {
return resources.getColoredDrawableWithColor(drawableId, config.textColor)
}
protected fun getTabContentDescription(position: Int): String {
val stringId = when (position) {
LOCATION_CONTACTS_TAB -> R.string.contacts_tab
LOCATION_FAVORITES_TAB -> R.string.favorites_tab
else -> R.string.groups_tab
}
return resources.getString(stringId)
}
}