List of usage examples for android.support.v4.view.accessibility AccessibilityNodeInfoCompat isFocusable
public boolean isFocusable()
From source file:Main.java
/** * Returns whether a node is actionable. That is, the node supports one of * {@link AccessibilityNodeInfoCompat#isClickable()}, * {@link AccessibilityNodeInfoCompat#isFocusable()}, or * {@link AccessibilityNodeInfoCompat#isLongClickable()}. * * @param node The {@link AccessibilityNodeInfoCompat} to evaluate * @return {@code true} if node is actionable. *//*from w w w . jav a 2s .c om*/ public static boolean isActionableForAccessibility(@Nullable AccessibilityNodeInfoCompat node) { if (node == null) { return false; } if (node.isClickable() || node.isLongClickable() || node.isFocusable()) { return true; } List actionList = node.getActionList(); return actionList.contains(AccessibilityNodeInfoCompat.ACTION_CLICK) || actionList.contains(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK) || actionList.contains(AccessibilityNodeInfoCompat.ACTION_FOCUS); }
From source file:Main.java
/** * Returns whether a node is actionable. That is, the node supports one of * the following actions:// ww w . j a v a 2s. c o m * <ul> * <li>{@link AccessibilityNodeInfoCompat#isClickable()} * <li>{@link AccessibilityNodeInfoCompat#isFocusable()} * <li>{@link AccessibilityNodeInfoCompat#isLongClickable()} * </ul> * This parities the system method View#isActionableForAccessibility(), which * was added in JellyBean. * * @param node The node to examine. * @return {@code true} if node is actionable. */ public static boolean isActionableForAccessibility(AccessibilityNodeInfoCompat node) { if (node == null) { return false; } // Nodes that are clickable are always actionable. if (isClickable(node) || isLongClickable(node)) { return true; } if (node.isFocusable()) { return true; } return supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_FOCUS, AccessibilityNodeInfoCompat.ACTION_NEXT_HTML_ELEMENT, AccessibilityNodeInfoCompat.ACTION_PREVIOUS_HTML_ELEMENT); }
From source file:com.android.utils.AccessibilityNodeInfoUtils.java
/** * Returns whether a node is actionable. That is, the node supports one of * the following actions:/*from ww w . j ava2s . c om*/ * <ul> * <li>{@link AccessibilityNodeInfoCompat#isClickable()} * <li>{@link AccessibilityNodeInfoCompat#isFocusable()} * <li>{@link AccessibilityNodeInfoCompat#isLongClickable()} * </ul> * This parities the system method View#isActionableForAccessibility(), which * was added in JellyBean. * * @param node The node to examine. * @return {@code true} if node is actionable. */ public static boolean isActionableForAccessibility(AccessibilityNodeInfoCompat node) { if (node == null) { return false; } // Nodes that are clickable are always actionable. if (isClickable(node) || isLongClickable(node)) { return true; } if (node.isFocusable()) { return true; } if (WebInterfaceUtils.hasNativeWebContent(node)) { return supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_FOCUS); } return supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_FOCUS, AccessibilityNodeInfoCompat.ACTION_NEXT_HTML_ELEMENT, AccessibilityNodeInfoCompat.ACTION_PREVIOUS_HTML_ELEMENT); }
From source file:com.googlecode.eyesfree.utils.TreeDebug.java
/** * Gets a description of the properties of a node. *///www . ja va 2s . c o m public static CharSequence nodeDebugDescription(AccessibilityNodeInfoCompat node) { StringBuilder sb = new StringBuilder(); sb.append(node.getWindowId()); if (node.getClassName() != null) { appendSimpleName(sb, node.getClassName()); } else { sb.append("??"); } if (!node.isVisibleToUser()) { sb.append(":invisible"); } if (node.getText() != null) { sb.append(":"); sb.append(node.getText().toString().trim()); } if (node.getContentDescription() != null) { sb.append(":"); sb.append(node.getContentDescription().toString().trim()); } int actions = node.getActions(); if (actions != 0) { sb.append(":"); if ((actions & AccessibilityNodeInfoCompat.ACTION_FOCUS) != 0) { sb.append("F"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS) != 0) { sb.append("A"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS) != 0) { sb.append("a"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD) != 0) { sb.append("-"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD) != 0) { sb.append("+"); } } if (node.isCheckable()) { sb.append(":"); if (node.isChecked()) { sb.append("(X)"); } else { sb.append("( )"); } } if (node.isFocusable()) { sb.append(":focusable"); } if (node.isFocused()) { sb.append(":focused"); } if (node.isSelected()) { sb.append(":selected"); } if (node.isClickable()) { sb.append(":clickable"); } if (node.isLongClickable()) { sb.append(":longClickable"); } if (node.isAccessibilityFocused()) { sb.append(":accessibilityFocused"); } if (!node.isEnabled()) { sb.append(":disabled"); } return sb.toString(); }
From source file:com.android.utils.TreeDebug.java
/** * Gets a description of the properties of a node. */// w w w.ja v a 2 s. co m private static CharSequence nodeDebugDescription(AccessibilityNodeInfoCompat node) { StringBuilder sb = new StringBuilder(); sb.append(node.getWindowId()); if (node.getClassName() != null) { appendSimpleName(sb, node.getClassName()); } else { sb.append("??"); } if (!node.isVisibleToUser()) { sb.append(":invisible"); } Rect rect = new Rect(); node.getBoundsInScreen(rect); sb.append(":"); sb.append("(").append(rect.left).append(", ").append(rect.top).append(" - ").append(rect.right).append(", ") .append(rect.bottom).append(")"); if (node.getText() != null) { sb.append(":"); sb.append(node.getText().toString().trim()); } if (node.getContentDescription() != null) { sb.append(":"); sb.append(node.getContentDescription().toString().trim()); } int actions = node.getActions(); if (actions != 0) { sb.append(":"); if ((actions & AccessibilityNodeInfoCompat.ACTION_FOCUS) != 0) { sb.append("F"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS) != 0) { sb.append("A"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS) != 0) { sb.append("a"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD) != 0) { sb.append("-"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_CLICK) != 0) { sb.append("C"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_LONG_CLICK) != 0) { sb.append("L"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD) != 0) { sb.append("+"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_EXPAND) != 0) { sb.append("e"); } if ((actions & AccessibilityNodeInfoCompat.ACTION_COLLAPSE) != 0) { sb.append("c"); } } if (node.isCheckable()) { sb.append(":"); if (node.isChecked()) { sb.append("(X)"); } else { sb.append("( )"); } } if (node.isFocusable()) { sb.append(":focusable"); } if (node.isFocused()) { sb.append(":focused"); } if (node.isSelected()) { sb.append(":selected"); } if (node.isClickable()) { sb.append(":clickable"); } if (node.isLongClickable()) { sb.append(":longClickable"); } if (node.isAccessibilityFocused()) { sb.append(":accessibilityFocused"); } if (!node.isEnabled()) { sb.append(":disabled"); } if (node.getCollectionInfo() != null) { sb.append(":collection"); sb.append("#R"); sb.append(node.getCollectionInfo().getRowCount()); sb.append("C"); sb.append(node.getCollectionInfo().getColumnCount()); } if (node.getCollectionItemInfo() != null) { if (node.getCollectionItemInfo().isHeading()) { sb.append(":heading"); } else { sb.append(":item"); } sb.append("#r"); sb.append(node.getCollectionItemInfo().getRowIndex()); sb.append("c"); sb.append(node.getCollectionItemInfo().getColumnIndex()); } return sb.toString(); }
From source file:com.android.talkback.controller.CursorControllerApp.java
@Override public boolean setCursor(AccessibilityNodeInfoCompat node) { // Accessibility focus follows input focus; on TVs we want to set both simultaneously, // so we change the input focus if possible and let the ProcessorFocusAndSingleTap // handle changing the accessibility focus. if (mControlInputFocus && node.isFocusable() && !node.isFocused()) { if (setCursor(node, AccessibilityNodeInfoCompat.ACTION_FOCUS)) { return true; }//from ww w . j a v a2s .c o m } // Set accessibility focus otherwise (or as a fallback if setting input focus failed). return setCursor(node, AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS); }