Java Code Examples for android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#isChecked()
The following examples show how to use
android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#isChecked() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultBrailleRule.java From brailleback with Apache License 2.0 | 5 votes |
@Override public void format(Editable result, Context context, AccessibilityNodeInfoCompat node) { int oldLength = result.length(); CharSequence text = null; AccessibilityNodeInfoCompat labeledBy = node.getLabeledBy(); if (labeledBy != null) { text = LabelingUtils.getNodeText(labeledBy, getLabelManager()); labeledBy.recycle(); } if (text == null) { text = LabelingUtils.getNodeText(node, getLabelManager()); } if (text == null) { text = ""; } result.append(text); if (node.isCheckable() || node.isChecked()) { CharSequence mark; if (node.isChecked()) { mark = context.getString(R.string.checkmark_checked); } else { mark = context.getString(R.string.checkmark_not_checked); } StringUtils.appendWithSpaces(result, mark); } if (oldLength == result.length() && AccessibilityNodeInfoUtils.isActionableForAccessibility( node)) { result.append(getFallbackText(context, node)); } }
Example 2
Source File: TreeDebug.java From brailleback with Apache License 2.0 | 4 votes |
/** * Gets a description of the properties of a node. */ 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(); }