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 c33714c..059b269 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java @@ -31,16 +31,15 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { * 点击我的 */ @RequiresApi(api = Build.VERSION_CODES.N) - public void myClick(){ + public void myClick() { AblService instance = AblService.getInstance(); - if(ChangLiang.phonetype.equals("0")){ - instance.clickPoint(648,1286, 300);//红米7a - }else if(ChangLiang.phonetype.equals("3")){ + if (ChangLiang.phonetype.equals("0")) { + instance.clickPoint(648, 1286, 300);//红米7a + } else if (ChangLiang.phonetype.equals("3")) { AblViewUtil.mySleep(6); AblService.getInstance().clickPoint(972, 2103, 300); - } - else { - instance.clickPoint(648,1536, 300);//华为畅享20 [632,1521][664,1552] + } else { + instance.clickPoint(648, 1536, 300);//华为畅享20 [632,1521][664,1552] } Log.e("TIAOSHI###", "点击了我按钮"); } @@ -49,7 +48,7 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { //华为畅享20 AblService.getInstance().clickPoint(990, 163, 300); - switch (ChangLiang.phonetype){ + switch (ChangLiang.phonetype) { case "0": //红米7a AblService.getInstance().clickPoint(656, 99, 300); @@ -73,10 +72,11 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 开启运行倒计时 - * @param type 任务类型 5.大v粉丝 6.抢红包 - * @param davruntime 倒计时 + * + * @param type 任务类型 5.大v粉丝 6.抢红包 + * @param davruntime 倒计时 */ - public void TurnCount(String type,int davruntime) { + public void TurnCount(String type, int davruntime) { MessageBean messageBean = new MessageBean(); messageBean.setFromtype(type); messageBean.setRuntime(davruntime); @@ -86,7 +86,7 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 查看节点的坐标点 */ - public void nodeZuobiao(AccessibilityNodeInfo nodeinfo){ + public void nodeZuobiao(AccessibilityNodeInfo nodeinfo) { Rect rect = new Rect(); nodeinfo.getBoundsInScreen(rect); Log.e("TIAOSHI###", "----显示节点的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")"); @@ -96,7 +96,7 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 查看节点的坐标点 */ - public void nodeZuobiaoii(AccessibilityNodeInfo nodeinfo){ + public void nodeZuobiaoii(AccessibilityNodeInfo nodeinfo) { Rect rect = new Rect(); nodeinfo.getBoundsInScreen(rect); Log.e("TIAOSHI###", "----显示控件点击的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")"); @@ -119,15 +119,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 关闭青少年保护弹框 + * * @param instance */ public void closedQDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("我知道了", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到我知道了的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了我知道了的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到我知道了的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了我知道了的弹窗"); AblService.getInstance().clickcommontwo(zhidao, "我知道了"); AblViewUtil.mySleep(2); } @@ -135,15 +136,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 关闭设置抖音号弹框 + * * @param instance */ public void setdoyinQDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("设置抖音号", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到设置抖音号的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了设置抖音号的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到设置抖音号的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了设置抖音号的弹窗"); AblService.getInstance().clickPoint(1025, 1630, 300); AblViewUtil.mySleep(3); fangqiQDialog(instance); @@ -153,10 +155,10 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { public void fangqiQDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("放弃", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到放弃的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了放弃的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到放弃的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了放弃的弹窗"); //[623,1146][799,1295] AblService.getInstance().clickPoint(711, 1220, 300); AblViewUtil.mySleep(2); @@ -165,15 +167,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 关闭检测到更新弹框 + * * @param instance */ public void closedJDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("检测到更新", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到检测到更新的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了检测到更新的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到检测到更新的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了检测到更新的弹窗"); AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("以后再说", 0); AblService.getInstance().clickcommontwo(zaishuo, "以后再说"); AblViewUtil.mySleep(1); @@ -182,15 +185,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 关闭检测到更新弹框 + * * @param instance */ public void closedzsDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("暂时不要", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到暂时不要的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了暂时不要的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到暂时不要的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了暂时不要的弹窗"); AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("暂时不要", 0); AblService.getInstance().clickcommontwo(zaishuo, "暂时不要"); AblViewUtil.mySleep(1); @@ -199,15 +203,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 关闭朋友推荐弹框 + * * @param instance */ public void closedtjDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("朋友推荐", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到朋友推荐的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了朋友推荐的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到朋友推荐的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了朋友推荐的弹窗"); //[890,489][956,555] AblService.getInstance().clickPoint(923, 522, 300); AblViewUtil.mySleep(1); @@ -216,15 +221,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 个人信息保护指引 + * * @param instance */ public void yinsiDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("个人信息保护指引", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到个人信息保护指引的弹窗" ); - }else { - Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到个人信息保护指引的弹窗"); + } else { + Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗"); List list = AblViewUtil.findByText("同意"); for (AccessibilityNodeInfo item : list) { clickcommontwo(item, "同意"); @@ -236,15 +242,16 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { /** * 关闭个人信息保护指引 + * * @param instance */ public void closedBDialog(AblService instance) { //处理我知道了的弹框 AccessibilityNodeInfo zhidao = AblViewUtil.findByText("个人信息保护指引", 0); - if(zhidao==null){ - Log.e("TIAOSHI###", "没有找到个人信息保护指引" ); - }else { - Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗" ); + if (zhidao == null) { + Log.e("TIAOSHI###", "没有找到个人信息保护指引"); + } else { + Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗"); AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("同意", 0); AblService.getInstance().clickcommontwo(zaishuo, "同意"); AblViewUtil.mySleep(1); @@ -264,8 +271,6 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { } - - protected void againStart(String str) { final HttpParams paramsPost = new HttpParams(); paramsPost.put("task_status", str); @@ -295,13 +300,13 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { 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()); - // nodeZuobiao(child); + // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + // nodeZuobiao(child); Rect rect = new Rect(); child.getBoundsInScreen(rect); if (rect.left >= 0 && rect.left < 1080) { - // Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); - // nodeZuobiao(child); + // Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + // nodeZuobiao(child); if ("com.bytedance.ies.dmt.ui.widget.DmtTextView".equals(child.getClassName())) { flag = true; } @@ -310,6 +315,7 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { return flag; } + /** * 当前页面如果有切换账号和管理,说明账号切换任务运行正常 */ @@ -320,17 +326,18 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { AccessibilityNodeInfo child = root.getChild(i); // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); // nodeZuobiao(child); - if ("android.widget.TextView".equals(child.getClassName())) { - if("管理".equals(child.getText().toString())){ - flag = true; - } - + if ("android.widget.TextView".equals(child.getClassName())) { + if ("管理".equals(child.getText().toString())) { + flag = true; } + } + } return flag; } + /** * 当前页面是否在我的页面 */ @@ -352,7 +359,7 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { public boolean allowed() { boolean ifOpen = false; AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); - if(root!=null) { + if (root != null) { for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); @@ -439,7 +446,6 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { return infooos; } - /** * 寻找控件 */ @@ -489,5 +495,46 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { } } } + /** + * 是否关注过 (判断的准确率在百分之90之上) + */ + public boolean ifGaunzhu() { + boolean flag = false; + AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); + for (int i = 0; i < root.getChildCount(); i++) { + AccessibilityNodeInfo child = root.getChild(i); + + if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { +// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); +// nodeZuobiao(child); + + for (int y = 0; y < child.getChildCount(); y++) { + AccessibilityNodeInfo child1 = child.getChild(y); +// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); +// nodeZuobiao(child1); + + for (int j = 0; j < child1.getChildCount(); j++) { + AccessibilityNodeInfo child2 = child1.getChild(j); + Rect rect = new Rect(); + child2.getBoundsInScreen(rect); + if (rect.left > 0 && rect.left <= 1080 && rect.top > 0 && rect.top <= 2210 && rect.bottom > 0 && rect.bottom <= 2210 && rect.right <= 1080) { + + Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); + nodeZuobiao(child2); + if ("android.widget.Button".equals(child2.getClassName())) { + if (child2.getContentDescription() != null) { + + if ("关注".equals(child2.getContentDescription().toString())) { + flag = true; + } + } + } + } + } + } + } + } + return flag; + } } 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 6b0bb1a..b342106 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -21,6 +21,7 @@ import com.fisherbone.fuzhu.abllib.BaseAblStep; import com.fisherbone.fuzhu.abllib.callback.GestureCallBack; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; import com.fisherbone.fuzhu.entity.LiwuBean; +import com.fisherbone.fuzhu.utils.ProfileSpUtils; import com.google.gson.Gson; import java.util.ArrayList; @@ -44,62 +45,140 @@ public class TestAblStep0 extends BaseAblStep { break; case AblSteps.STEP_2: AblViewUtil.mySleep(2); - // getNodeInfoh(); - // AblService.getInstance().randomSwipetwo(); -// ArrayList nodeInfodh = getNodeInfodh(); -// AccessibilityNodeInfo nodeInfo = nodeInfodh.get(0); -// clickcommontwo(nodeInfo,""); - - - - - DianSou(); - AblViewUtil.mySleep(2); - selecttype("1"); - AblViewUtil.mySleep(2); - AblViewUtil.mySleep(2); - //用坐标点的方式点击第一条 0,256 720,404 - //华为畅享20 - AblService.getInstance().clickPoint(790, 456, 300); - // AblService.getInstance().clickPoint(540, 478, 300); - + // getNodeInfoh(); + cancelGuanzhu(AblService.getInstance()); break; default: } } - /** - * 寻找控件 - */ - public ArrayList getNodeInfodh() { - ArrayList accessibilityNodeInfos = new ArrayList<>(); - + private void cancelGuanzhu(AblService instance) { 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()); - nodeZuobiao(child); +// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); +// nodeZuobiao(child); for (int y = 0; y < child.getChildCount(); y++) { AccessibilityNodeInfo child1 = child.getChild(y); - Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); - nodeZuobiao(child1); +// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); +// nodeZuobiao(child1); for (int j = 0; j < child1.getChildCount(); j++) { AccessibilityNodeInfo child2 = child1.getChild(j); - Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); - nodeZuobiao(child2); +// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); +// nodeZuobiao(child2); for (int x = 0; x < child2.getChildCount(); x++) { AccessibilityNodeInfo child3 = child2.getChild(x); Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - nodeZuobiao(child3); - if("android.widget.FrameLayout".equals(child3.getClassName())){ - accessibilityNodeInfos.add(child3); +// nodeZuobiao(child3); + if("android.widget.RelativeLayout".equals(child3.getClassName())) { + 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); + } + } + } + // } + // } + } + } + } + } + } + + // 3.遍历info中的子节点 (优化方法,正在测试) + public void yiguanzhu(AccessibilityNodeInfo child2) { + boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed(); + boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor(); + if (cancelclosed&&!cancelcrosscor) { + Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ"); + if (child2.getChildCount() != 0) { + for (int i = 0; i < child2.getChildCount(); i++) { + AccessibilityNodeInfo child = child2.getChild(i); + if (child.getText() != null) { + if (!child.getText().toString().equals("已关注")) { + continue; + } + } + + try { + Thread.sleep(300); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (child.getText() != null) { + if (child.getText().toString().equals("已关注")) { + clickcommontwo(child, "已关注"); + } + } + } + } + } + + if (cancelcrosscor&&!cancelclosed) { + Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV"); + if (child2.getChildCount() != 0) { + for (int w = 0; w < child2.getChildCount(); w++) { + AccessibilityNodeInfo childw = child2.getChild(w); + if (childw != null) { + if (childw.getText() != null) { + if (!childw.getText().toString().equals("互相关注")) { + continue; + } + } + + AblViewUtil.mySleep(1); + if (childw.getText() != null) { + if (childw.getText().toString().equals("互相关注")) { + clickcommontwo(childw, "互相关注"); + AblViewUtil.mySleep(2); + AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); + clickcommontwo(quxiao, "取消关注"); + + } + } + } + } + } + } + + if(cancelclosed&&cancelcrosscor){ + Log.e("TIAOSHI###", "WWWWWWWWWWWWWWWWWWWWW"); + if (child2.getChildCount() != 0) { + for (int i = 0; i < child2.getChildCount(); i++) { + AccessibilityNodeInfo child = child2.getChild(i); + if (child.getText() != null) { + if (child.getText().toString().equals("已关注")) { + try { + Thread.sleep(300); + } catch (InterruptedException e) { + e.printStackTrace(); + } + clickcommontwo(child, "已关注"); + } + if (child.getText().toString().equals("互相关注")) { + AblViewUtil.mySleep(1); + clickcommontwo(child, "互相关注"); + AblViewUtil.mySleep(2); + AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); + clickcommontwo(quxiao, "取消关注"); + AblViewUtil.mySleep(1); + } } } } } - return accessibilityNodeInfos; } } 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 dd56d25..3f88cc3 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java @@ -35,6 +35,8 @@ public class TestAblStep6 extends BaseAblStep { private int numb;//阈值 private String guanzhunum; private AccessibilityNodeInfo child3; + private int num; + private int num2; @Override public void onStep(int step, Message msg) { @@ -54,27 +56,35 @@ public class TestAblStep6 extends BaseAblStep { //获取关注数(对比关注数是否满足预设的取关值;)若不满足,则直接结束任务,若满足,则点击【关注】,进入关注页; getargone(); AblViewUtil.mySleep(1); - if (guanzhunum == null) { - Log.e("TIAOSHI###", "关注数==null结束任务"); - ToastUtils.showShort("关注数==null结束任务"); - AblStepHandler.getInstance().setStop(true); - // AblViewUtil.onMessage("停止"); - return; - } - Log.e("TIAOSHI###", "获得的关注数==" + guanzhunum); - int num = Integer.parseInt(guanzhunum); - Log.e("TIAOSHI###", "关注数" + num); - numb = Integer.parseInt(ChangLiang.minthrthr) - Integer.parseInt(ChangLiang.passnumber); - if (num <= Integer.parseInt(ChangLiang.minthrthr) - Integer.parseInt(ChangLiang.passnumber)) { - Log.e("TIAOSHI###", "关注数小于等于设定的取关数结束任务"); - ToastUtils.showShort("关注数小于等于设定的取关数结束任务"); - AblStepHandler.getInstance().setStop(true); - // AblViewUtil.onMessage("停止"); - return; - } +// if (guanzhunum == null) { +// Log.e("TIAOSHI###", "关注数==null结束任务"); +// ToastUtils.showShort("关注数==null结束任务"); +// AblStepHandler.getInstance().setStop(true); +// // AblViewUtil.onMessage("停止"); +// return; +// } +// Log.e("TIAOSHI###", "获得的关注数==" + guanzhunum); +// +// if (guanzhunum.contains("w")) { +// String substring = guanzhunum.substring(0, guanzhunum.indexOf("w")); +// double personmun = Double.parseDouble(substring) * 10000; +// num= new Double(personmun).intValue(); +// }else { +// num = Integer.parseInt(guanzhunum); +// } +// Log.e("TIAOSHI###", "关注数" + num); +// numb = Integer.parseInt(ChangLiang.minthrthr) - Integer.parseInt(ChangLiang.passnumber); +// if (num <= Integer.parseInt(ChangLiang.minthrthr) - Integer.parseInt(ChangLiang.passnumber)) { +// Log.e("TIAOSHI###", "关注数小于等于设定的取关数结束任务"); +// ToastUtils.showShort("关注数小于等于设定的取关数结束任务"); +// AblStepHandler.getInstance().setStop(true); +// // AblViewUtil.onMessage("停止"); +// return; +// } //点击进入用户关注页 AblViewUtil.mySleep(2); - AblService.getInstance().clickcommontwo(child3, "进入用户关注页"); + AblService.getInstance().clickPoint(653, 464, 300); + // AblService.getInstance().clickcommontwo(child3, "进入用户关注页"); AblStepHandler.sendMsg(AblSteps.STEP_13); break; case AblSteps.STEP_13: @@ -83,7 +93,14 @@ public class TestAblStep6 extends BaseAblStep { String[] all = num1.split(" "); String num22 = all[1]; Log.e("TIAOSHI###", "获得的关注数==" + num22); - int num2 = Integer.parseInt(num22); + 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 = Integer.parseInt(num22); + } + if (num2 > numb) { // AblViewUtil.mySleep(1); cancelGuanzhu(AblService.getInstance()); @@ -194,19 +211,25 @@ public class TestAblStep6 extends BaseAblStep { // nodeZuobiao(child2); for (int x = 0; x < child2.getChildCount(); x++) { AccessibilityNodeInfo child3 = child2.getChild(x); -// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); + Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); // 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()); + 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); - yiguanzhu(child5); - } - } +// 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); + } + } + // } + // } } } } @@ -235,7 +258,14 @@ 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) { + child.getBoundsInScreen(rect); + if (rect.top <= 2100) { + clickcommontwo(child, "已关注"); + } + } } } } @@ -257,7 +287,16 @@ 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) { + childw.getBoundsInScreen(rect); + if (rect.top <= 2100) { + clickcommontwo(childw, "互相关注"); + } + } + + AblViewUtil.mySleep(2); AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); clickcommontwo(quxiao, "取消关注"); @@ -353,23 +392,12 @@ public class TestAblStep6 extends BaseAblStep { 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()); + Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); for (int y = 0; y < child.getChildCount(); y++) { AccessibilityNodeInfo child1 = child.getChild(y); if (child1 != null) { - // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); + Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); if (child1.getText() != null) { -// if (child1.getText().equals("获赞")) { -// AccessibilityNodeInfo parent = child1.getParent(); -// AccessibilityNodeInfo child3 = parent.getChild(1); -// if (child3.getText() != null) { -// Log.e("TIAOSHI###", "获得的获赞数==" + child3.getText().toString()); -// huozannum = child3.getText().toString(); -// if (child3.getText().toString().equals("-")) { -// Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。"); -// } -// } -// } if (child1.getText().equals("关注")) { AccessibilityNodeInfo parent = child1.getParent(); child3 = parent.getChild(1); @@ -382,18 +410,6 @@ public class TestAblStep6 extends BaseAblStep { } } } -// if (child1.getText().equals("粉丝")) { -// AccessibilityNodeInfo parent = child1.getParent(); -// AccessibilityNodeInfo child3 = parent.getChild(1); -// if (child3.getText() != null) { -// Log.e("TIAOSHI###", "获得的粉丝数==" + child3.getText().toString()); -// fensinum = child3.getText().toString(); -// if (child3.getText().toString().equals("-")) { -// Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。"); -// } -// } -// return; -// } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java index b6b42b4..79be3e8 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java @@ -136,8 +136,14 @@ public class TestAblStepXin5 extends BaseAblStep { AblStepHandler.sendMsg(AblSteps.STEP_31); return; } - //如果有查看详情,则滑动到下一个视频 - zhijieshanghua(); + boolean nodeInfoh = ifGaunzhu(); + if(nodeInfoh){ + Log.e("TIAOSHI###", "此视频没有关注过"); + }else { + Log.e("TIAOSHI###", "此视频已关注"); + AblStepHandler.sendMsg(AblSteps.STEP_31); + return; + } } AblStepHandler.sendMsg(AblSteps.STEP_29); @@ -664,65 +670,6 @@ public class TestAblStepXin5 extends BaseAblStep { } - /** - * 直接上滑 - */ - private void zhijieshanghua() { - AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); - if (rootttt != null) { - for (int j = 0; j < rootttt.getChildCount(); j++) { - AccessibilityNodeInfo child = rootttt.getChild(j); - // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); - //if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { - // Log.e("TIAOSHI###ViewPager", "----2Node:" + child.getChildCount()); - for (int y = 0; y < child.getChildCount(); y++) { - AccessibilityNodeInfo child1 = child.getChild(y); - // Log.e("TIAOSHI###", "----2Node:" + child1.getClassName() + ":" + child1.getText()); - - for (int x = 0; x < child1.getChildCount(); x++) { - AccessibilityNodeInfo child6 = child1.getChild(x); - // Log.e("TIAOSHI###", "----3Node:" + child6.getClassName() + ":" + child6.getText()); - for (int z = 0; z < child6.getChildCount(); z++) { - AccessibilityNodeInfo child7 = child6.getChild(z); - // Log.e("TIAOSHI###", "----4Node:" + child7.getClassName() + ":" + child7.getText()); - for (int r = 0; r < child7.getChildCount(); r++) { - AccessibilityNodeInfo child2 = child7.getChild(r); - // Log.e("TIAOSHI###", "----5Node:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); - - for (int m = 0; m < child2.getChildCount(); m++) { - AccessibilityNodeInfo child3 = child2.getChild(m); - // Log.e("TIAOSHI###", "----6Node:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - for (int p = 0; p < child3.getChildCount(); p++) { - AccessibilityNodeInfo child9 = child3.getChild(p); - // Log.e("TIAOSHI###", "----7Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); - if (child9.getText() != null) { - if (child9.getText().toString().equals("查看详情")) { - //直接上滑 - Log.e("TIAOSHI###", "有查看详情的广告,直接滑动到下一个视频"); -// AblService.getInstance().randomSwipetwo(); -// AblViewUtil.mySleep(5); - AblStepHandler.sendMsg(AblSteps.STEP_31); - return; - } - } - } - - } - - } - } - } - - // } - } - } - } else { - Log.e("TIAOSHI###", "节点为null,直接滑动到下一个视频"); - AblStepHandler.sendMsg(AblSteps.STEP_31); - } - } - - /** * 抖音加粉托管账号每日数据统计 * E/TIAOSHI###: 0取消关注