This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Home
Ataul Munim edited this page May 2, 2018
·
6 revisions
- Check if TalkBack (or other spoken feedback accessibility service) is enabled
- Reports as enabled even if TalkBack is suspended
AccessibilityServices services = AccessibilityServices.newInstance(context);
services.isSpokenFeedbackEnabled();
There's other methods also:
isClosedCaptioningEnabled()
isSwitchAccessEnabled()
Usage hints are read aloud by TalkBack (and made available to other accessibility services). On TalkBack, they're read aloud after the content description for a view. For example, "Log in button... Double tap to activate", where "Double tap to activate" is the usage hint.
These can be customized on Lollipop and above:
UsageHintsAccessibilityDelegate usageHintsDelegate = new UsageHintsAccessibilityDelegate(getResources())
usageHintsDelegate.setClickLabel("sign in");
ViewCompat.setAccessibilityDelegate(logInButton, usageHintsDelegate);
so now it'll say, "Log in button... Double tap to sign in".
- a wrapper around View actions to facilitate actions via dialog or TalkBack local gestures menu
First create Actions
. It's necessary to give each Action
a unique resource ID (required by AccessibilityActionCompat
see ActionsAccessibilityDelegate
), and a display label.
Actions actions = // ...
AccessibilityDelegateCompat delegate = new ActionsAccessibilityDelegate(getResources(), actions);
ViewCompat.setAccessibilityDelegate(this, delegate);
// ...
// if TalkBack is enabled, display dialog on click
private void showAlertDialogFor(Actions actions) {
new ActionsAlertDialogCreator(getContext(), R.string.tweet_actions_title, actions)
.create()
.show();
}