Permalink
Browse files

added image button role on android

Summary:
Because we're now separating accessibilityTraits into accessibilityRole and accessibilityState, we're going to only allow one role to be set, and allow on preset combinations of roles that make sense.

This adds android functionality for an added role that is image button.

Reviewed By: blavalla

Differential Revision: D8846987

fbshipit-source-id: 9fe36828f63b05bd2c9cf9680204b1995d678342
  • Loading branch information...
ziqichen6 authored and facebook-github-bot committed Jul 17, 2018
1 parent 5acb721 commit 5741f771562962110e105114a2c65def4baa805b
@@ -34,6 +34,7 @@
LINK("android.widget.Button"),
SEARCH("android.widget.EditText"),
IMAGE("android.widget.ImageView"),
IMAGEBUTTON("android.widget.ImageView"),
KEYBOARDKEY("android.inputmethodservice.Keyboard$Key"),
TEXT("android.widget.ViewGroup"),
ADJUSTABLE("android.widget.SeekBar");
@@ -91,6 +92,10 @@ public static void setRole(AccessibilityNodeInfoCompat nodeInfo, final Accessibi
if (role.equals(AccessibilityRole.IMAGE)) {
nodeInfo.setRoleDescription("Image");
}
if (role.equals(AccessibilityRole.IMAGEBUTTON)) {
nodeInfo.setRoleDescription("Button Image");
nodeInfo.setClickable(true);
}
if (role.equals(AccessibilityRole.ADJUSTABLE)) {
nodeInfo.setRoleDescription("Adjustable");
}

0 comments on commit 5741f77

Please sign in to comment.