Set content descriptions for bottom nav badges

Doesn't seem to produce #6708, but at least it'll be used by screen readers?
This commit is contained in:
arkon 2022-07-09 13:11:00 -04:00
parent 1551891c15
commit 487ce37d91

View file

@ -382,7 +382,10 @@ class MainActivity : BaseActivity() {
private fun setUnreadUpdatesBadge() {
val updates = if (preferences.showUpdatesNavBadge().get()) preferences.unreadUpdatesCount().get() else 0
if (updates > 0) {
nav.getOrCreateBadge(R.id.nav_updates).number = updates
nav.getOrCreateBadge(R.id.nav_updates).apply {
number = updates
setContentDescriptionQuantityStringsResource(R.plurals.notification_chapters_generic)
}
} else {
nav.removeBadge(R.id.nav_updates)
}
@ -391,7 +394,10 @@ class MainActivity : BaseActivity() {
private fun setExtensionsBadge() {
val updates = preferences.extensionUpdatesCount().get()
if (updates > 0) {
nav.getOrCreateBadge(R.id.nav_browse).number = updates
nav.getOrCreateBadge(R.id.nav_browse).apply {
number = updates
setContentDescriptionQuantityStringsResource(R.plurals.update_check_notification_ext_updates)
}
} else {
nav.removeBadge(R.id.nav_browse)
}