add content descriptions to dynamically created tabs
This commit is contained in:
parent
06e55b6218
commit
5036876fab
2 changed files with 11 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue