Skip to content

Commit

Permalink
added image button role on android
Browse files Browse the repository at this point in the history
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
Ziqi Chen authored and facebook-github-bot committed Jul 17, 2018
1 parent 5acb721 commit 5741f77
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum AccessibilityRole {
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");
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 5741f77

Please sign in to comment.