List of usage examples for android.view.accessibility AccessibilityNodeInfo getParent
public AccessibilityNodeInfo getParent()
From source file:Main.java
public static AccessibilityNodeInfo findClickableNode(AccessibilityNodeInfo info) { if (info == null) { return null; }//from w w w.j a v a 2 s . c o m if (info.isClickable()) { return info; } else { return findClickableNode(info.getParent()); } }
From source file:Main.java
public static void performClick(AccessibilityNodeInfo nodeInfo) { if (nodeInfo == null) { return;/*from w w w .ja va 2 s.co m*/ } if (nodeInfo.isClickable()) { nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK); } else { performClick(nodeInfo.getParent()); } }
From source file:Main.java
public static AccessibilityNodeInfo findParentNodeInfoByClass(AccessibilityNodeInfo nodeInfo, String parentClass) {// w ww .ja v a2s . c o m if (nodeInfo == null || TextUtils.isEmpty(parentClass)) { return null; } if (parentClass.equals(nodeInfo.getClassName())) { return nodeInfo; } return findParentNodeInfoByClass(nodeInfo.getParent(), parentClass); }
From source file:com.googlecode.eyesfree.brailleback.IMEHelper.java
private void checkIMEPicker(AccessibilityEvent event) { if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED && "android".equals(event.getPackageName()) && "android.app.AlertDialog".equals(event.getClassName())) { AccessibilityNodeInfo node = event.getSource(); if (node == null) { return; }/*www . ja v a 2 s.c om*/ String IMETitle = mContext.getString(R.string.braille_ime_name); List<AccessibilityNodeInfo> found = node.findAccessibilityNodeInfosByText(IMETitle); if (found.size() == 0) { return; } AccessibilityNodeInfo firstFound = found.get(0); AccessibilityNodeInfo toFocus = firstFound.getParent(); if (toFocus != null) { toFocus.performAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } } }
From source file:com.android.switchaccess.SwitchAccessNodeCompat.java
@Override public SwitchAccessNodeCompat getParent() { AccessibilityNodeInfo info = (AccessibilityNodeInfo) getInfo(); AccessibilityNodeInfo parent = info.getParent(); return (parent == null) ? null : new SwitchAccessNodeCompat(parent, this.mWindowsAbove); }
From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java
private AccessibilityNodeInfo getNextSibling(AccessibilityNodeInfo from) { AccessibilityNodeInfo parent = from.getParent(); if (parent == null) { return null; }//from w w w . j a v a 2 s . c o m AccessibilityNodeInfo cur = null; try { int childCount = parent.getChildCount(); for (int i = 0; i < childCount - 1; ++i) { cur = parent.getChild(i); if (cur == null) { return null; } if (cur.equals(from)) { return parent.getChild(i + 1); } if (cur != null) { cur.recycle(); cur = null; } } } finally { parent.recycle(); if (cur != null) { cur.recycle(); } } return null; }
From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java
private AccessibilityNodeInfo getPreviousSibling(AccessibilityNodeInfo from) { AccessibilityNodeInfo ret = null;/*w w w . ja va 2 s. c o m*/ AccessibilityNodeInfo parent = from.getParent(); if (parent == null) { return null; } AccessibilityNodeInfo prev = null; AccessibilityNodeInfo cur = null; try { int childCount = parent.getChildCount(); for (int i = 0; i < childCount; ++i) { cur = parent.getChild(i); if (cur == null) { return null; } if (cur.equals(from)) { ret = prev; prev = null; return ret; } if (prev != null) { prev.recycle(); } prev = cur; cur = null; } } finally { parent.recycle(); if (prev != null) { prev.recycle(); } if (cur != null) { cur.recycle(); } } return ret; }
From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java
private boolean moveNext() { if (mCurrentNode == null) { return false; }/*www .jav a 2s. co m*/ int feedbackType = FeedbackManager.TYPE_NONE; AccessibilityNodeInfo target = getFirstChild(mCurrentNode); if (target != null) { feedbackType = FeedbackManager.TYPE_NAVIGATE_INTO_HIERARCHY; } else { target = getNextSibling(mCurrentNode); } if (target == null) { AccessibilityNodeInfo ancestor = mCurrentNode.getParent(); int cnt = 1; while (target == null && ancestor != null) { target = getNextSibling(ancestor); if (target == null) { AccessibilityNodeInfo temp = ancestor.getParent(); ancestor.recycle(); ancestor = temp; cnt += 1; } else { ancestor.recycle(); ancestor = null; } } if (target != null) { feedbackType = FeedbackManager.TYPE_NAVIGATE_OUT_OF_HIERARCHY; } } return moveTo(target, feedbackType); }
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
/** * *///from w ww . j a v a2 s . c o m public void recycle(AccessibilityNodeInfo info, String target, boolean isClickSelft) { int temp = 0; if (info != null && info.getChildCount() == 0) { if (info.getContentDescription() != null && info.getContentDescription().toString().equals(target) && isClickSelft) { String content = info.getContentDescription().toString(); info.performAction(AccessibilityNodeInfo.ACTION_CLICK); if (content.equals(AFTER_WORK)) handleIt(info); else if (content.equals(GO_TO_WORK)) handleGoToWork(info); return; } if (info.getText() != null) { if (target.equals(info.getText().toString())) { if (isClickSelft) { info.performAction(AccessibilityNodeInfo.ACTION_CLICK); return; } AccessibilityNodeInfo parent = info.getParent(); while (parent != null) { if (parent.isClickable()) { parent.performAction(AccessibilityNodeInfo.ACTION_CLICK); break; } parent = parent.getParent(); } } } } else { for (int i = 0; info != null && i < info.getChildCount(); i++) { if (info.getChild(i) != null) { temp = i; recycle(info.getChild(i), target, isClickSelft); } } } }