I want to give following sequence of Talkback events when user navigates to a DialogFragment
,
1) On navigating to DialogFragment
, initial focus should be on positive Button
2) title+description of the dialog should get announced without focusing it's TextView
2) and lastly it should read out positive Button's content description
override fun onResume() {
super.onResume()
positiveButton.contentDescription = "OK"
positiveButton.announceForAccessibility(dialogArguments.title+dialogArguments.message)
positiveButton.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT)
ViewCompat.setAccessibilityDelegate(positiveButton, object : AccessibilityDelegateCompat() {
override fun onPopulateAccessibilityEvent(host: View?, event: AccessibilityEvent?) {
super.onPopulateAccessibilityEvent(host, event)
event?.text?.clear()
positiveButton.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null)
}
})
}
The above code works as per the required sequence but it doesn’t announce class type i.e Button and action description 'press select to activate' at the end