Why does TalkBack announce "Back"? - android

I am working on Android accessibility, and the phone has TalkBack enabled.
I have a screen with a toggle switch, and clicking on it will show a dialog.
Once the dialog is dismissed, the focus is supposed to go back to the toggle button and announce the content description for the button. But TalkBack is announcing, "Back. Toggle button is on."
I don't see the focus moving to the back navigation but somehow, it gets announced. And when the focus is in the navigation button, it always announces "Back button", but in the previous case, it's just "Back."
Things I already tried:
Force-focus the the toggle using request focus, sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED.
Interrupt - AccessibilityManager.interrupt()
Nothing worked!
Any clue why this would happen?
Toggle switch is on

Related

Announce QuickAction window dismissal with TalkBack

I have a custom QuickAction menu in my app. I have added contentDescription "Open Menu" for the ImageView which opens the menu. So my TalkBack(form the Accessibility settings) announces the same. The popup menu has setOutsideTouchable(true) to dismiss it when touched outside. When TalkBack is On user has to double tap to dismiss it but Android does not announce any such message. Ideally, it should announce "Double tap to dismiss ...". How can I achieve this ? Also, I would like to announce when the menu is dismissed. I have tried sending AccessibilityEvent inside:QuickAction.setOnDismissListener(new myQuickAction.OnDismissListener() {
#Override
public void onDismiss() {
// tried sending event here
} Added reference image to explain in detail. On clicking button blue popup is the QuickAction popup. Now I want to announce "Dismiss Menu" when user tap anywhere(black dot) on white region. White region is actually my LinearLayout containing header, footer etc.(that are not shown in the image). I have tried adding the contentDescription, importantForAccessibility for the layout but to no avail.
I would add either a little "X" box, or if you don't want to mess up your UI, make your layout container focusable, and add the content-description "Double Tap to Dismiss". (Note: The double tap is a talkback gesture, don't add this, just replicating from your question.)
EDIT: Essentially, what I'm recommending, is instead of adding an "X" button to the view, allow the layout view to act as an "X" button itself. By adding a contentDescription to the layout, you are making it focusable, even though typical users wouldn't interact with this view, nothing is keeping TalkBack users from doing so. Thus you do not change your layout visually, but still have the accessibility benefit of a separate close button, even though technically speaking this is not necessary, as users should understand how to close modals without it.
I don't believe announcing that it has been dismissed is necessary. Shifting focus back to the element that was focused before you opened the modal is the typical approach. Have this happen after your double tap, and TalkBack users will know the menu was dismissed, because they are back in the main view, on the element that opened the modal.
Sidenote: Ensure your QuickAction behaves as a modal!

How to detect loss of accessibility focus with on-screen navigation buttons?

I'm looking at the Support4Demos from the Android SDK and I'm not sure if this is working as intended. Specifically, I'm referring to accessibility focus when using the Widget > Explore by Touch Helper demo. If I tap on one of the blue regions to give it accessibility focus then tap on the on-screen home button focus will switch to the home button. But if I tap on the same blue region as before nothing happens (but if I tap on the other blue region focus transfers from the home button). I'm testing this on a Kindle with on-screen navigation buttons.
Am I correct in assuming that focus should transfer back to the blue region? If so, what is the proper way to handle this? Presumably there would be a way to know that the user tapped on something outside of the app and in response to this I could clear state in the ExploreByTouchHelper but I'm not sure how I would go about that.

Back icon state change

When keyboard is open, the icon of the back button is changed to indicate that clicking it will close the keyboard instead of going back.
Back button:
Close button:
Is there a way how to switch from the back icon to close icon programmatically without actually opening the keyboard? We are using a custom keyboard implementation and would like to have the similar behaviour to the native one.

Android 4.0+ software back button style

I have handled back button to close activity instead of hiding keyboard. It works just fine.
But if device has no hardware buttons software button will show hide keyboard (arrow down instead of back) image when keyboard is open. Of course clicking that down ("back") does close my activity.
This is what i have:
This is what i would like to have instead:
Is it possible to force software back button look like back button (instead of close keyboard) when keyboard is opened?

Android Actionbar: click Up-Button programmatically

Hi,
Android 4 (ICS) offers a view element called ActionBar. Using the ActionBar, I've created a search widget where I can enter text to trigger a remote suggest search. If you click on a magnifier icon within this ActionBar to open the search widget textfield, two things happen:
The softkeyboard gets displayed
The "home button" (app icon on the top left) changes his
functionality to an "up button". "up" means, that you undo your last
action (in this case: opening the search widget textfield)
If you click on the "up button" the search widget collapses so that the textfield disappears. In the same moment the "up button" changes it's functionality back to act as a "home button". This behaviour describes the "default" behavior of the Android 4 ActionBar with an attached search widget.
Using the hardware "back button" instead of the soft "up button", the keyboard disappears, but the search widget remains open. Also the "up button" doesn't change to a "home button".
My question:
How can I trigger a "up button" click within the ActionBar programmatically? If I could do this, I could collapse the search widget textfield and put back the "up button" to become a "home button" again, if the user presses the hardware "back button".
This example shows a "home button" on the very left and a closed search widget "magnifier icon" on the right. If the user clicks the magnifier, the textfield shows up and the "home button" becomes a "up button".
Thanks in advance!
I think there can be a solution for this. As documentation says,
To navigate up when the user presses the app icon, you can use the NavUtils class's static method, navigateUpFromSameTask().
So you can manually call
NavUtils.navigateUpFromSameTask(this);
for performing home button click programmatically.
I have scoured the net and SO, and can't find any way to fire this programmatically.
I ended up just recreating the bits and pieces needed to make the view switch back to the home view along with changing the actionbar back to normal and putting that in a public method so other classes can make the view go home.
You can trigger a click on any view programmatically by calling performClick() on the View.
See the performClick() documentation.

Categories

Resources