I'm developing a simple app that is structured in Activities and Fragments, one of the requirements its to make it accessible so I did all the content decriptions, navigaction, focus, etc.
And it works great, except with fragments, if there is an activity that loads a fragment the talkback reads its content, then the user clicks on something and a detail fragment that could be added on top of the stack.
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
audios = AudiosListFragment.newInstance(params);
ft.add(R.id.audios_fragment_holder, audios);
ft.commit();
If the user keeps navigating talkback still remember the position of each element of the missing fragment.
Is there any way to clear the Accessibility list of events and force it to get it again? Accesibility manager does not seem to have any method for that.
AccessibilityManager manager = (AccessibilityManager) getActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
manager.getAccessibilityServiceList();
-- EDITED -- Things that I've tried and did not work out.
Sending an event from the view creation in the fragment.
AccessibilityEvent event =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
AccessibilityDelegate delegate = new AccessibilityDelegate();
v.setAccessibilityDelegate(delegate);
delegate.dispatchPopulateAccessibilityEvent(container, event);
Interrupting all the pending texts on the onResume of the fragment.
AccessibilityManager mgr = (AccessibilityManager)
getActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
mgr.interrupt();
Requesting the decorator view to register an event of window_content_change or window_state_change.
getWindow().getDecorView()
.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
-- EDITED -- Made a DumpView Hierarchy and in there is no trace of the dismissed fragment, but talkback stills navigates it :(
Thanks, I hope someone can throw some light on this issue :)
Regards.