mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-17 03:51:03 +01:00
add content descriptions to dynamically created tabs
This commit is contained in:
parent
06e55b6218
commit
5036876fab
@ -386,6 +386,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
skippedTabs++
|
skippedTabs++
|
||||||
} else {
|
} else {
|
||||||
val tab = main_tabs_holder.newTab().setIcon(getTabIcon(index))
|
val tab = main_tabs_holder.newTab().setIcon(getTabIcon(index))
|
||||||
|
tab.contentDescription = getTabContentDescription(index)
|
||||||
main_tabs_holder.addTab(tab, index - skippedTabs, getDefaultTab() == index - skippedTabs)
|
main_tabs_holder.addTab(tab, index - skippedTabs, getDefaultTab() == index - skippedTabs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,4 +72,14 @@ open class SimpleActivity : BaseSimpleActivity() {
|
|||||||
|
|
||||||
return resources.getColoredDrawableWithColor(drawableId, config.textColor)
|
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…
x
Reference in New Issue
Block a user