Skip to content

Commit

Permalink
Support accessibility announcements in the Android AccessibilityBridge (
Browse files Browse the repository at this point in the history
  • Loading branch information
amirh authored Oct 18, 2017
1 parent 58242e0 commit 879c1fb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,13 @@ private void sendAccessibilityEvent(AccessibilityEvent event) {
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
@SuppressWarnings("unchecked")
final HashMap<String, Object> annotatedEvent = (HashMap<String, Object>)message;
final int nodeId = (int)annotatedEvent.get("nodeId");
final String type = (String)annotatedEvent.get("type");
@SuppressWarnings("unchecked")
final HashMap<String, Object> data = (HashMap<String, Object>)annotatedEvent.get("data");

switch (type) {
case "scroll":
final int nodeId = (int)annotatedEvent.get("nodeId");
AccessibilityEvent event =
obtainAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_SCROLLED);
char axis = ((String)data.get("axis")).charAt(0);
Expand All @@ -375,6 +375,9 @@ public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
}
sendAccessibilityEvent(event);
break;
case "announce":
mOwner.announceForAccessibility((String) data.get("message"));
break;
default:
assert false;
}
Expand Down

0 comments on commit 879c1fb

Please sign in to comment.