List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_CLICK
int ACTION_CLICK
To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_CLICK.
Click Source Link
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
/** * ID?// ww w .java2s . c o m * * @param clickId */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private void inputClick(String clickId) { AccessibilityNodeInfo nodeInfo = getRootInActiveWindow(); if (nodeInfo != null) { List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByViewId(clickId); for (AccessibilityNodeInfo item : list) { item.performAction(AccessibilityNodeInfo.ACTION_CLICK); } } }
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
/** * *//*from w ww. j a v a2s . co 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); } } } }