diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java index 059b269..be31130 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java @@ -469,15 +469,15 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { nodeZuobiao(child3); for (int r = 0; r < child3.getChildCount(); r++) { AccessibilityNodeInfo child4 = child3.getChild(r); -// Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription()); -// nodeZuobiao(child4); -// for (int m = 0; m < child4.getChildCount(); m++) { -// AccessibilityNodeInfo child5 = child4.getChild(m); -// Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); -// nodeZuobiao(child5); -// for (int p = 0; p < child5.getChildCount();p++) { -// AccessibilityNodeInfo child6 = child5.getChild(p); -// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription()); + Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription()); + nodeZuobiao(child4); + for (int m = 0; m < child4.getChildCount(); m++) { + AccessibilityNodeInfo child5 = child4.getChild(m); + Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); + nodeZuobiao(child5); + for (int p = 0; p < child5.getChildCount();p++) { + AccessibilityNodeInfo child6 = child5.getChild(p); + Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription()); // for (int t = 0; t < child6.getChildCount();t++) { // AccessibilityNodeInfo child7 = child6.getChild(t); // Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription()); @@ -487,8 +487,8 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { // // } // } -// } -// } + } + } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java index 8ae52ee..20c3baa 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java @@ -469,6 +469,28 @@ public class AblViewUtil { } return flag; } + + /** + * 根据范围获和输入的文本获取节点 + */ + public static AccessibilityNodeInfo getNodeInfo(String str) { + AccessibilityNodeInfo nodeInfo = null; + List nodeInfos = AblViewUtil.findByText(str); + for (int i=0;i0&&rect.top>2000&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) { + Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + nodeZuobiao(child); + nodeInfo = child; + } + } + return nodeInfo; + } + /** * 查看节点的坐标点 */ diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java b/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java index bc69449..aa4c47f 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java @@ -404,7 +404,7 @@ class NoticeBase extends BaseAblStep { // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription()); for (int r = 0; r < child3.getChildCount(); r++) { AccessibilityNodeInfo child4 = child3.getChild(r); - // Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); switch (type) { case "1"://说点什么 if ("android.widget.TextView".equals(child4.getClassName())) { @@ -554,7 +554,7 @@ class NoticeBase extends BaseAblStep { for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); - if ("android.widget.Button".equals(child.getClassName())) { + if ("android.widget.ImageView".equals(child.getClassName())) { if(child.getContentDescription()!=null) { if (child.getContentDescription().toString().equals("发送")) { nodeinfo = child; diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java index b342106..c8ad943 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -44,13 +44,130 @@ public class TestAblStep0 extends BaseAblStep { break; case AblSteps.STEP_2: - AblViewUtil.mySleep(2); - // getNodeInfoh(); - cancelGuanzhu(AblService.getInstance()); + AblViewUtil.mySleep(5); + getNodeInfoh(); + // cancelGuanzhu(AblService.getInstance()); + break; default: } } + /** + * 发送节点 + * @return + */ + public AccessibilityNodeInfo geouyintdd() { + AccessibilityNodeInfo nodeinfo = null; + 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()); + if ("android.widget.ImageView".equals(child.getClassName())) { + if(child.getContentDescription()!=null) { + if (child.getContentDescription().toString().equals("发送")) { + nodeinfo = child; + } + } + } + } + return nodeinfo; + } + /** + * 输入框 + * @return + */ + public AccessibilityNodeInfo getedittext() { + AccessibilityNodeInfo nodeinfo = null; + 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()); + if ("android.widget.EditText".equals(child.getClassName())) { + nodeinfo=child; + } + } + return nodeinfo; + } + /** + * 判断当前页面是否包含某文本 + */ + public AccessibilityNodeInfo isContainText(String str) { + + AccessibilityNodeInfo nodeInfo = null; + List nodeInfos = AblViewUtil.findByText(str); + for (int i=0;i0&&rect.top>2000&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) { + Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + nodeZuobiao(child); + nodeInfo = child; + } + } + return nodeInfo; + } + + /** + * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) + * 1.说点什么 + * 2.更多 + * 3.礼物 + */ + public void clickmoreli(String type) { + 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()); + for (int r = 0; r < child3.getChildCount(); r++) { + AccessibilityNodeInfo child4 = child3.getChild(r); + Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + switch (type) { + case "1"://说点什么 + if ("android.widget.TextView".equals(child4.getClassName())) { + if (child4.getText() != null) { + if (child4.getText().toString().equals("说点什么...")) { + AblService.getInstance().clickcommontwo(child4, ""); + } + } + } + break; + case "2"://更多 + if ("android.widget.Button".equals(child4.getClassName())) { + if (child4.getContentDescription().equals("更多")) { + AblService.getInstance().clickcommontwo(child4, "点击了更多"); + } + } + break; + case "3"://礼物 + if ("android.widget.Button".equals(child4.getClassName())) { + if (child4.getContentDescription().equals("礼物")) { + AblService.getInstance().clickcommontwo(child4, ""); + } + } + break; + default: + } + } + } + } + } + } + } + + + private void cancelGuanzhu(AblService instance) { @@ -75,21 +192,14 @@ public class TestAblStep0 extends BaseAblStep { for (int r = 0; r < child3.getChildCount(); r++) { AccessibilityNodeInfo child4 = child3.getChild(r); Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); -// nodeZuobiao(child4); -// Rect rect = new Rect(); -// if(child4!=null) { -// child4.getBoundsInScreen(rect); -// if (rect.top <= 2100) { for (int m = 0; m < child4.getChildCount(); m++) { AccessibilityNodeInfo child5 = child4.getChild(m); - // Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); - nodeZuobiao(child5); - yiguanzhu(child5); + Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); +// nodeZuobiao(child5); +// yiguanzhu(child5); } } } - // } - // } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java index 690ac56..04e60f2 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java @@ -473,25 +473,41 @@ public class TestAblStep30 extends NoticeBase { private void fasongpinglun(String conment) { //直播间话术 - AblViewUtil.mySleep(2); - clickmoreli("1"); + AblViewUtil.mySleep(3); + Log.e("TIAOSHI###", "开始点说点什么" ); + AccessibilityNodeInfo containText = isContainText("说点什么..."); + clickcommontwo(containText,""); AblViewUtil.mySleep(2); //复制文本粘贴在留言板 AccessibilityNodeInfo getedittext = getedittext(); Log.e("TIAOSHI###", "获得的关键词内容" + conment); AblViewUtil.mySleep(1); - if (SHEBEITIPE_VILUEONE.equals(ChangLiang.phonetype)) { - AblViewUtil.sayInput(conment, getedittext); - } else { - //华为畅享20 - AblViewUtil.sayInput(conment, getedittext); - } + AblViewUtil.sayInput(conment, getedittext); AblViewUtil.mySleep(1); AccessibilityNodeInfo geouyintdd = geouyintdd(); AblService.getInstance().clickcommontwo(geouyintdd, "点击发送"); AblViewUtil.mySleep(2); } - + /** + * 判断当前页面是否包含某文本 + */ + public AccessibilityNodeInfo isContainText(String str) { + AccessibilityNodeInfo nodeInfo = null; + List nodeInfos = AblViewUtil.findByText(str); + for (int i=0;i0&&rect.top>2000&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) { + Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + nodeZuobiao(child); + nodeInfo = child; + } + } + return nodeInfo; + } /** * 直播间点赞 diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java index 3f88cc3..ea446e5 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java @@ -84,7 +84,7 @@ public class TestAblStep6 extends BaseAblStep { //点击进入用户关注页 AblViewUtil.mySleep(2); AblService.getInstance().clickPoint(653, 464, 300); - // AblService.getInstance().clickcommontwo(child3, "进入用户关注页"); + // AblService.getInstance().clickcommontwo(child3, "进入用户关注页"); AblStepHandler.sendMsg(AblSteps.STEP_13); break; case AblSteps.STEP_13: @@ -96,8 +96,8 @@ public class TestAblStep6 extends BaseAblStep { if (num22.contains("W")) { String substring = num22.substring(0, num22.indexOf("W")); double personmun = Double.parseDouble(substring) * 10000; - num2= new Double(personmun).intValue(); - }else { + num2 = new Double(personmun).intValue(); + } else { num2 = Integer.parseInt(num22); } @@ -215,21 +215,14 @@ public class TestAblStep6 extends BaseAblStep { // nodeZuobiao(child3); for (int r = 0; r < child3.getChildCount(); r++) { AccessibilityNodeInfo child4 = child3.getChild(r); - Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription()); -// nodeZuobiao(child4); -// Rect rect = new Rect(); -// if(child4!=null) { -// child4.getBoundsInScreen(rect); -// if (rect.top <= 2100) { - for (int m = 0; m < child4.getChildCount(); m++) { - AccessibilityNodeInfo child5 = child4.getChild(m); - // Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); - nodeZuobiao(child5); - yiguanzhu(child5); - } - } - // } - // } + Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + for (int m = 0; m < child4.getChildCount(); m++) { + AccessibilityNodeInfo child5 = child4.getChild(m); + Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); + nodeZuobiao(child5); + yiguanzhu(child5); + } + } } } } @@ -240,7 +233,7 @@ public class TestAblStep6 extends BaseAblStep { public void yiguanzhu(AccessibilityNodeInfo child2) { boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed(); boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor(); - if (cancelclosed&&!cancelcrosscor) { + if (cancelclosed && !cancelcrosscor) { Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ"); if (child2.getChildCount() != 0) { for (int i = 0; i < child2.getChildCount(); i++) { @@ -258,9 +251,9 @@ public class TestAblStep6 extends BaseAblStep { } if (child.getText() != null) { if (child.getText().toString().equals("已关注")) { - // clickcommontwo(child, "已关注"); + // clickcommontwo(child, "已关注"); Rect rect = new Rect(); - if(child!=null) { + if (child != null) { child.getBoundsInScreen(rect); if (rect.top <= 2100) { clickcommontwo(child, "已关注"); @@ -272,7 +265,7 @@ public class TestAblStep6 extends BaseAblStep { } } - if (cancelcrosscor&&!cancelclosed) { + if (cancelcrosscor && !cancelclosed) { Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV"); if (child2.getChildCount() != 0) { for (int w = 0; w < child2.getChildCount(); w++) { @@ -287,9 +280,9 @@ public class TestAblStep6 extends BaseAblStep { AblViewUtil.mySleep(1); if (childw.getText() != null) { if (childw.getText().toString().equals("互相关注")) { - // clickcommontwo(childw, "互相关注"); + // clickcommontwo(childw, "互相关注"); Rect rect = new Rect(); - if(childw!=null) { + if (childw != null) { childw.getBoundsInScreen(rect); if (rect.top <= 2100) { clickcommontwo(childw, "互相关注"); @@ -308,7 +301,7 @@ public class TestAblStep6 extends BaseAblStep { } } - if(cancelclosed&&cancelcrosscor){ + if (cancelclosed && cancelcrosscor) { Log.e("TIAOSHI###", "WWWWWWWWWWWWWWWWWWWWW"); if (child2.getChildCount() != 0) { for (int i = 0; i < child2.getChildCount(); i++) { diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/methodUtil.java b/app/src/main/java/com/fisherbone/fuzhu/step/methodUtil.java deleted file mode 100644 index f5bbed2..0000000 --- a/app/src/main/java/com/fisherbone/fuzhu/step/methodUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fisherbone.fuzhu.step; - -import android.graphics.Rect; -import android.util.Log; -import android.view.accessibility.AccessibilityNodeInfo; - -import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; - -import java.util.List; - -/** - * - */ -public class methodUtil { - - - /** - * 判断当前页面是否包含某文本 - */ - public static boolean isContainText(String str) { - boolean flag = false; - List nodeInfos = AblViewUtil.findByText(str); - for (int i=0;i0&&rect.top>0&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) { - Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); - nodeZuobiao(child); - flag = true; - } - } - return flag; - } - - /** - * 查看节点的坐标点 - */ - public static void nodeZuobiao(AccessibilityNodeInfo nodeinfo){ - Rect rect = new Rect(); - nodeinfo.getBoundsInScreen(rect); - Log.e("TIAOSHI###", "----显示节点的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")"); - - } - - -}