List of usage examples for android.support.v4.view.accessibility AccessibilityNodeInfoCompat getClassName
public CharSequence getClassName()
From source file:com.android.utils.AutomationUtils.java
/** * Returns whether a node matches the class specified by * {@code className} and exactly match the text or content description * specified by {@code text}.//from w w w . java2s . c om */ private static boolean nodeMatchesFilter(AccessibilityNodeInfoCompat node, CharSequence referenceClassName, String findText) { return ClassLoadingCache.checkInstanceOf(node.getClassName(), referenceClassName) && (TextUtils.equals(findText, node.getText()) || TextUtils.equals(findText, node.getContentDescription())); }
From source file:com.googlecode.eyesfree.utils.TreeDebug.java
/** * Gets a description of the properties of a node. *//* ww w .ja v a2 s .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.google.android.marvin.utils.AutomationUtils.java
/** * Returns whether a node matches the class specified by * {@code className} and exactly match the text or content description * specified by {@code text}.// w ww .ja v a2 s .c om */ private static boolean nodeMatchesFilter(Context context, AccessibilityNodeInfoCompat node, CharSequence referenceClassName, String findText) { final ClassLoadingManager loader = ClassLoadingManager.getInstance(); final CharSequence nodeClass = node.getClassName(); final CharSequence nodePackage = node.getPackageName(); if (!loader.checkInstanceOf(context, nodeClass, nodePackage, referenceClassName)) { return false; } final CharSequence nodeText = node.getText(); if (TextUtils.equals(findText, nodeText)) { return true; } final CharSequence nodeDesc = node.getContentDescription(); if (TextUtils.equals(findText, nodeDesc)) { return true; } return false; }
From source file:com.android.utils.TreeDebug.java
/** * Gets a description of the properties of a node. *//* w w w . j av a 2s.com*/ 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.CollectionState.java
private static boolean nodeMatchesAnyClassName(@Nullable AccessibilityNodeInfoCompat node, CharSequence... classNames) { if (node == null || node.getClassName() == null || classNames == null) { return false; }/*from www .j a v a 2s. c o m*/ for (CharSequence name : classNames) { if (node.getClassName().equals(name)) { return true; } } return false; }
From source file:assistive.com.scanme.com.googlecode.eyesfree.utils.AccessibilityNodeInfoUtils.java
/** * Determines if the generating class of an * {@link AccessibilityNodeInfoCompat} matches a given {@link Class} by * type.// ww w . ja va2 s . co m * * @param node A sealed {@link AccessibilityNodeInfoCompat} dispatched by * the accessibility framework. * @param referenceClass A {@link Class} to match by type or inherited type. * @return {@code true} if the {@link AccessibilityNodeInfoCompat} object * matches the {@link Class} by type or inherited type, * {@code false} otherwise. */ public static boolean nodeMatchesClassByType(Context context, AccessibilityNodeInfoCompat node, Class<?> referenceClass) { if ((node == null) || (referenceClass == null)) { return false; } // Attempt to take a shortcut. final CharSequence nodeClassName = node.getClassName(); if (TextUtils.equals(nodeClassName, referenceClass.getName())) { return true; } final ClassLoadingManager loader = ClassLoadingManager.getInstance(); final CharSequence appPackage = node.getPackageName(); return loader.checkInstanceOf(context, nodeClassName, appPackage, referenceClass); }
From source file:assistive.com.scanme.com.googlecode.eyesfree.utils.AccessibilityNodeInfoUtils.java
/** * Determines if the class of an {@link AccessibilityNodeInfoCompat} matches * a given {@link Class} by package and name. * * @param node A sealed {@link AccessibilityNodeInfoCompat} dispatched by * the accessibility framework. * @param referenceClassName A class name to match. * @return {@code true} if the {@link AccessibilityNodeInfoCompat} matches * the class name.//from ww w .j a va2s . co m */ public static boolean nodeMatchesClassByName(Context context, AccessibilityNodeInfoCompat node, CharSequence referenceClassName) { if ((node == null) || (referenceClassName == null)) { return false; } // Attempt to take a shortcut. final CharSequence nodeClassName = node.getClassName(); if (TextUtils.equals(nodeClassName, referenceClassName)) { return true; } final ClassLoadingManager loader = ClassLoadingManager.getInstance(); final CharSequence appPackage = node.getPackageName(); return loader.checkInstanceOf(context, nodeClassName, appPackage, referenceClassName); }
From source file:com.android.utils.AccessibilityNodeInfoUtils.java
/** * Determines if the class of an {@link AccessibilityNodeInfoCompat} matches * a given {@link Class} by package and name. * * @param node A sealed {@link AccessibilityNodeInfoCompat} dispatched by * the accessibility framework. * @param referenceClassName A class name to match. * @return {@code true} if the {@link AccessibilityNodeInfoCompat} matches * the class name.//from www. j av a 2 s. c o m */ public static boolean nodeMatchesClassByName(AccessibilityNodeInfoCompat node, CharSequence referenceClassName) { return node != null && ClassLoadingCache.checkInstanceOf(node.getClassName(), referenceClassName); }
From source file:com.android.utils.AccessibilityNodeInfoUtils.java
/** * Determines if the generating class of an * {@link AccessibilityNodeInfoCompat} matches any of the given * {@link Class}es by type.// www. j ava 2s. co m * * @param node A sealed {@link AccessibilityNodeInfoCompat} dispatched by * the accessibility framework. * @return {@code true} if the {@link AccessibilityNodeInfoCompat} object * matches the {@link Class} by type or inherited type, * {@code false} otherwise. * @param referenceClasses A variable-length list of {@link Class} objects * to match by type or inherited type. */ private static boolean nodeMatchesAnyClassByType(AccessibilityNodeInfoCompat node, Class<?>... referenceClasses) { if (node == null) return false; for (Class<?> referenceClass : referenceClasses) { if (ClassLoadingCache.checkInstanceOf(node.getClassName(), referenceClass)) { return true; } } return false; }
From source file:com.android.screenspeak.controller.CursorControllerApp.java
private boolean isLogicalScrollableWidget(AccessibilityNodeInfoCompat node) { if (node == null) { return false; }/* www . j ava2s . c o m*/ CharSequence className = node.getClassName(); return !(TextUtils.equals(className, DatePicker.class.getName()) || TextUtils.equals(className, NumberPicker.class.getName())); }