mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
add content descriptions to dynamically created tabs
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user