/** * 点击直播间下方的更多按钮 * 1.说点什么 * 2.更多 * 3.礼物 */ private void clickmore(String type) { accessibilityNodeInfos = new ArrayList<>(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); for (int y = 0; y < child.getChildCount(); y++) { AccessibilityNodeInfo child1 = child.getChild(y); // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); switch (type) { case "1"://说点什么 if ("android.widget.TextView".equals(child1.getClassName())) { if (child1.getText() != null) { if (child1.getText().toString().equals("说点什么...")) { AblService.getInstance().clickcommontwo(child1, ""); } } } break; case "2"://更多 if ("android.widget.Button".equals(child1.getClassName())) { if (child1.getContentDescription().equals("更多")) { AblService.getInstance().clickcommontwo(child1, ""); } } break; case "3"://礼物 if ("android.widget.Button".equals(child1.getClassName())) { if (child1.getContentDescription().equals("礼物")) { AblService.getInstance().clickcommontwo(child1, ""); } } break; } } } } /** * 分享 * 1为分享 2为私信朋友 */ private void share(String type) { accessibilityNodeInfos = new ArrayList<>(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); for (int y = 0; y < child.getChildCount(); y++) { AccessibilityNodeInfo child1 = child.getChild(y); // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); for (int j = 0; j < child1.getChildCount(); j++) { AccessibilityNodeInfo child2 = child1.getChild(j); // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); for (int x = 0; x < child2.getChildCount(); x++) { AccessibilityNodeInfo child3 = child2.getChild(x); // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription()); switch (type) { case "1": if ("android.widget.TextView".equals(child3.getClassName())) { if (child3.getText() != null) { if (child3.getText().toString().equals("分享")) { AblService.getInstance().clickcommontwo(child3, ""); } } } break; case "2": if ("android.widget.TextView".equals(child3.getClassName())) { if (child3.getText() != null) { if (child3.getText().toString().equals("私信朋友")) { AblService.getInstance().clickcommontwo(child3, ""); } } } break; } } } } } }