oppia-android: Talk back is not reading Arabic language in Audio Language dialog box
Describe the bug Talk back is not reading Arabic language in Audio Language dialog box
To Reproduce Steps to reproduce the behavior:
- Go to ‘Place Values’
- Double tap on ‘What are place values’
- Double tap on ‘Audio’ button
- Double tap on ‘Change language’ icon
- Audio Language dialog box appears
- Swipe across the various languages
Expected behavior Talk back to read all the language names including Arabic
Environment Device name: One plus Nord2 5G Android version : Android 11 App version : 0.7-alpha-d1b2827517
Explanation and suggested solution
In LanguageDialogFragment, we use appLanguageResourceHandler.computeLocalizedDisplayName(audioLanguage) to get the display name for ecah language. The Arabic language therefore is displayed in Arabic characters, which talkback, when localized to English, cannot read.
Talkback relies on content descriptions where available, but since this list is dynamic, we can use an accessibility delegate to instruct talkback on how to read Arabic(and Hindi too).
When creating the dialog, override the accessibility properties of the list items by accessing the AlertDialog’s ListView after creation:
val options = languageNameArrayList.toTypedArray<CharSequence>()
val languageInterface: LanguageInterface = parentFragment as AudioFragment
val alertDialog = AlertDialog.Builder(ContextThemeWrapper(activity as Context, R.style.OppiaDialogFragmentTheme))
...
.create()
alertDialog.setOnShowListener {
val listView = alertDialog.listView
for (i in 0 until listView.childCount) {
val item = listView.getChildAt(i)
item?.setAccessibilityDelegate(object : View.AccessibilityDelegate() {
override fun onInitializeAccessibilityNodeInfo(
host: View?,
info: AccessibilityNodeInfo?
) {
super.onInitializeAccessibilityNodeInfo(host, info)
// Get the item text
// Set content description for TalkBack
}
})
}
}
return alertDialog
UI tests are expected for the submitted code.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 15 (1 by maintainers)
@elin4046, you can work on this