/** Returns the focused node or the specified root if none found. */
 private AccessibilityNodeInfoCompat getFocusedNode(AccessibilityNodeInfoCompat root) {
   AccessibilityNodeInfoCompat focused = null;
   if (root != null) {
     focused = root.findFocus(AccessibilityNodeInfoCompat.FOCUS_ACCESSIBILITY);
     if (focused != null && focused.isVisibleToUser()) {
       return focused;
     }
     return root;
   }
   return null;
 }
Beispiel #2
0
 private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat2) {
     Rect rect = this.mTmpRect;
     accessibilityNodeInfoCompat2.getBoundsInParent(rect);
     accessibilityNodeInfoCompat.setBoundsInParent(rect);
     accessibilityNodeInfoCompat2.getBoundsInScreen(rect);
     accessibilityNodeInfoCompat.setBoundsInScreen(rect);
     accessibilityNodeInfoCompat.setVisibleToUser(accessibilityNodeInfoCompat2.isVisibleToUser());
     accessibilityNodeInfoCompat.setPackageName(accessibilityNodeInfoCompat2.getPackageName());
     accessibilityNodeInfoCompat.setClassName(accessibilityNodeInfoCompat2.getClassName());
     accessibilityNodeInfoCompat.setContentDescription(accessibilityNodeInfoCompat2.getContentDescription());
     accessibilityNodeInfoCompat.setEnabled(accessibilityNodeInfoCompat2.isEnabled());
     accessibilityNodeInfoCompat.setClickable(accessibilityNodeInfoCompat2.isClickable());
     accessibilityNodeInfoCompat.setFocusable(accessibilityNodeInfoCompat2.isFocusable());
     accessibilityNodeInfoCompat.setFocused(accessibilityNodeInfoCompat2.isFocused());
     accessibilityNodeInfoCompat.setAccessibilityFocused(accessibilityNodeInfoCompat2.isAccessibilityFocused());
     accessibilityNodeInfoCompat.setSelected(accessibilityNodeInfoCompat2.isSelected());
     accessibilityNodeInfoCompat.setLongClickable(accessibilityNodeInfoCompat2.isLongClickable());
     accessibilityNodeInfoCompat.addAction(accessibilityNodeInfoCompat2.getActions());
     accessibilityNodeInfoCompat.setMovementGranularities(accessibilityNodeInfoCompat2.getMovementGranularities());
 }
Beispiel #3
0
 public final void onInitializeAccessibilityNodeInfo(
     View view, AccessibilityNodeInfoCompat accessibilitynodeinfocompat) {
   AccessibilityNodeInfoCompat accessibilitynodeinfocompat1 =
       AccessibilityNodeInfoCompat.obtain(accessibilitynodeinfocompat);
   super.onInitializeAccessibilityNodeInfo(view, accessibilitynodeinfocompat1);
   accessibilitynodeinfocompat.setClassName(
       com / roidapp / baselib / view / FixedDrawerLayout.getName());
   accessibilitynodeinfocompat.setSource(view);
   Object obj = ViewCompat.getParentForAccessibility(view);
   if (obj instanceof View) {
     accessibilitynodeinfocompat.setParent((View) obj);
   }
   obj = b;
   accessibilitynodeinfocompat1.getBoundsInParent(((Rect) (obj)));
   accessibilitynodeinfocompat.setBoundsInParent(((Rect) (obj)));
   accessibilitynodeinfocompat1.getBoundsInScreen(((Rect) (obj)));
   accessibilitynodeinfocompat.setBoundsInScreen(((Rect) (obj)));
   accessibilitynodeinfocompat.setVisibleToUser(accessibilitynodeinfocompat1.isVisibleToUser());
   accessibilitynodeinfocompat.setPackageName(accessibilitynodeinfocompat1.getPackageName());
   accessibilitynodeinfocompat.setClassName(accessibilitynodeinfocompat1.getClassName());
   accessibilitynodeinfocompat.setContentDescription(
       accessibilitynodeinfocompat1.getContentDescription());
   accessibilitynodeinfocompat.setEnabled(accessibilitynodeinfocompat1.isEnabled());
   accessibilitynodeinfocompat.setClickable(accessibilitynodeinfocompat1.isClickable());
   accessibilitynodeinfocompat.setFocusable(accessibilitynodeinfocompat1.isFocusable());
   accessibilitynodeinfocompat.setFocused(accessibilitynodeinfocompat1.isFocused());
   accessibilitynodeinfocompat.setAccessibilityFocused(
       accessibilitynodeinfocompat1.isAccessibilityFocused());
   accessibilitynodeinfocompat.setSelected(accessibilitynodeinfocompat1.isSelected());
   accessibilitynodeinfocompat.setLongClickable(accessibilitynodeinfocompat1.isLongClickable());
   accessibilitynodeinfocompat.addAction(accessibilitynodeinfocompat1.getActions());
   accessibilitynodeinfocompat1.recycle();
   view = (ViewGroup) view;
   int j = view.getChildCount();
   for (int i = 0; i < j; i++) {
     View view1 = view.getChildAt(i);
     if (FixedDrawerLayout.h(view1)) {
       accessibilitynodeinfocompat.addChild(view1);
     }
   }
 }
Beispiel #4
0
  /** 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();
  }