diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 8f32900..2fbfd9c 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -5,14 +5,14 @@ - - - - - - - - + + + + + + + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index dbf0c76..22956b0 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,7 +4,7 @@ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6560a98 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 892046b..d804014 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,17 @@ - + + + + diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 10e2eda..847c853 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -86,6 +86,10 @@ this.android.sourceSets { } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.3.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' // 循环引入第三方库 app_dependencies.each {k, v -> @@ -129,4 +133,3 @@ dependencies { } } - diff --git a/app/fuzhu.jks b/app/fuzhu.jks deleted file mode 100644 index 5c1d6f4..0000000 Binary files a/app/fuzhu.jks and /dev/null differ diff --git a/app/release/atom-latest.apk b/app/release/atom-latest.apk deleted file mode 100644 index d83a047..0000000 Binary files a/app/release/atom-latest.apk and /dev/null differ diff --git a/app/release/output.json b/app/release/output.json deleted file mode 100644 index 86eb96e..0000000 --- a/app/release/output.json +++ /dev/null @@ -1 +0,0 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":171,"versionName":"1.7.1","enabled":true,"outputFile":"atom-latest.apk","fullName":"release","baseName":"release"},"path":"atom-latest.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/androidTest/java/com/xiangxue/new_modular_customarouter/test2.java b/app/src/androidTest/java/com/xiangxue/new_modular_customarouter/test2.java index 328649e..388065d 100644 --- a/app/src/androidTest/java/com/xiangxue/new_modular_customarouter/test2.java +++ b/app/src/androidTest/java/com/xiangxue/new_modular_customarouter/test2.java @@ -22,9 +22,8 @@ public class test2 { @Test public void onCreate() { - int i = Integer.parseInt("0"); - Log.e("TIAOSHI###", i+""); - // gaizaotime("关注 389"); + + gaizaotime("关注 389"); } private void gaizaotime(String end_time) { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 759bad7..db8d47f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,9 @@ + + @@ -55,9 +57,11 @@ - - - - - - - + + + + @@ -101,7 +106,9 @@ android:name=".activity.PublishActivity" android:theme="@style/ActivityDialog" /> - + @@ -122,7 +129,6 @@ - CommentBeanDatas = commentDao.queryInByCustom("type", "3"); + if (CommentBeanDatas.size() == 0) { + return "哈哈"; + } else if (CommentBeanDatas.size() == 1) { + CommentBeanData commentBeanData = CommentBeanDatas.get(0); + String comment = commentBeanData.getComment(); + return comment; + } else { + int i = new Random().nextInt(CommentBeanDatas.size() - 1); + CommentBeanData commentBeanData = CommentBeanDatas.get(i); + String comment = commentBeanData.getComment(); + return comment; + } + } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java index 3092b08..ac97c85 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java @@ -302,9 +302,7 @@ public class AblSteps { public final static int STEP_257 = 257; public final static int STEP_258 = 258; public final static int STEP_259 = 259; - - - /*****************************************/ + /**************************************/ public final static int STEP_260 = 260; public final static int STEP_261 = 261; public final static int STEP_262 = 262; @@ -313,6 +311,6 @@ public class AblSteps { public final static int STEP_265 = 265; public final static int STEP_266 = 266; public final static int STEP_267 = 267; - public final static int STEP_268 = 268; - public final static int STEP_269 = 269; + + } 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 be31130..e10ca27 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java @@ -9,10 +9,8 @@ import androidx.annotation.RequiresApi; import com.fisherbone.fuzhu.ChangLiang; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; -import com.fisherbone.fuzhu.entity.MessageBean; import com.fisherbone.fuzhu.okgonet.HttpConstants; import com.fisherbone.fuzhu.okgonet.NetApi; -import com.jeremyliao.liveeventbus.LiveEventBus; import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.Response; @@ -31,62 +29,25 @@ 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###", "点击了我按钮"); } - public void DianSou() { - - //华为畅享20 - AblService.getInstance().clickPoint(990, 163, 300); - switch (ChangLiang.phonetype) { - case "0": - //红米7a - AblService.getInstance().clickPoint(656, 99, 300); - break; - case "1": - //华为畅享20 - AblService.getInstance().clickPoint(659, 99, 300); - break; - case "2": - //华为畅享20 - AblService.getInstance().clickPoint(990, 163, 300); - break; - case "3": - //note9 - AblService.getInstance().clickPoint(990, 163, 300); - break; - default: - } - Log.e("TIAOSHI###", "点击搜索按钮"); - } - - /** - * 开启运行倒计时 - * - * @param type 任务类型 5.大v粉丝 6.抢红包 - * @param davruntime 倒计时 - */ - public void TurnCount(String type, int davruntime) { - MessageBean messageBean = new MessageBean(); - messageBean.setFromtype(type); - messageBean.setRuntime(davruntime); - LiveEventBus.get("task_runtime").post(messageBean); - } /** * 查看节点的坐标点 */ - 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 +57,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,16 +80,15 @@ 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); } @@ -136,16 +96,15 @@ 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); @@ -155,10 +114,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); @@ -167,16 +126,15 @@ 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); @@ -185,16 +143,15 @@ 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); @@ -203,16 +160,15 @@ 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); @@ -221,16 +177,15 @@ 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, "同意"); @@ -239,25 +194,201 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { } } + /** + * 我们才能继续为你提供服务 + * @param instance + */ + public void fuwuDialog(AblService instance) { + //处理我知道了的弹框 + AccessibilityNodeInfo zhidao = AblViewUtil.findByText("我们才能继续为你提供服务", 0); + if(zhidao==null){ + Log.e("TIAOSHI###", "没有找到我们才能继续为你提供服务的弹窗" ); + }else { + Log.e("TIAOSHI###", "弹出了我们才能继续为你提供服务的弹窗" ); + List list = AblViewUtil.findByText("同意并继续"); + for (AccessibilityNodeInfo item : list) { + clickcommontwo(item, "同意并继续"); + } + AblViewUtil.mySleep(1); + } + } + /** + * 访问以下权限吗 + * @param instance + */ + public void quanxianDialog(AblService instance) { + //处理我知道了的弹框 + AccessibilityNodeInfo zhidao = AblViewUtil.findByText("访问以下权限吗", 0); + if(zhidao==null){ + Log.e("TIAOSHI###", "没有找到访问以下权限吗的弹窗" ); + }else { + Log.e("TIAOSHI###", "弹出了访问以下权限吗的弹窗" ); + List list = AblViewUtil.findByText("始终允许"); + for (AccessibilityNodeInfo item : list) { + clickcommontwo(item, "始终允许"); + } + AblViewUtil.mySleep(1); + } + } + + + /** + * 关闭地理位置信息弹框 + * @param instance + */ + public void closedDDialog(AblService instance) { + //处理我知道了的弹框 + AccessibilityNodeInfo zhidao = AblViewUtil.findByText("地理位置信息", 0); + if(zhidao==null){ + Log.e("TIAOSHI###", "没有找到地理位置信息的弹窗" ); + }else { + Log.e("TIAOSHI###", "弹出了检测到地理位置信息的弹窗" ); + AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("取消", 0); + AblService.getInstance().clickcommontwo(zaishuo, "取消"); + AblViewUtil.mySleep(1); + } + } + + /** + * 关闭地理位置=授权弹框 + * @param instance + */ + public void closedSDialog(AblService instance) { + //处理我知道了的弹框 + AccessibilityNodeInfo zhidao = AblViewUtil.findByText("地理位置授权", 0); + if(zhidao==null){ + Log.e("TIAOSHI###", "没有找到地理位置授权的弹窗" ); + }else { + Log.e("TIAOSHI###", "弹出了检测到地理位置授权的弹窗" ); + AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("不允许", 0); + AblService.getInstance().clickcommontwo(zaishuo, "不允许"); + AblViewUtil.mySleep(1); + } + } /** * 关闭个人信息保护指引 - * * @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); } } + /** + * 寻找控件 + */ + public void getNodeInfo() { + 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); + for (int y = 0; y < child.getChildCount(); y++) { + AccessibilityNodeInfo child1 = child.getChild(y); + + Rect rect = new Rect(); + child1.getBoundsInScreen(rect); + if (rect.left >0&& rect.left<1080) { + 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); +// 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); +// 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()); +// for (int t = 0; t < child6.getChildCount();t++) { +// AccessibilityNodeInfo child7 = child6.getChild(t); +// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription()); +// for (int q = 0; q < child7.getChildCount();t++) { +// AccessibilityNodeInfo child8 = child7.getChild(q); +// Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText()+ ":" + child8.getContentDescription()); +// +// } +// } +// } +// } +// } +// } +// } + } + } + } + + + /** + * 寻找控件 + */ + public void getNodeInfoh() { + 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); + 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); + 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); +// 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()); +// for (int t = 0; t < child6.getChildCount();t++) { +// AccessibilityNodeInfo child7 = child6.getChild(t); +// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription()); +// for (int q = 0; q < child7.getChildCount();t++) { +// AccessibilityNodeInfo child8 = child7.getChild(q); +// Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText()+ ":" + child8.getContentDescription()); +// +// } +// } +// } +// } +// } + } + } + } + } + } @RequiresApi(api = Build.VERSION_CODES.N) public void clickNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo, String s) { if (accessibilityNodeInfo != null) { @@ -271,6 +402,8 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { } + + protected void againStart(String str) { final HttpParams paramsPost = new HttpParams(); paramsPost.put("task_status", str); @@ -300,13 +433,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; } @@ -315,7 +448,6 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { return flag; } - /** * 当前页面如果有切换账号和管理,说明账号切换任务运行正常 */ @@ -326,18 +458,17 @@ 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; } - /** * 当前页面是否在我的页面 */ @@ -359,182 +490,21 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { public boolean allowed() { boolean ifOpen = false; AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); - 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()); - if ("android.widget.TextView".equals(child.getClassName())) { - if (child.getText() != null) { - if (child.getText().toString().contains("正在尝试开启") || child.getText().toString().contains("是否允许")) { - int childCount = root.getChildCount(); - AccessibilityNodeInfo child1 = root.getChild(childCount - 1); - clickNodeInfo(child1, "点击了允许"); - } + 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.TextView".equals(child.getClassName())) { + if(child.getText()!=null) { + if (child.getText().toString().contains("正在尝试开启") || child.getText().toString().contains("是否允许")) { + int childCount = root.getChildCount(); + AccessibilityNodeInfo child1 = root.getChild(childCount - 1); + clickNodeInfo(child1, "点击了允许"); } - ifOpen = true; } + ifOpen = true; } } return ifOpen; } - - /** - * 选择搜索的分类 - * 1为用户 2为直播 - */ - public void selecttype(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() + ":" + child3.getContentDescription()); -// nodeZuobiao(child3); - 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; - default: - } - } - } - } - } - } - - /** - * 抖音顶部搜索框搜索输入框 - */ - public AccessibilityNodeInfo findEditText() { - AccessibilityNodeInfo infooos = null; - AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); - for (int j = 0; j < rootttt.getChildCount(); j++) { - AccessibilityNodeInfo child = rootttt.getChild(j); - // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); - 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); - if ("android.widget.EditText".equals(child1.getClassName())) { - infooos = child1; - } - } - } - return infooos; - } - - /** - * 寻找控件 - */ - public void getNodeInfoh() { - 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); - 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); - 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); - 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()); -// for (int t = 0; t < child6.getChildCount();t++) { -// AccessibilityNodeInfo child7 = child6.getChild(t); -// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription()); -// for (int q = 0; q < child7.getChildCount();t++) { -// AccessibilityNodeInfo child8 = child7.getChild(q); -// Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText()+ ":" + child8.getContentDescription()); -// -// } -// } - } - } - } - } - } - } - } - } - /** - * 是否关注过 (判断的准确率在百分之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/abllib/RandumInt.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java index ef7218c..524faba 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java @@ -17,10 +17,6 @@ public class RandumInt { return new Random().nextInt(15)+1; } public static int getRandumInt40(){ - return new Random().nextInt(40)+40; - } - - public static int getRandumInt10(){ - return new Random().nextInt(15)+10; + return new Random().nextInt(95)+40; } } \ No newline at end of file diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java index ec82473..96c3987 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java @@ -68,7 +68,25 @@ public class AblUtil { } } - + /** + * 添加悬浮界面(取关) + * + * @param context + * @param view + */ + public static void addSuspensionWindowViewtwo(Context context, View view) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (Settings.canDrawOverlays(context)) { + addSuspensionView(context, view); + addWinEntity.cancleisopen=true; + } else { + ToastUtils.showShort("请先开启允许显示在其他应用上权限"); + AblUtil.openDrawOverlaysAnth(context); + } + } else { + addSuspensionView(context, view); + } + } /** * 添加悬浮界面 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 20c3baa..379425f 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 @@ -252,7 +252,6 @@ public class AblViewUtil { } - /** * x轴居中竖直滑动屏幕 * @@ -449,57 +448,6 @@ public class AblViewUtil { } - /** - * 判断当前页面是否包含某文本 - */ - 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 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; - } - - /** - * 查看节点的坐标点 - */ - public static void nodeZuobiao(AccessibilityNodeInfo nodeinfo){ - Rect rect = new Rect(); - nodeinfo.getBoundsInScreen(rect); - Log.e("TIAOSHI###", "----显示节点的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")"); - - } /** * @param @@ -541,6 +489,8 @@ public class AblViewUtil { /** + * + * @param nikename 方法内字符串变量 * @param child1 * @param numt 上坐标点 @@ -572,6 +522,11 @@ public class AblViewUtil { infoMessag.mesagesuccess(str); } + public static void mesagefinish(String str){ + infoMessag.mesagefinish(str); + } + + public static void zhuanghaoMessage(String str){ infoMessag.mesagezhuang(str); } diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java index 1861bfb..b8d6c74 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java @@ -73,7 +73,22 @@ public class CancleFollowActivity extends BaseActivity { } if(!addWinEntity.cancleisopen){ - EventBus.getDefault().post(new FourEvent("success","2")); + //下面两个步骤不能同时执行 + //取消已关 + if (ChangLiang.cancelclosed&&!ChangLiang.cancelcrosscor) { + Log.e("TIAOSHI###==发送的一键取关参数", "执行取消已关"); + EventBus.getDefault().post(new FourEvent("success","2")); + } + //取消互关 + if (ChangLiang.cancelcrosscor&&!ChangLiang.cancelclosed) { + Log.e("TIAOSHI###==发送的一键取关参数", "执行取消互关"); + EventBus.getDefault().post(new FourEvent("success","2")); + } + + if(ChangLiang.cancelclosed&&ChangLiang.cancelcrosscor){ + Log.e("TIAOSHI###==发送的一键取关参数", "执行取消互关"); + EventBus.getDefault().post(new FourEvent("success","2")); + } } } }); diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java b/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java index 209dd92..809ef1b 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java @@ -14,10 +14,11 @@ import com.fisherbone.fuzhu.R; import com.fisherbone.fuzhu.abllib.AblStepHandler; import com.fisherbone.fuzhu.abllib.AblSteps; import com.fisherbone.fuzhu.abllib.utils.AblUtil; +import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; import com.fisherbone.fuzhu.databinding.ViewTestBinding; import com.fisherbone.fuzhu.entity.ControlBean; import com.fisherbone.fuzhu.entity.addWinEntity; -import com.fisherbone.fuzhu.step.TestAblStep24; +import com.fisherbone.fuzhu.quzan.AblStep1; import com.fisherbone.fuzhu.step.TestAblStep30; import com.fisherbone.fuzhu.step.TestAblStep34; import com.fisherbone.fuzhu.step.TestAblStep6; @@ -63,7 +64,7 @@ public class ControlWindow { binding = DataBindingUtil.inflate(inflater, R.layout.view_test, null, false); controlBean = new ControlBean(); controlBean.setContent(""); - controlBean.setPhonetype(Integer.valueOf(ChangLiang.phonetype)); + controlBean.setPhonetype(Integer.parseInt(ChangLiang.phonetype)); binding.setControlBean(controlBean); stutas(true); binding.image01.setBackgroundResource(R.mipmap.icon_bianzu); @@ -79,14 +80,15 @@ public class ControlWindow { if (AblUtil.isAccessibilityServiceOpen(mContext)) { AblStepHandler.getInstance().initStepClass(new TestAblStep6()); stutas(ChangLiang.isrun); - AblStepHandler.sendMsg(AblSteps.STEP_11); + AblStepHandler.sendMsg(AblSteps.STEP_11); } else { ToastUtils.showShort("点到了"); ToastUtils.showShort("请先开启辅助服务"); AblUtil.openAccessibilitySettings(); } break; - case "3"://执行幢号任务 + case "3": + //执行幢号任务 if (ChangLiang.if_quguan.equals("0")) { stutas(ChangLiang.isrun); ChangLiang.zishuodong = "T"; @@ -97,7 +99,8 @@ public class ControlWindow { AblStepHandler.sendMsg(AblSteps.STEP_70); } break; - case "4"://帐号登录任务 + case "4": + //帐号登录任务 stutas(ChangLiang.isrun); AblStepHandler.sendMsg(AblSteps.STEP_90); break; @@ -119,19 +122,21 @@ public class ControlWindow { break; //大V粉丝截流 case "61": - AblStepHandler.getInstance().initStepClass(new TestAblStep24()); stutas(ChangLiang.isrun); AblStepHandler.sendMsg(AblSteps.STEP_130); break; - case "7"://潜在客户加关(大咖) + case "7": + //潜在客户加关(大咖) stutas(ChangLiang.isrun); AblStepHandler.sendMsg(AblSteps.STEP_170); break; - case "8"://潜在客户加关(关键词) + case "8": + //潜在客户加关(关键词) stutas(ChangLiang.isrun); AblStepHandler.sendMsg(AblSteps.STEP_160); break; - case "9"://粉丝通知 + case "9": + //粉丝通知 stutas(ChangLiang.isrun); String lettertype = ProfileSpUtils.getInstance().getFensiNotice().getLettertype(); Log.e("类型", lettertype); @@ -165,6 +170,18 @@ public class ControlWindow { //直播间抢红包 case "15": + break; + case "16": + //取赞 + if (AblUtil.isAccessibilityServiceOpen(mContext)) { + AblStepHandler.getInstance().initStepClass(new AblStep1()); + stutas(ChangLiang.isrun); + AblStepHandler.sendMsg(AblSteps.STEP_260); + } else { + ToastUtils.showShort("点到了"); + ToastUtils.showShort("请先开启辅助服务"); + AblUtil.openAccessibilitySettings(); + } break; default: Log.e("TIAOSHI###", "执行的功能类型不匹配"); @@ -265,6 +282,16 @@ public class ControlWindow { break; case "15"://直播间抢红包 + break; + case "16"://取赞 + if (AblUtil.isAccessibilityServiceOpen(mContext)) { + stutas(ChangLiang.isrun); + AblStepHandler.sendMsg(AblSteps.STEP_260); + } else { + ToastUtils.showShort("点到了"); + ToastUtils.showShort("请先开启辅助服务"); + AblUtil.openAccessibilitySettings(); + } break; default: Log.e("TIAOSHI###", "执行的功能类型不匹配"); @@ -328,7 +355,6 @@ public class ControlWindow { * 退出悬浮窗 */ public void closedWin(){ - Log.e("TIAOSHI###", "退出悬浮窗执行了"); WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); windowManager.removeView(binding.getRoot()); addWinEntity.isopen = false; diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java index 88f76ed..ce7031a 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java @@ -45,6 +45,14 @@ public class DavActivity extends BaseActivity { mTitleBar = (TitleBar) findViewById(R.id.title_bar); mTitleBar.setTitle("大V粉丝截流"); initNormalBack(); + commentDao = new CommentDao(DavActivity.this); + //给数据库插入十条默认数据 + ArrayList commentBeanData = commentDao.queryAll(); + if(commentBeanData.size()==0) { + Log.e("ceshi","添加了数据"); + madeData(); + } + binding.rlStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -105,4 +113,18 @@ public class DavActivity extends BaseActivity { }); } + + private void madeData() { + String JsonData = new GetJsonDataUtil().getJson(DavActivity.this, "huashu.json");//获取assets目录下的json文件数据 + HusshuBean resultt = JsonUtils.fromJson(JsonData, HusshuBean.class); + List data = resultt.getData(); + for (int i = 0; i < data.size(); i++) { + CommentBeanData commentBeanData = data.get(i); + if (null != commentDao.queryByCustom("Id", commentBeanData.getId()) && commentDao.queryByCustom("Id", commentBeanData.getId()).size() > 0) { + commentDao.updateData(commentBeanData); + } else { + commentDao.addInsert(commentBeanData); + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java index 05f0a86..cf403c4 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java @@ -43,10 +43,45 @@ public class HongBaoActivity extends BaseActivity { .subscribe(new Consumer() { @Override public void accept(Object o) throws Exception { + // daojishitwo(Integer.parseInt(redEnvBean.getRuntime()) * 60); ProfileSpUtils.getInstance().saveRedEnvBean(redEnvBean); EventBus.getDefault().post(new FourEvent("success", "10")); } }); } + /** + * 模拟结束任务 + * + * @param a + */ + private void daojishitwo(final int a) { + + //启动计时器 + //从0开始发射11个数字为:0-10依次输出,延时0s执行,每1s发射一次。 + Disposable mdDisposable = Flowable.intervalRange(0, a + 1, 0, 1, TimeUnit.SECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .doOnNext(new Consumer() { + @Override + public void accept(Long aLong) throws Exception { + long b = a - aLong; + long c = 0 + aLong; + Log.w("TIAOSHI###运行剩余时长", b + ""); + runLog("任务运行时长"+c+"s"); + } + }) + .doOnComplete(new Action() { + @Override + public void run() throws Exception { + Log.e("TIAOSHI###", "运行时间已到,停止自动加关"); + runLog("任务运行即将结束"); + + } + }) + .subscribe(); + } + public void runLog(String str) { + LiveEventBus.get("some_key").post(str); + Log.e("TIAOSHI###", str); + } } \ No newline at end of file diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/MainActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/MainActivity.java index e3b2522..3b4dbef 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/MainActivity.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/MainActivity.java @@ -1,7 +1,6 @@ package com.fisherbone.fuzhu.activity; import android.Manifest; -import android.accessibilityservice.AccessibilityServiceInfo; import android.app.Activity; import android.app.ActivityManager; import android.content.ComponentName; @@ -10,7 +9,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.pm.PackageManager; -import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -18,7 +16,6 @@ import android.os.IBinder; import android.provider.Settings; import android.util.Log; import android.view.View; -import android.view.accessibility.AccessibilityManager; import android.widget.PopupWindow; import android.widget.TextView; @@ -51,7 +48,6 @@ import com.fisherbone.fuzhu.db.dao.daoutil; import com.fisherbone.fuzhu.db.zhuanghaoBeanData; import com.fisherbone.fuzhu.entity.FourEvent; import com.fisherbone.fuzhu.entity.HusshuBean; -import com.fisherbone.fuzhu.entity.MessageBean; import com.fisherbone.fuzhu.entity.PotCusBean; import com.fisherbone.fuzhu.entity.SixEvent; import com.fisherbone.fuzhu.entity.UrgentTaskBean; @@ -60,6 +56,7 @@ import com.fisherbone.fuzhu.entity.letterListBean; import com.fisherbone.fuzhu.entity.touchTaskBean; import com.fisherbone.fuzhu.okgonet.HttpConstants; import com.fisherbone.fuzhu.okgonet.NetApi; +import com.fisherbone.fuzhu.quzan.AblStep1; import com.fisherbone.fuzhu.reflect.InjectUtils; import com.fisherbone.fuzhu.reflect.OnClickk; import com.fisherbone.fuzhu.step.TestAblStep0; @@ -190,20 +187,8 @@ public class MainActivity extends BaseActivity implements InfoMessage { ChangLiang.phonetype = "1"; } - - - Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu/com.fisherbone.fuzhu.abllib.AblService"); Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "1");//1表示开启 - if (AblUtil.isAccessibilityServiceOpen(MainActivity.this)) { - // Log.e("TIAOSHI###", "无障碍服务正常"); - ToastUtils.showShort( "无障碍服务正常"); - }else { - ToastUtils.showShort( "无障碍服务异常"); - Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu/com.fisherbone.fuzhu.abllib.AblService"); - Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 - } - ChangLiang.task_id = "";//当前执行任务id ChangLiang.id = "";//当前执行任务功能id ChangLiang.task_type = "";//当前执行任务类型 @@ -269,13 +254,6 @@ public class MainActivity extends BaseActivity implements InfoMessage { } } }); - LiveEventBus.get("task_runtime", MessageBean.class).observe(this, new Observerlife() { - @Override - public void onChanged(Object o) { - MessageBean mesg = (MessageBean) o; - taskDaojishi(mesg.getRuntime(),mesg); - } - }); InjectUtils.injectEvent(this); requestVersion(); @@ -307,7 +285,7 @@ public class MainActivity extends BaseActivity implements InfoMessage { .setFindViewMillisInFuture(10000)//寻找界面超时时间 .setFindViewCountDownInterval(200)//寻找界面间隔时间 .build().init(); - AblStepHandler.getInstance().initStepClass(new TestAblStep0(), new TestAblStep1(), new TestAblStep2(), new TestAblStep8(), new TestAblStep9(), new TestAblStep10(), new TestAblStep12(), new TestAblStep13(), new TestAblStep18(), new TestAblStep19(), new TestAblStep23(), new TestAblStep25(), new TestAblStep26(), new TestAblStep27(), new TestAblStep28(), new TestAblStep29(), new TestAblStep31(), new TestAblStep32(), new TestAblStep33()); + AblStepHandler.getInstance().initStepClass(new TestAblStep0(), new TestAblStep1(), new TestAblStep2(), new TestAblStep8(), new TestAblStep9(), new TestAblStep10(), new TestAblStep12(), new TestAblStep13(), new TestAblStep18(), new TestAblStep19(), new TestAblStep23(), new TestAblStep24(), new TestAblStep25(), new TestAblStep26(), new TestAblStep27(), new TestAblStep28(), new TestAblStep29(), new TestAblStep31(), new TestAblStep32(), new TestAblStep33(), new AblStep1()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int hasWriteContactsPermission = checkSelfPermission(Manifest.permission.READ_CONTACTS); if (hasWriteContactsPermission != PackageManager.PERMISSION_GRANTED) { @@ -353,7 +331,7 @@ public class MainActivity extends BaseActivity implements InfoMessage { } - @OnClickk({R.id.rl_05, R.id.rl_12, R.id.rl_011, R.id.rl_10, R.id.rl_09, R.id.rl_08, R.id.rl_07, R.id.rl_06, R.id.rl_04, R.id.rl_03, R.id.rl_01, R.id.rl_02}) + @OnClickk({R.id.rl_05, R.id.rl_12, R.id.rl_011, R.id.rl_10, R.id.rl_09, R.id.rl_08, R.id.rl_07, R.id.rl_06, R.id.rl_04, R.id.rl_03, R.id.rl_01, R.id.rl_02 , R.id.rl_16}) public void click(View view) { if(ProfileSpUtils.getInstance().getSetBean().isRedswitchone()){ ToastUtils.showShort( "请关闭云端控制"); @@ -394,7 +372,14 @@ public class MainActivity extends BaseActivity implements InfoMessage { JumpUtils.gotoActivity(MainActivity.this, RecFollowActivity.class, false, "", ""); // JumpUtils.gotoActivity(MainActivity.this, MainActivityy.class, false, "", ""); break; + case R.id.rl_16: + JumpUtils.gotoActivity(MainActivity.this,CancelThumbUpActivity.class, false, "", ""); + break; case R.id.rl_02: +// Settings.Secure.putString(getContentResolver(), +// Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu.abllib/AblService"); +// Settings.Secure.putString(getContentResolver(), +// Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 // service.stopSelf(); // CrashReport.testJavaCrash(); @@ -473,12 +458,11 @@ public class MainActivity extends BaseActivity implements InfoMessage { UpdateTuoguan("1"); } else if (toastMsg.contains("账号下线")) { UpdateTuoguan("1"); - }else if(toastMsg.contains("已切换到")){ - UpdateTuoguan("0"); - } - else if(toastMsg.contains("由于该用户隐私设置,粉丝列表不可见")){ + } else if (toastMsg.contains("粉丝列表不可见")) { AblStepHandler.getInstance().setStop(true); AblViewUtil.onMessage("停止"); + }else if(toastMsg.contains("已切换到")){ + UpdateTuoguan("0"); } } } @@ -538,6 +522,8 @@ public class MainActivity extends BaseActivity implements InfoMessage { case "10": execute("5"); break; + case "11": + execute("16"); default: } } @@ -578,17 +564,20 @@ public class MainActivity extends BaseActivity implements InfoMessage { } else { Log.e("TIAOSHI###", "无障碍服务异常"); Settings.Secure.putString(getContentResolver(), - Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu/com.fisherbone.fuzhu.abllib.AblService"); + Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu.abllib/AblService"); Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 + AblService.getInstance().disableSelf(); againStart("0"); } boolean destroy = isDestroy(MainActivity.this); if(destroy) { Log.e("TIAOSHI###", "MainActivity已经被销毁"); closeService(); - Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu/com.fisherbone.fuzhu.abllib.AblService"); - Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 + Settings.Secure.putString(getContentResolver(), + Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu.abllib/AblService"); + Settings.Secure.putString(getContentResolver(), + Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 } } }).subscribe(new Observer() { @@ -702,10 +691,9 @@ public class MainActivity extends BaseActivity implements InfoMessage { @Override public void mesagesuccess(String str) { + if ("停止".equals(str)) { - if(mdDisposable!=null) { - mdDisposable.dispose(); - } + // mdDisposable.dispose(); AblStepHandler.getInstance().setStop(true); controlWindow.stutas(true); controlWindow.closedWin(); @@ -713,6 +701,20 @@ public class MainActivity extends BaseActivity implements InfoMessage { } } + /** + * 帐号登录回调 + * + * @param str + */ + @Override + public void mesagefinish(String str) { + if ("停止".equals(str)) { + mdDisposable.dispose(); + AblStepHandler.getInstance().setStop(true); + FinishTask(); + } + } + /** * 撞号任务完成的通知 * @@ -721,9 +723,7 @@ public class MainActivity extends BaseActivity implements InfoMessage { @Override public void mesagezhuang(String str) { if ("停止".equals(str)) { - if(mdDisposable!=null) { - mdDisposable.dispose(); - } + mdDisposable.dispose(); AblStepHandler.getInstance().setStop(true); touchResult(); controlWindow.stutas(true); @@ -744,11 +744,6 @@ public class MainActivity extends BaseActivity implements InfoMessage { AblStepHandler.getInstance().setStop(true); controlWindow.stutas(true); controlWindow.closedWin(); - AblViewUtil.mySleep(2); - AblStepHandler.getInstance().setStop(false); - Log.e("step###", "开始执行关闭抖音程序"); - AblStepHandler.sendMsg(192); - FinishTask(); } } @@ -756,14 +751,15 @@ public class MainActivity extends BaseActivity implements InfoMessage { @Override public void onDestroy() { super.onDestroy(); - Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu/com.fisherbone.fuzhu.abllib.AblService"); - Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 - if(mdDisposable!=null) { mdDisposable.dispose(); } EventBus.getDefault().unregister(this); closeService(); + Settings.Secure.putString(getContentResolver(), + Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu.abllib/AblService"); + Settings.Secure.putString(getContentResolver(), + Settings.Secure.ACCESSIBILITY_ENABLED, "0");//1表示开启 Log.e("TIAOSHI###", "执行了onDestroy"); killAppProcess(); @@ -1342,6 +1338,7 @@ public class MainActivity extends BaseActivity implements InfoMessage { { //注意:不能先杀掉主进程,否则逻辑代码无法继续执行,需先杀掉相关进程最后杀掉主进程 ActivityManager mActivityManager = (ActivityManager) MainActivity.this.getSystemService(Context.ACTIVITY_SERVICE); + // List mList = mActivityManager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : mList) { @@ -1353,62 +1350,4 @@ public class MainActivity extends BaseActivity implements InfoMessage { android.os.Process.killProcess(android.os.Process.myPid()); System.exit(0); } - - /** - * Check当前辅助服务是否启用 - *com.fisherbone.fuzhu/.abllib.AblService - * @param serviceName serviceName - * @return 是否启用 - */ - private boolean checkAccessibilityEnabled(String serviceName) { - AccessibilityManager mAccessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE); - List accessibilityServices = mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC); - for (AccessibilityServiceInfo info : accessibilityServices) { - Log.e("TIAOSHI###", "服务进程" + info.getId()); - if (info.getId().equals(serviceName)) { - return true; - } - } - return false; - } - - - /** - * 全局统一任务倒计时 - * - * @param a - */ - private void taskDaojishi(final int a,MessageBean mesg ) { - - //启动计时器 - //从0开始发射11个数字为:0-10依次输出,延时0s执行,每1s发射一次。 - mdDisposable = Flowable.intervalRange(0, a + 1, 0, 1, TimeUnit.SECONDS) - .observeOn(AndroidSchedulers.mainThread()) - .doOnNext(new Consumer() { - @Override - public void accept(Long aLong) throws Exception { - long b = a - aLong; - long c = 0 + aLong; - Log.e("TIAOSHI###运行剩余时长", b + ""); - LiveEventBus.get("run_time").post("任务已运行"+c/60+"分钟"); - } - }) - .doOnComplete(new Action() { - @Override - public void run() throws Exception { - switch (mesg.getFromtype()) { - case "5": - ChangLiang.dav_ishuadong = "F"; - AblViewUtil.potgegin("停止"); - break; - case "6": - LiveEventBus.get("some_key").post("任务运行即将结束"); - break; - - default: - } - } - }) - .subscribe(); - } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/StartTask.java b/app/src/main/java/com/fisherbone/fuzhu/activity/StartTask.java index b5c7bcf..9948d4a 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/StartTask.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/StartTask.java @@ -822,6 +822,7 @@ public class StartTask { @Override public void run() throws Exception { AblStepHandler.getInstance().setStop(false); + // StartExecution(MainActivity.this, AblSteps.STEP_109); Log.e("TIAOSHI###", "开始执行关闭抖音程序"); startExecution(mContext, AblSteps.STEP_192); } diff --git a/app/src/main/java/com/fisherbone/fuzhu/entity/MessageBean.java b/app/src/main/java/com/fisherbone/fuzhu/entity/MessageBean.java deleted file mode 100644 index e307ff4..0000000 --- a/app/src/main/java/com/fisherbone/fuzhu/entity/MessageBean.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fisherbone.fuzhu.entity; - -import com.j256.ormlite.field.DatabaseField; -import com.j256.ormlite.table.DatabaseTable; - -/** - * Time: 2020/8/28 - * Author: jianbo - * Description: - */ -public class MessageBean { - - public int getRuntime() { - return runtime; - } - - public void setRuntime(int runtime) { - this.runtime = runtime; - } - - private int runtime; - - public String getFromtype() { - return fromtype; - } - - public void setFromtype(String fromtype) { - this.fromtype = fromtype; - } - - private String fromtype; - -} diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java b/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java index 2d95a6a..c00769c 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java @@ -122,7 +122,7 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF * 进入第一个直播间 */ public void enterOneNodeInfo() { - AblService.getInstance().clickPoint(321, 379, 300); + AblService.getInstance().clickPoint(121, 379, 300); } 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 aa4c47f..1022245 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())) { @@ -509,6 +509,73 @@ class NoticeBase extends BaseAblStep { Log.e("TIAOSHI###", "点击搜索按钮"); } + /** + * 寻找搜索输入框 + */ + public AccessibilityNodeInfo findEditText() { + AccessibilityNodeInfo infooos = null; + AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); + for (int j = 0; j < rootttt.getChildCount(); j++) { + AccessibilityNodeInfo child = rootttt.getChild(j); + // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + 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); + if ("android.widget.EditText".equals(child1.getClassName())) { + infooos = child1; + } + } + } + return infooos; + } + + + /** + * 选择搜索的分类 + * 1为用户 2为直播 + */ + public void selecttype(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()); + + switch (type) { + case "1": + if ("android.widget.TextView".equals(child2.getClassName())) { + if (child2.getText() != null) { + if (child2.getText().toString().equals("用户")) { + AblService.getInstance().clickcommontwo(child2, ""); + } + } + } + break; + case "2": + if ("android.widget.TextView".equals(child2.getClassName())) { + if (child2.getText() != null) { + if (child2.getText().toString().equals("直播")) { + AblService.getInstance().clickcommontwo(child2, ""); + } + } + } + break; + default: + } + } + } + } + } + + /** * 说点什么节点 * @return @@ -554,7 +621,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.ImageView".equals(child.getClassName())) { + if ("android.widget.Button".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 05e8f9d..ade21c9 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -1,41 +1,27 @@ package com.fisherbone.fuzhu.step; -import android.accessibilityservice.AccessibilityService; -import android.accessibilityservice.GestureDescription; -import android.annotation.TargetApi; -import android.graphics.Path; import android.graphics.Rect; -import android.os.Build; import android.os.Message; import android.util.Log; import android.view.accessibility.AccessibilityNodeInfo; -import androidx.annotation.Nullable; - -import com.blankj.utilcode.util.ScreenUtils; -import com.fisherbone.fuzhu.ChangLiang; import com.fisherbone.fuzhu.abllib.AblService; import com.fisherbone.fuzhu.abllib.AblStepHandler; import com.fisherbone.fuzhu.abllib.AblSteps; import com.fisherbone.fuzhu.abllib.BaseAblStep; -import com.fisherbone.fuzhu.abllib.RandumInt; -import com.fisherbone.fuzhu.abllib.callback.GestureCallBack; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; +import com.fisherbone.fuzhu.db.DouyinBean; import com.fisherbone.fuzhu.entity.LiwuBean; -import com.fisherbone.fuzhu.utils.ProfileSpUtils; import com.google.gson.Gson; import java.util.ArrayList; import java.util.List; -import java.util.Random; /** * 获得作品时间 */ public class TestAblStep0 extends BaseAblStep { private String substring = "1000000";//当前的关注数 - public String IFCONTIAN = "x"; - private int liwusubstring; @Override public void onStep(int step, Message msg) { @@ -46,163 +32,50 @@ public class TestAblStep0 extends BaseAblStep { break; case AblSteps.STEP_2: - AblViewUtil.mySleep(5); - // getNodeInfoh(); - // cancelGuanzhu(AblService.getInstance()); - - int randumInt40 = RandumInt.getRandumInt40(); - zhibodianzanc(randumInt40); + AblViewUtil.mySleep(2); + // getNodeInfoh(); + // getNum(); + cancelGuanzhu(); break; default: } } - /** - * 直播间点赞 - *100-300 - * @param mun - */ - public void zhibodianzanc(int mun) { -// for (int i = 0; i < mun; i++) { -// int a = 640 + RandumInt.getRandumInt4() * 30; -// int b = 490; -// int c = 200 - RandumInt.getRandumInt4() * 20; -// AblService.getInstance().clickPoint(a, b, 100); -// try { -// //隔200 ms -// Thread.sleep(c); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// } - Random r = new Random(); - for (int i = 0; i < 10; i++) { - //r.nextInt(n) n为几 就产生0~n-1的随机数 - int num = r.nextInt(2)+1; - // System.out.print(num+"\t"); - Log.e("TIAOSHI###", num+""); - } - } /** - * 发送节点 + * 获得左上角主播的昵称 * @return */ - public AccessibilityNodeInfo geouyintdd() { - AccessibilityNodeInfo nodeinfo = null; + private String getNodeName() { + String nikename= ""; 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()); + // 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()); + // 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() + ":" + child1.getContentDescription()); + Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); + nodeZuobiao(child2); + //fourNode:android.widget.TextView:关注 389:关注 389,按钮 + //显示节点的坐标:(208,253),(375,308) 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: - } - } + Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); + nodeZuobiao(child3); + nikename = AblViewUtil.getString(nikename, child3, 253, 308, 208, 540, "android.widget.TextView"); } } } } + return nikename; } - - - - - private void cancelGuanzhu(AblService instance) { + private void cancelGuanzhu() { AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); @@ -218,24 +91,17 @@ public class TestAblStep0 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); - if("android.widget.RelativeLayout".equals(child3.getClassName())) { - for (int r = 0; r < child3.getChildCount(); r++) { - AccessibilityNodeInfo child4 = child3.getChild(r); - if("android.widget.FrameLayout".equals(child4.getClassName())) { - 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()); - for (int p = 0; p < child5.getChildCount(); p++) { - AccessibilityNodeInfo child6 = child5.getChild(p); - Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription()); -// nodeZuobiao(child5); -// yiguanzhu(child5); - } - } - } + 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); + yiguanzhu(child5); } } } @@ -243,84 +109,44 @@ public class TestAblStep0 extends BaseAblStep { } } } - // 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("已关注")) { +// 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; +// } +// } +// +// AblViewUtil.mySleep(1); +// if (child.getText() != null) { +// if (child.getText().toString().equals("已关注")) { +// clickcommontwo(child, "已关注"); +// } +// } +// +// } +// } + + 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; } } - 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(1); + if (childw.getText() != null) { + if (childw.getText().toString().equals("互相关注")) { + clickcommontwo(childw, "互相关注"); AblViewUtil.mySleep(2); AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); clickcommontwo(quxiao, "取消关注"); - AblViewUtil.mySleep(1); } } @@ -328,7 +154,6 @@ public class TestAblStep0 extends BaseAblStep { } } } - } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep12.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep12.java index 0f4979f..dec87a6 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep12.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep12.java @@ -176,7 +176,7 @@ public class TestAblStep12 extends BaseAblStep { AblService.getInstance().clickPoint(360, 399, 300); AblViewUtil.mySleep(5); Log.e("TIAOSHI###", "测试停止1"); - AblViewUtil.onMessage("停止"); + AblViewUtil.mesagefinish("停止"); break; case AblSteps.STEP_100://效验验证码是否正确 AccessibilityNodeInfo yazhenginfo = AblViewUtil.findByText("请输入验证码", 0); @@ -216,7 +216,7 @@ public class TestAblStep12 extends BaseAblStep { AblViewUtil.back(); AblViewUtil.mySleep(1); Log.e("TIAOSHI###", "测试停止4"); - AblViewUtil.onMessage("停止"); + AblViewUtil.mesagefinish("停止"); } break; @@ -295,7 +295,7 @@ public class TestAblStep12 extends BaseAblStep { AblViewUtil.back(); AblViewUtil.mySleep(1); Log.e("TIAOSHI###", "测试停止4"); - AblViewUtil.onMessage("停止"); + AblViewUtil.mesagefinish("停止"); } break; @@ -715,7 +715,7 @@ public class TestAblStep12 extends BaseAblStep { AblViewUtil.back(); AblViewUtil.mySleep(1); Log.e("TIAOSHI###", "测试停止3"); - AblViewUtil.onMessage("停止"); + AblViewUtil.mesagefinish("停止"); break; default: } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep18.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep18.java index 9df8680..da3fd09 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep18.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep18.java @@ -39,7 +39,7 @@ public class TestAblStep18 extends BaseAblStep { AblViewUtil.mySleep(2); AblService.getInstance().clickPoint(400, 1000, 300);//红米7a Log.e("TIAOSHI###", "停止关闭抖音任务"); - AblViewUtil.onMessage("停止"); + AblViewUtil.mesagefinish("停止"); } @Override @@ -62,7 +62,7 @@ public class TestAblStep18 extends BaseAblStep { } Log.e("TIAOSHI###", "停止关闭抖音任务"); - AblViewUtil.onMessage("停止"); + AblViewUtil.mesagefinish("停止"); } @Override diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep19.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep19.java index d514546..1d124af 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep19.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep19.java @@ -108,6 +108,19 @@ public class TestAblStep19 extends BaseAblStep { } + //点击右上角搜索 + //[624,67][688,131] + private void DianSou() { + + if (ChangLiang.phonetype.equals("0")) { + AblService.getInstance().clickPoint(656, 99, 300);//红米7a + } else { + AblService.getInstance().clickPoint(659, 922, 300);//华为畅享20 + } + Log.e("TIAOSHI###", "点击点赞按钮"); + } + + /** * 随机获取评论话术 */ @@ -129,6 +142,24 @@ public class TestAblStep19 extends BaseAblStep { } + + /** + * 寻找搜索输入框 + */ + private AccessibilityNodeInfo findEditText() { + AccessibilityNodeInfo infooos = null; + AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); + for (int j = 0; j < rootttt.getChildCount(); j++) { + AccessibilityNodeInfo child = rootttt.getChild(j); + Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + if ("android.widget.EditText".equals(child.getClassName())) { + infooos = child; + } + } + return infooos; + } + + /** * 列表第一条 */ diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep24.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep24.java index 8932f60..39ee248 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep24.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep24.java @@ -1,17 +1,22 @@ package com.fisherbone.fuzhu.step; -import android.graphics.Rect; +import android.accessibilityservice.AccessibilityService; +import android.accessibilityservice.GestureDescription; +import android.graphics.Path; +import android.os.Build; import android.os.Message; import android.util.Log; import android.view.accessibility.AccessibilityNodeInfo; +import androidx.annotation.RequiresApi; + import com.fisherbone.fuzhu.ChangLiang; import com.fisherbone.fuzhu.abllib.AblService; import com.fisherbone.fuzhu.abllib.AblStepHandler; import com.fisherbone.fuzhu.abllib.AblSteps; import com.fisherbone.fuzhu.abllib.BaseAblStep; +import com.fisherbone.fuzhu.abllib.RandumInt; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; -import com.fisherbone.fuzhu.utils.StringUtils; import java.util.ArrayList; import java.util.List; @@ -24,22 +29,24 @@ import java.util.List; public class TestAblStep24 extends BaseAblStep { private ArrayList objects = new ArrayList<>(); private AccessibilityNodeInfo child3; + private List accessibilityNodeInfos; private String guanzhunum; private String fensinum; - private String zuopinnum = ""; + private String zuopinnum; private String huozannum; @Override public void onStep(int step, Message msg) { + // Log.e("TIAOSHI###==获得一键取互相关注的参数",ChangLiang.cancelclosed+"---"+ChangLiang.cancelcrosscor+"---"+ChangLiang.passnumber+"---"+ChangLiang.swiinterval+"---"+ChangLiang.minthrthr+""); switch (step) { case AblSteps.STEP_130: AblViewUtil.startApplication(); objects.clear(); objects.add(ChangLiang.dav_douyinhao); - AblViewUtil.mySleep(10); + // objects.add("dyh48hvfd4yc"); + AblViewUtil.mySleep(3); AblStepHandler.sendMsg(AblSteps.STEP_131); - // TurnCount("5",Integer.parseInt(ChangLiang.dav_runningtime) * 60 *60); break; case AblSteps.STEP_131: //点击右上角搜索 @@ -51,12 +58,18 @@ public class TestAblStep24 extends BaseAblStep { AblViewUtil.mySleep(1); ChangLiang.dav_ishuadong = "T"; //输入关键词 + //判断有无要加关的关键词,如果有则执行112,没有则执行113 if (objects.size() > 0) { + //复制文本粘贴在留言板 AccessibilityNodeInfo findcomentt = findEditText(); String conment = objects.get(0); Log.e("TIAOSHI###", "获得的关键词内容" + conment); AblViewUtil.mySleep(1); - AblViewUtil.sayInput(conment, findcomentt); + if (ChangLiang.phonetype.equals("0")) { + AblViewUtil.sayInput(conment, findcomentt); + } else { + AblViewUtil.sayInput(conment, findcomentt);//华为畅享20 + } AblViewUtil.mySleep(3); AblStepHandler.sendMsg(AblSteps.STEP_133); } @@ -65,41 +78,39 @@ public class TestAblStep24 extends BaseAblStep { //点击列表第一个,进入加关页面 DianSou(); AblViewUtil.mySleep(2); + // AblService.getInstance().inputClickId("用户");//红米7a selecttype("1"); AblViewUtil.mySleep(2); - //用坐标点的方式点击第一条 0,256 720,404 - AblService.getInstance().clickPoint(790, 456, 300); - AblViewUtil.mySleep(2); - getfensi(); - AblViewUtil.mySleep(2); - AblService.getInstance().clickcommontwo(child3, "进入用户粉丝页"); - AblStepHandler.sendMsg(AblSteps.STEP_134); + //用坐标点的方式点击第一条 0,256 720,404 + AblService.getInstance().clickPoint(360, 330, 300); + AblViewUtil.mySleep(2); + getfensi(); + AblViewUtil.mySleep(2); + AblService.getInstance().clickcommontwo(child3, "进入用户粉丝页"); + AblStepHandler.sendMsg(AblSteps.STEP_134); break; case AblSteps.STEP_134: AblViewUtil.mySleep(2); - if (ChangLiang.dav_ishuadong.equals("T")) { + if(ChangLiang.dav_ishuadong.equals("T")) { getdouyin(); AblViewUtil.mySleep(2); AblStepHandler.sendMsg(AblSteps.STEP_135); } break; case AblSteps.STEP_135: + //获取一屏幕数据:快照 AccessibilityNodeInfo roott = AblService.getInstance().getRootInActiveWindow(); - List idsj = roott.findAccessibilityNodeInfosByText("暂时没有更多了"); + List idsj = roott.findAccessibilityNodeInfosByText("暂时没有更多"); if (idsj.size() > 0) { AccessibilityNodeInfo accessibilityNodeInfo = idsj.get(0); CharSequence text1 = accessibilityNodeInfo.getText(); - if (text1.equals("暂时没有更多了")) { + if (text1.equals("暂时没有更多")) { ChangLiang.dav_ishuadong = "F"; AblViewUtil.back(); } } if (ChangLiang.dav_ishuadong.equals("T")) { - AblViewUtil.mySleep(1); - ArrayList getrecy = getrecy(); - Log.e("TIAOSHI###", "向上滑动"); - getrecy.get(1).performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); //触发容器元素的滚动事件 - AblViewUtil.mySleep(1); + randomSwipe(); AblStepHandler.sendMsg(AblSteps.STEP_134); } break; @@ -108,30 +119,96 @@ public class TestAblStep24 extends BaseAblStep { } } - private ArrayList getrecy() { - ArrayList accessibilityNodeInfos = new ArrayList<>(); + /** + * 选择搜索的分类 + * 1为用户 2为直播 + */ + public void selecttype(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()); - nodeZuobiao(child); + // 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()); - nodeZuobiao(child1); + // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); + for (int j = 0; j < child1.getChildCount(); j++) { AccessibilityNodeInfo child2 = child1.getChild(j); - if ("androidx.recyclerview.widget.RecyclerView".equals(child2.getClassName())) { - Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); - nodeZuobiao(child2); - accessibilityNodeInfos.add(child2); + // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); + + switch (type) { + case "1": + if ("android.widget.TextView".equals(child2.getClassName())) { + if (child2.getText() != null) { + if (child2.getText().toString().equals("用户")) { + AblService.getInstance().clickcommontwo(child2, ""); + } + } + } + break; + case "2": + if ("android.widget.TextView".equals(child2.getClassName())) { + if (child2.getText() != null) { + if (child2.getText().toString().equals("直播")) { + AblService.getInstance().clickcommontwo(child2, ""); + } + } + } + break; + default: } } } } - return accessibilityNodeInfos; } + @RequiresApi(api = Build.VERSION_CODES.N) + public void randomSwipe() { + if (ChangLiang.phonetype.equals("0")) { + int a = 170 + RandumInt.getRandumInt4() * 8; + int b = 170 - RandumInt.getRandumInt4() * 10; + int c = 1200 - RandumInt.getRandumInt4() * 8; // 1280分辨率起步的滑动方式 2160--1080 + int d = 400 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400 + // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的 + swipe(a, c, b, d, 320); //延迟330毫秒 + } else { + int a = 500 + RandumInt.getRandumInt4() * 8; + int b = 500 - RandumInt.getRandumInt4() * 10; + int c = 1500 - RandumInt.getRandumInt4() * 8; // 1280分辨率起步的滑动方式 + int d = 700 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400 + // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的 + swipe(a, c, b, d, 420); //延迟330毫秒 + } + } + @RequiresApi(api = Build.VERSION_CODES.N) + public void swipe(float x1, float y1, float x2, float y2, long duration) { + Path path = new Path(); + path.moveTo(x1, y1); + path.lineTo(x2, y2); + + Log.e("TIAOSHI###", "MyAccessibilityService中滑动swipe()方法滑动点,reset:(" + x1 + "," + y1 + "),(" + x2 + "," + y2 + ")" + "滑动的时长是:" + duration); + GestureDescription.Builder builder = new GestureDescription.Builder(); + GestureDescription gestureDescription = builder + .addStroke(new GestureDescription.StrokeDescription(path, 0, duration)) + .build(); + boolean b = AblService.getInstance().dispatchGesture(gestureDescription, new AccessibilityService.GestureResultCallback() { + @Override + public void onCompleted(GestureDescription gestureDescription) { + super.onCompleted(gestureDescription); + Log.e("TIAOSHI###", "滑动结束..." + gestureDescription.getStrokeCount()); + + } + + @Override + public void onCancelled(GestureDescription gestureDescription) { + super.onCancelled(gestureDescription); + Log.e("TIAOSHI###", "滑动取消"); + } + }, null); + } + + /** * 添加关注 */ @@ -139,88 +216,65 @@ public class TestAblStep24 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); - // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); - if(child1!=null) { + // 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()); - // nodeZuobiao(child2); - for (int x = 0; x < child2.getChildCount(); x++) { - AccessibilityNodeInfo child3 = child2.getChild(x); - Rect rect = new Rect(); - child3.getBoundsInScreen(rect); - if (rect.top >= 364 && rect.top <= 2100) { - if ("android.widget.RelativeLayout".equals(child3.getClassName())) { - // 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()); - 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); - if (child5.getText() != null) { - if (child5.getText().toString().equals("关注")) { - AblViewUtil.mySleep(1); - //点击进入详情页 - clickcommontwo(child3, "进入详情页"); - AblViewUtil.mySleep(2); - //获取参数 - // getCondition(); - AblViewUtil.mySleep(2); - //是否加关 - if (ChangLiang.dav_condition.equals("0")) { - clickGuanzhu(); - AblViewUtil.mySleep(2); - } - AblViewUtil.back(); - AblViewUtil.mySleep(1); + // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); - } - } + if (child2.getChildCount() != 0) { + for (int h = 0; h < child2.getChildCount(); h++) { + AccessibilityNodeInfo childh = child2.getChild(h); + Log.e("TIAOSHI###", "----fourNode:" + childh.getClassName() + ":" + childh.getText() + ":" + childh.getContentDescription()); + AblViewUtil.mySleep(1); + ChangLiang.dav_condition="0"; + if(childh.getText()!=null) { + if(childh.getText().toString().contains("用户")){ + continue; + } +// if (childh.getText().toString().equals("关注")) { +// clickcommontwo(childh, "关注"); +// } + + + if (childh.getText().toString().equals("关注")) { + //点击进入详情页 + clickcommontwo(child2, "进入互相关注"); + AblViewUtil.mySleep(2); + //获取参数 + getCondition(); + //是否加关 + AblViewUtil.mySleep(2); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + if(ChangLiang.dav_condition.equals("0")){ + clickcommontwo(childh, "关注"); } } } } } } - } + } } } - private void clickGuanzhu() { - 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); - 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); - Rect rect = new Rect(); - child1.getBoundsInScreen(rect); - if (rect.top >= 800 && rect.bottom <= 1350) { - if ("android.widget.TextView".equals(child1.getClassName())) { - if(child1.getText()!=null) { - if ("关注".equals(child1.getText().toString())) { - clickcommontwo(child1, "关注"); - break; - } - } - } - } - } - } - } private void getCondition() { + String getquxiaoguanzhu = getquxiaoguanzhu(); + if (getquxiaoguanzhu.equals("0")) { + Log.e("TIAOSHI###", "已经关注了,直接返回"); + ChangLiang.dav_condition = "1"; + return; + } + //___________________________________________________________________________________ AblViewUtil.mySleep(1); + // getUserInfo(); getargone(); //判断作品数条件 getargfour(); @@ -265,6 +319,36 @@ public class TestAblStep24 extends BaseAblStep { } } } + + } + + /** + * 获得取消关注 + */ + private String getquxiaoguanzhu() { + String quxiaoguanzhu = "1"; + 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 ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { + if ("dmt.viewpager.DmtViewPager$MyAccessibilityDelegate".equals(child.getClassName())) { + // Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount()); + for (int y = 0; y < child.getChildCount(); y++) { + AccessibilityNodeInfo child1 = child.getChild(y); + // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); + if ("android.widget.TextView".equals(child1.getClassName())) { + CharSequence text = child1.getText(); + if (text != null) { + if (text.toString().equals("取消关注") || text.toString().equals("回关")) { + quxiaoguanzhu = "0"; + } + } + } + } + } + } + return quxiaoguanzhu; } @@ -275,25 +359,25 @@ public class TestAblStep24 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()); - 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###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + //if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { + if ("android.widget.HorizontalScrollView".equals(child.getClassName())) { + Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount()); + for (int y = 0; y < child.getChildCount(); y++) { + AccessibilityNodeInfo child1 = child.getChild(y); + Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); + // if ("android.widget.LinearLayout".equals(child1.getClassName())) { 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()); if (child2.getText() != null) { if (child2.getText().equals("粉丝")) { AccessibilityNodeInfo parent = child2.getParent(); - 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###", "数据异常,停止服务。。。。。。。。。。。。"); - } + child3 = parent.getChild(0); + Log.e("TIAOSHI###", "获得的关注数==" + child3.getText().toString()); + // guanzhunum = child3.getText().toString(); + if (child3.getText().toString().equals("-")) { + Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。"); } return; } @@ -304,6 +388,88 @@ public class TestAblStep24 extends BaseAblStep { } } + + /** + * 寻找搜索输入框 + */ + private AccessibilityNodeInfo findEditText() { + AccessibilityNodeInfo infooos = null; + AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); + for (int j = 0; j < rootttt.getChildCount(); j++) { + AccessibilityNodeInfo child = rootttt.getChild(j); + Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + if ("android.widget.EditText".equals(child.getClassName())) { + infooos = child; + } + } + return infooos; + } + + + //点击右上角搜索 + //[624,67][688,131] + private void DianSou() { + + if (ChangLiang.phonetype.equals("0")) { + AblService.getInstance().clickPoint(656, 99, 300);//红米7a + } else { + AblService.getInstance().clickPoint(659, 922, 300);//华为畅享20 + } + Log.e("TIAOSHI###", "点击点赞按钮"); + } + + + + /** + * 列表第一条 + */ + private AccessibilityNodeInfo firstview() { + AccessibilityNodeInfo infooos = null; + AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); + + for (int j = 0; j < root.getChildCount(); j++) { + AccessibilityNodeInfo child = root.getChild(j); + Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + Log.e("TIAOSHI###ViewPager", "----2Node:" + child.getChildCount()); + for (int y = 0; y < child.getChildCount(); y++) { + AccessibilityNodeInfo child1 = child.getChild(0); + infooos = child1; + } + } + return infooos; + + } + +// private void getUserInfo() { +// int num = 0; +// 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()); +// if ("dmt.viewpager.DmtViewPager$MyAccessibilityDelegate".equals(child.getClassName())) { +// Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount()); +// for (int y = 0; y < child.getChildCount(); y++) { +// AccessibilityNodeInfo child1 = child.getChild(y); +// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); +// if ("android.widget.TextView".equals(child1.getClassName())) { +// if (num < 7) { +// accessibilityNodeInfos.add(child1); +// num = num + 1; +// } +// } +// +// } +// if(accessibilityNodeInfos.get(1).getText()!=null) { +// String customer_name = accessibilityNodeInfos.get(1).getText().toString(); +// String str = accessibilityNodeInfos.get(2).getText().toString(); +// String[] all = str.split(":"); +// String str3 = accessibilityNodeInfos.get(3).getText().toString(); +// fasStatistics(ChangLiang.short_id, customer_name, all[1], str3, huozannum, guanzhunum, fensinum, zuopinnum); +// } +// } +// } +// } /** * 获得最近作品时间 */ @@ -311,34 +477,37 @@ public class TestAblStep24 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###ViewPager", "----twoNode:" + child.getChildCount()); - for (int j = 0; j < child.getChildCount(); j++) { - AccessibilityNodeInfo child1 = child.getChild(j); - // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText()); - for (int x = 0; x < child1.getChildCount(); x++) { - AccessibilityNodeInfo child2 = child1.getChild(x); - // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText()); - for (int m = 0; m < child2.getChildCount(); m++) { - AccessibilityNodeInfo child3 = child2.getChild(m); - // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - nodeZuobiao(child3); - if (child3.getText() != null) { - String text = child3.getText().toString(); - if (text != null) { - boolean status = text.contains("作品"); - if (status) { - if (text.length() > 2) { - String zuopinnum = child3.getText().toString().substring(3); - if (StringUtils.isDigit(zuopinnum)) { - Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum); - if (Integer.parseInt(zuopinnum) < Integer.parseInt(ChangLiang.dav_minimumzuopin) || Integer.parseInt(zuopinnum) > Integer.parseInt(ChangLiang.dav_maxmumzuopin)) { - Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(ChangLiang.dav_minimumzuopin) + "-" + Integer.parseInt(ChangLiang.dav_maxmumzuopin) + "),作品数不满足条件"); - AblViewUtil.onMessage("作品数不满足条件"); - ChangLiang.dav_condition = "1"; - return; - } else { - Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件"); + // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + //if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { + if ("android.widget.HorizontalScrollView".equals(child.getClassName())) { + // Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount()); + for (int j = 0; j < child.getChildCount(); j++) { + AccessibilityNodeInfo child1 = child.getChild(j); + // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText()); + for (int x = 0; x < child1.getChildCount(); x++) { + AccessibilityNodeInfo child2 = child1.getChild(x); + // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText()); + if (child2 != null) { + if ("androidx.appcompat.app.ActionBar$Tab".equals(child2.getClassName())) { + for (int y = 0; y < child2.getChildCount(); y++) { + AccessibilityNodeInfo child3 = child2.getChild(y); + String text = child3.getText().toString(); + if (text != null) { + boolean status = text.contains("作品"); + if (status) { + if (text.length() > 2) { + zuopinnum = child3.getText().toString().substring(3); + Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum); + if (!zuopinnum.equals("-") && zuopinnum != null) { + if (Integer.parseInt(zuopinnum) < Integer.parseInt(ChangLiang.dav_minimumzuopin) || Integer.parseInt(zuopinnum) > Integer.parseInt(ChangLiang.dav_maxmumzuopin)) { + Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(ChangLiang.dav_minimumzuopin) + "-" + Integer.parseInt(ChangLiang.dav_maxmumzuopin) + "),作品数不满足条件"); + AblViewUtil.onMessage("作品数不满足条件"); + ChangLiang.dav_condition = "1"; + return; + } else { + Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件"); + } + } } } } @@ -347,6 +516,7 @@ public class TestAblStep24 extends BaseAblStep { } } } + // AblViewUtil.mySleep(2); } } } @@ -358,50 +528,48 @@ public class TestAblStep24 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()); - for (int y = 0; y < child.getChildCount(); y++) { - AccessibilityNodeInfo child1 = child.getChild(y); - if (child1 != null) { + Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); + // if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { + if ("android.widget.HorizontalScrollView".equals(child.getClassName())) { + // Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount()); + 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() + ":" + child2.getContentDescription()); -// nodeZuobiao(child2); - if (child2.getText() != null) { - if (child2.getText().equals("获赞")) { - AccessibilityNodeInfo parent = child2.getParent(); - AccessibilityNodeInfo child3 = parent.getChild(1); - if (child3.getText() != null) { + if ("android.widget.LinearLayout".equals(child1.getClassName())) { + for (int j = 0; j < child1.getChildCount(); j++) { + AccessibilityNodeInfo child2 = child1.getChild(j); + // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText()); + if (child2.getText() != null) { + if (child2.getText().equals("获赞")) { + AccessibilityNodeInfo parent = child2.getParent(); + AccessibilityNodeInfo child3 = parent.getChild(0); Log.e("TIAOSHI###", "获得的获赞数==" + child3.getText().toString()); - huozannum = child3.getText().toString(); + huozannum = child3.getText().toString(); if (child3.getText().toString().equals("-")) { Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。"); } + //return; } - } - if (child2.getText().equals("关注")) { - AccessibilityNodeInfo parent = child2.getParent(); - AccessibilityNodeInfo child3 = parent.getChild(1); - if (child3.getText() != null) { + if (child2.getText().equals("关注")) { + AccessibilityNodeInfo parent = child2.getParent(); + AccessibilityNodeInfo child3 = parent.getChild(0); Log.e("TIAOSHI###", "获得的关注数==" + child3.getText().toString()); - guanzhunum = child3.getText().toString(); - + guanzhunum = child3.getText().toString(); if (child3.getText().toString().equals("-")) { Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。"); } + //return; } - } - if (child2.getText().equals("粉丝")) { - AccessibilityNodeInfo parent = child2.getParent(); - AccessibilityNodeInfo child3 = parent.getChild(1); - if (child3.getText() != null) { + if (child2.getText().equals("粉丝")) { + AccessibilityNodeInfo parent = child2.getParent(); + AccessibilityNodeInfo child3 = parent.getChild(0); Log.e("TIAOSHI###", "获得的粉丝数==" + child3.getText().toString()); - fensinum = child3.getText().toString(); + fensinum = child3.getText().toString(); if (child3.getText().toString().equals("-")) { Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。"); } + return; } - return; } } } 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 fb5dbfe..690ac56 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java @@ -115,10 +115,16 @@ public class TestAblStep30 extends NoticeBase { case AblSteps.STEP_214: AblViewUtil.mySleep(1); if(liveBean.getSwitchtwo()) { - //每次点赞次数40-80次 - //每个功能间隔时间随机在5到15s之间 - int randumInt40 = RandumInt.getRandumInt40(); - zhibodianzanc(randumInt40); + //直播间点赞 + if ("3".equals(ChangLiang.phonetype)) { + //每秒点赞:4-9次 每次点赞:10-15秒 + //点赞次数40-145次 + int randumInt40 = RandumInt.getRandumInt40(); + zhibodianzanc(randumInt40); + } else { + int randumInt40 = RandumInt.getRandumInt40(); + zhibodianzan(randumInt40); + } } AblViewUtil.mySleep(2); AblStepHandler.sendMsg(AblSteps.STEP_215); @@ -129,9 +135,7 @@ public class TestAblStep30 extends NoticeBase { String conment = getConment(); //直播间发送评论 fasongpinglun(conment); - - int randumInt10 = RandumInt.getRandumInt10(); - AblViewUtil.mySleep(randumInt10); + AblViewUtil.mySleep(5); } AblStepHandler.sendMsg(AblSteps.STEP_216); //AblStepHandler.sendMsg(AblSteps.STEP_217); @@ -187,9 +191,6 @@ public class TestAblStep30 extends NoticeBase { } } // AblStepHandler.sendMsg(AblSteps.STEP_217); - - int randumInt10 = RandumInt.getRandumInt10(); - AblViewUtil.mySleep(randumInt10); AblStepHandler.sendMsg(AblSteps.STEP_214); break; case AblSteps.STEP_217: @@ -472,41 +473,25 @@ public class TestAblStep30 extends NoticeBase { private void fasongpinglun(String conment) { //直播间话术 - AblViewUtil.mySleep(3); - Log.e("TIAOSHI###", "开始点说点什么" ); - AccessibilityNodeInfo containText = isContainText("说点什么..."); - clickcommontwo(containText,""); + AblViewUtil.mySleep(2); + clickmoreli("1"); AblViewUtil.mySleep(2); //复制文本粘贴在留言板 AccessibilityNodeInfo getedittext = getedittext(); Log.e("TIAOSHI###", "获得的关键词内容" + conment); AblViewUtil.mySleep(1); - AblViewUtil.sayInput(conment, getedittext); + if (SHEBEITIPE_VILUEONE.equals(ChangLiang.phonetype)) { + AblViewUtil.sayInput(conment, getedittext); + } else { + //华为畅享20 + 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; - } + /** * 直播间点赞 @@ -536,34 +521,16 @@ public class TestAblStep30 extends NoticeBase { * @param mun */ public void zhibodianzanc(int mun) { - Random r = new Random(); - int num = r.nextInt(2)+1; - if(num==1) { - for (int i = 0; i < mun; i++) { - int a = 540 + RandumInt.getRandumInt4() * 10; - int b = 500 - RandumInt.getRandumInt4() * 12; - int c = 200 - RandumInt.getRandumInt4() * 20; - AblService.getInstance().clickPoint(a, b, 100); - try { - //隔200 ms - Thread.sleep(c); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }else { - - for (int i = 0; i < mun; i++) { - int a = 640 + RandumInt.getRandumInt4() * 30; - int b = 490; - int c = 200 - RandumInt.getRandumInt4() * 20; - AblService.getInstance().clickPoint(a, b, 100); - try { - //隔200 ms - Thread.sleep(c); - } catch (InterruptedException e) { - e.printStackTrace(); - } + for (int i = 0; i < mun; i++) { + int a = 540 + RandumInt.getRandumInt4() * 10; + int b = 500 - RandumInt.getRandumInt4() * 12; + int c = 200 - RandumInt.getRandumInt4() * 20; + AblService.getInstance().clickPoint(a, b, 100); + try { + //隔200 ms + Thread.sleep(c); + } catch (InterruptedException e) { + e.printStackTrace(); } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep31.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep31.java index 434ca33..bd2ed32 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep31.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep31.java @@ -57,7 +57,7 @@ public class TestAblStep31 extends HongbaoBase { AblViewUtil.mySleep(3); allowed(); AblViewUtil.mySleep(5); - Log.e("TIAOSHI###", "是否抢红包" + ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive() + ""); + Log.e("TIAOSHI###", "是否抢红包"+ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()+""); if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) { AblService.getInstance().clickPoint(90, 163, 300); AblViewUtil.mySleep(3); @@ -67,9 +67,14 @@ public class TestAblStep31 extends HongbaoBase { enfirstLive(); } break; +// case AblSteps.STEP_222: +// Log.e("TIAOSHI###", "福袋测试STEP_222"); +// AblViewUtil.mySleep(2); +// AblStepHandler.sendMsg(AblSteps.STEP_223); +// break; case AblSteps.STEP_222: Log.e("TIAOSHI###", "福袋测试STEP_222"); - AblViewUtil.mySleep(4); + AblViewUtil.mySleep(2); if (ifControlView()) { AblViewUtil.mySleep(2); kongjiandingweitwo(); @@ -128,9 +133,9 @@ public class TestAblStep31 extends HongbaoBase { */ private void huodong() { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) { - AblService.getInstance().randomSwipetwo(); - AblViewUtil.mySleep(3); - AblStepHandler.sendMsg(AblSteps.STEP_222); + AblService.getInstance().randomSwipetwo(); + AblViewUtil.mySleep(3); + AblStepHandler.sendMsg(AblSteps.STEP_222); } if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchsix()) { if (slidingDir) { @@ -217,7 +222,19 @@ public class TestAblStep31 extends HongbaoBase { AblViewUtil.mySleep(2); int pagetype = pagetype(); if (pagetype == 1) { - operationYouhui(); + AblViewUtil.mySleep(1); + AblService.getInstance().clickPoint(540, 1663, 300); + AblViewUtil.mySleep(1); + int pagetype1 = pagetype(); + if (pagetype1 == 1) { + Log.e("TIAOSHI###", "第一次点击没有关掉"); + AblViewUtil.mySleep(1); + Log.e("TIAOSHI###", "再次点击关闭按钮"); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + } else { + Log.e("TIAOSHI###", "优惠卷弹框关闭了"); + } } else if (pagetype == 2) { jiluBeans.add("福袋"); boolean enterfensituan = enterfensituan(); @@ -242,6 +259,12 @@ public class TestAblStep31 extends HongbaoBase { } else if (pagetype == 21) { jiluBeans.add("红包"); AblViewUtil.mySleep(1); +// AblService.getInstance().clickPoint(100, 100, 300); +// AblViewUtil.mySleep(1); + if (!ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchthree()) { + AblService.getInstance().clickPoint(100, 100, 300); + AblViewUtil.mySleep(1); + } if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchthree()) { boolean getdoubi = getdoubi(); if (getdoubi) { @@ -249,11 +272,9 @@ public class TestAblStep31 extends HongbaoBase { } else { Log.e("TIAOSHI###", "----抖币数不够条件"); } - }else { - AblService.getInstance().clickPoint(100, 100, 300); - AblViewUtil.mySleep(1); + break; } - break; + } else if (pagetype == 4) { AblViewUtil.mySleep(2); AblService.getInstance().clickPoint(100, 100, 300); @@ -268,22 +289,55 @@ public class TestAblStep31 extends HongbaoBase { } /** - * 关闭优惠券 + * 参与抢福袋 */ - private void operationYouhui() { - AblViewUtil.mySleep(1); - AblService.getInstance().clickPoint(540, 1663, 300); - AblViewUtil.mySleep(1); - int pagetype1 = pagetype(); - if (pagetype1 == 1) { - Log.e("TIAOSHI###", "第一次点击没有关掉"); - AblViewUtil.mySleep(1); - Log.e("TIAOSHI###", "再次点击关闭按钮"); - AblViewUtil.back(); - AblViewUtil.mySleep(1); - } else { - Log.e("TIAOSHI###", "优惠卷弹框关闭了"); + private AccessibilityNodeInfo canyuqiangfeidai() { + AccessibilityNodeInfo kongjian = null; + AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); + for (int i = 0; i < root.getChildCount(); i++) { + AccessibilityNodeInfo child = root.getChild(i); + for (int y = 0; y < child.getChildCount(); y++) { + AccessibilityNodeInfo child1 = child.getChild(y); + if ("android.widget.HorizontalScrollView".equals(child1.getClassName())) { + kongjian = child1; + } + } } + return kongjian; + } + + /** + * 获得红包的位置 + * + * @return + */ + private int hongbaoweizhi() { + int position = 0; + for (int i = 0; i < hongbaos.size(); i++) { + String s = hongbaos.get(i); + if ("红包".equals(s)) { + position = i; + break; + } + } + return position; + } + + /** + * 获得福袋的位置 + * + * @return + */ + private int fudaiposition() { + int position = 0; + for (int i = 0; i < hongbaos.size(); i++) { + String s = hongbaos.get(i); + if ("福袋".equals(s)) { + position = i; + break; + } + } + return position; } /** @@ -331,11 +385,11 @@ public class TestAblStep31 extends HongbaoBase { // Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText() + ":" + child7.getContentDescription()); for (int u = 0; u < child7.getChildCount(); u++) { AccessibilityNodeInfo child8 = child7.getChild(u); - // Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription()); - // nodeZuobiao(child8); + Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription()); + nodeZuobiao(child8); Rect rect = new Rect(); child8.getBoundsInScreen(rect); - // Log.e("TIAOSHI###", "----9Node:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")"); + Log.e("TIAOSHI###", "----9Node:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")"); if (SHEBEITIPE_VILUETHREE.equals(ChangLiang.phonetype)) { if (rect.top >= 1351 && rect.bottom <= 1459 && rect.left >= 91 && rect.right <= 273) { @@ -402,8 +456,8 @@ public class TestAblStep31 extends HongbaoBase { } for (int q = 0; q < child8.getChildCount(); q++) { AccessibilityNodeInfo child9 = child8.getChild(q); -// Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); -// nodeZuobiao(child9); + Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); + nodeZuobiao(child9); if ("android.view.View".equals(child9.getClassName())) { String text = child9.getText().toString(); if (!TextUtils.isEmpty(text)) { @@ -458,9 +512,7 @@ public class TestAblStep31 extends HongbaoBase { Log.e("TIAOSHI###", "noqinmidu==" + noqinmidu); if (timeconditions && winningpro && noqinmidu) { conditions = true; - Log.e("TIAOSHI###", "是否满足条件1==" + conditions); } - Log.e("TIAOSHI###", "是否满足条件2==" + conditions); return conditions; } @@ -515,8 +567,8 @@ public class TestAblStep31 extends HongbaoBase { // Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription()); for (int q = 0; q < child8.getChildCount(); q++) { AccessibilityNodeInfo child9 = child8.getChild(q); -// Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); -// nodeZuobiao(child9); + Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); + nodeZuobiao(child9); if ("android.view.View".equals(child9.getClassName())) { String text = child9.getText().toString(); if (!TextUtils.isEmpty(text)) { @@ -581,7 +633,7 @@ public class TestAblStep31 extends HongbaoBase { @Override public void accept(Long aLong) throws Exception { long b = a - aLong; - Log.e("TIAOSHI###福袋", b + ""); + Log.e("TIAOSHI###", b + ""); if (b == 30) { //打开福袋 if (ifControlView()) { @@ -619,7 +671,19 @@ public class TestAblStep31 extends HongbaoBase { int pagetype = pagetype(); if (pagetype == 1) { Log.e("TIAOSHI###", "福袋测试1"); - operationYouhui(); + AblViewUtil.mySleep(1); + AblService.getInstance().clickPoint(540, 1663, 300); + AblViewUtil.mySleep(1); + int pagetype1 = pagetype(); + if (pagetype1 == 1) { + Log.e("TIAOSHI###", "第一次点击没有关掉"); + AblViewUtil.mySleep(1); + Log.e("TIAOSHI###", "再次点击关闭按钮"); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + } else { + Log.e("TIAOSHI###", "优惠卷弹框关闭了"); + } } else if (pagetype == 2) { break; } else if (pagetype == 21) { @@ -812,7 +876,7 @@ public class TestAblStep31 extends HongbaoBase { // nodeZuobiao(child); for (int y = 0; y < child.getChildCount(); y++) { AccessibilityNodeInfo child1 = child.getChild(y); - // nodeZuobiao(child1); + nodeZuobiao(child1); Rect rect = new Rect(); child1.getBoundsInScreen(rect); if (rect.top >= 1192 && rect.bottom <= 1286) { @@ -833,8 +897,8 @@ public class TestAblStep31 extends HongbaoBase { AblService.getInstance().clickPoint(540, 1239, 300); AblViewUtil.mySleep(2); AblViewUtil.back(); - AblViewUtil.mySleep(1); AblStepHandler.sendMsg(AblSteps.STEP_222); + AblViewUtil.mySleep(1); } } @@ -842,7 +906,7 @@ public class TestAblStep31 extends HongbaoBase { private void qiangHongbao(AccessibilityNodeInfo child1) { String s = child1.getText().toString(); int daojishimiao = daojishimiao(s); - String qiehuantime = "90"; + String qiehuantime = "60"; int qihuanshijian = Integer.valueOf(qiehuantime); if (daojishimiao < qihuanshijian) { Log.e("TIAOSHI###", "时间在" + qihuanshijian + "秒内"); @@ -880,7 +944,7 @@ public class TestAblStep31 extends HongbaoBase { @Override public void accept(Long aLong) throws Exception { long b = a - aLong; - Log.e("TIAOSHI###红包", b + ""); + Log.e("TIAOSHI###", b + ""); } }) .doOnComplete(new Action() { diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java index c8e347a..dfffcf6 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java @@ -79,7 +79,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red allowed(); AblStepHandler.sendMsg(AblSteps.STEP_250); //开启运行倒计时 - // TurnCount("6",Integer.parseInt(redEnvBean.getRuntime()) * 60); + daojishitwo(Integer.parseInt(redEnvBean.getRuntime()) * 60); break; case AblSteps.STEP_250: @@ -384,6 +384,31 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red return ifOpen; } +// @Override +// public boolean enterLive() { +// boolean ifEnterOne = true; +// //进入推荐页(刷新) +// AblViewUtil.mySleep(1); +// getNodeInfo("2"); +// Log.e("TIAOSHI###", "点击关注"); +// AblViewUtil.mySleep(5); +// enterOneNodeInfo(); +// AblViewUtil.mySleep(4); +// AccessibilityNodeInfo nodeInfoS = getNodeInfoS(); +// if (nodeInfoS != null) { +// ifEnterOne = true; +// } +// return ifEnterOne; +// } + +// public boolean enterLivetwo() { +// boolean ifEnterOne = false; +// AccessibilityNodeInfo nodeInfoS = getNodeInfoS(); +// if (nodeInfoS != null) { +// ifEnterOne = true; +// } +// return ifEnterOne; +// } @Override public boolean liveTime() { @@ -720,6 +745,16 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red * 滑动 */ private void move() { + //判断有没有直播间的红包快开奖了,赶紧滑过去 +// int redpostion = redEnvPostions(); +// Log.e("TIAOSHI###", "满足时间筛选的开奖直播间位置==" + redpostion); +// if (redpostion != -1) { +// Log.e("TIAOSHI###", redpostion + "位置的红包要开了"); +// Log.e("TIAOSHI###", "当前直播间的位置==" + livePosition); +// moveZhiBoJian(livePosition, redpostion); +// return; +// } + if (slidingDir) { // AblService.getInstance().randomSwipetwo(); AblViewUtil.mySleep(1); @@ -1006,7 +1041,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red Rect rect = new Rect(); child3.getBoundsInScreen(rect); - if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 30 && rect.right <= 248) { + if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 37 && rect.right <= 248) { Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); nodeZuobiao(child3); 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 c5ecdea..dd56d25 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java @@ -35,8 +35,6 @@ 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) { @@ -56,35 +54,27 @@ 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); -// -// 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; -// } + 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; + } //点击进入用户关注页 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: @@ -93,14 +83,7 @@ public class TestAblStep6 extends BaseAblStep { String[] all = num1.split(" "); String num22 = all[1]; Log.e("TIAOSHI###", "获得的关注数==" + 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); - } - + int num2 = Integer.parseInt(num22); if (num2 > numb) { // AblViewUtil.mySleep(1); cancelGuanzhu(AblService.getInstance()); @@ -211,14 +194,15 @@ 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()); + // Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); nodeZuobiao(child5); yiguanzhu(child5); } @@ -229,137 +213,11 @@ public class TestAblStep6 extends BaseAblStep { } } -// 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); -// 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); -//// 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.RelativeLayout".equals(child3.getClassName())) { -// for (int r = 0; r < child3.getChildCount(); r++) { -// AccessibilityNodeInfo child4 = child3.getChild(r); -// if ("android.widget.FrameLayout".equals(child4.getClassName())) { -// 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()); -// for (int p = 0; p < child5.getChildCount(); p++) { -// AccessibilityNodeInfo child6 = child5.getChild(p); -// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription()); -// nodeZuobiao(child5); -// yiguanzhutwo(child6); -// } -// } -// } -// } -// } -// } -// } -// } -// } -// } - - // 3.遍历info中的子节点 (优化方法,正在测试) - public void yiguanzhutwo(AccessibilityNodeInfo child2) { - boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed(); - boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor(); - if (cancelclosed && !cancelcrosscor) { - Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ"); - - try { - Thread.sleep(300); - } catch (InterruptedException e) { - e.printStackTrace(); - } - if (child2.getText() != null) { - if (child2.getText().toString().equals("已关注")) { - Rect rect = new Rect(); - if (child2 != null) { - child2.getBoundsInScreen(rect); - if (rect.top <= 2100) { - clickcommontwo(child2, "已关注"); - } - } - } - } - - - } - - if (cancelcrosscor && !cancelclosed) { - Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV"); - - AblViewUtil.mySleep(1); - if (child2.getText() != null) { - if (child2.getText().toString().equals("互相关注")) { - Rect rect = new Rect(); - if (child2 != null) { - child2.getBoundsInScreen(rect); - if (rect.top <= 2100) { - clickcommontwo(child2, "互相关注"); - AblViewUtil.mySleep(2); - //(0,1868),(1080,2028) - AblService.getInstance().clickPoint(720, 1948, 300); -// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); -// clickcommontwo(quxiao, "取消关注"); - AblViewUtil.mySleep(1); - } - } - - - } - } - - - } - - 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); - - } - } - } - } - } - } - - // 3.遍历info中的子节点 (优化方法,正在测试) 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++) { @@ -377,21 +235,14 @@ public class TestAblStep6 extends BaseAblStep { } if (child.getText() != null) { if (child.getText().toString().equals("已关注")) { - // clickcommontwo(child, "已关注"); - Rect rect = new Rect(); - if (child != null) { - child.getBoundsInScreen(rect); - if (rect.top <= 2100) { - clickcommontwo(child, "已关注"); - } - } + clickcommontwo(child, "已关注"); } } } } } - if (cancelcrosscor && !cancelclosed) { + if (cancelcrosscor&&!cancelclosed) { Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV"); if (child2.getChildCount() != 0) { for (int w = 0; w < child2.getChildCount(); w++) { @@ -406,25 +257,10 @@ public class TestAblStep6 extends BaseAblStep { AblViewUtil.mySleep(1); if (childw.getText() != null) { if (childw.getText().toString().equals("互相关注")) { - // clickcommontwo(childw, "互相关注"); - Rect rect = new Rect(); - if (childw != null) { - childw.getBoundsInScreen(rect); - if (rect.top <= 2100) { - clickcommontwo(childw, "互相关注"); - AblViewUtil.mySleep(2); - List liats = AblViewUtil.findByText("取消关注"); - if(liats.size()>0) { - AblService.getInstance().clickPoint(720, 1948, 300); - AblViewUtil.mySleep(1); - } - } - } - - -// AblViewUtil.mySleep(2); -// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); -// clickcommontwo(quxiao, "取消关注"); + clickcommontwo(childw, "互相关注"); + AblViewUtil.mySleep(2); + AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); + clickcommontwo(quxiao, "取消关注"); } } @@ -433,7 +269,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++) { @@ -517,12 +353,23 @@ 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); @@ -535,6 +382,18 @@ 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/TestAblStepBase.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepBase.java index 51b14c0..ae06ad0 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepBase.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepBase.java @@ -432,6 +432,23 @@ public class TestAblStepBase extends BaseAblStep { } + /** + * 寻找搜索输入框 + */ + public AccessibilityNodeInfo findEditText() { + AccessibilityNodeInfo infooos = null; + AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); + for (int j = 0; j < rootttt.getChildCount(); j++) { + AccessibilityNodeInfo child = rootttt.getChild(j); + // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + if ("android.widget.EditText".equals(child.getClassName())) { + infooos = child; + } + } + return infooos; + } + + //点击右上角搜索 //[624,67][688,131] public void DianSou() { 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 79be3e8..e475e79 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java @@ -23,7 +23,6 @@ import com.fisherbone.fuzhu.okgonet.HttpConstants; import com.fisherbone.fuzhu.okgonet.NetApi; import com.fisherbone.fuzhu.utils.DateUtils; import com.fisherbone.fuzhu.utils.ProfileSpUtils; -import com.fisherbone.fuzhu.utils.StringUtils; import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.Response; @@ -56,7 +55,7 @@ public class TestAblStepXin5 extends BaseAblStep { public TestAblStepXin5(Context nContext) { super(); - this.mContext = nContext; + this.mContext=nContext; } @Override @@ -64,7 +63,7 @@ public class TestAblStepXin5 extends BaseAblStep { switch (step) { case AblSteps.STEP_9: isStart = true; - ChangLiang.guanzhunum = 0; + ChangLiang.guanzhunum=0; userProfie = ProfileSpUtils.getInstance().getUserProfie(); AblViewUtil.startApplication(); AblViewUtil.mySleep(2); @@ -89,18 +88,21 @@ public class TestAblStepXin5 extends BaseAblStep { AblViewUtil.mySleep(1); AblStepHandler.sendMsg(AblSteps.STEP_28); - // LiveEventBus.get("jiaguantime").post(Integer.parseInt(userProfie.getRunningtime()) * 3600+""); + // LiveEventBus.get("jiaguantime").post(Integer.parseInt(userProfie.getRunningtime()) * 3600+""); break; case AblSteps.STEP_28: recordDoubi(DateUtils.getNowString()); Log.e("TIAOSHI###", "初始时间" + userProfie.getLivetimefir()); Log.e("TIAOSHI###", "当前时间" + userProfie.getLivetime()); +// String sp = (String) SPUtils.getSp(mContext, FZConfig.KEY_YUN_ISOPEN, "1"); +// Log.e("TIAOSHI###", "当前sp==" + sp); + boolean redswitchone = ProfileSpUtils.getInstance().getSetBean().isRedswitchone(); - Log.e("TIAOSHI###", "当前sp,false表示本地,true表示云端==" + redswitchone); - if (redswitchone) { + Log.e("TIAOSHI###", "当前sp==" + redswitchone); + if(redswitchone){ ifend = runTimetwo(userProfie.getEnd_time()); - } else { + }else { ifend = runTime(); } if (ifend) { @@ -116,36 +118,42 @@ public class TestAblStepXin5 extends BaseAblStep { AblViewUtil.mySleep(2 + randnum); } - if (AblViewUtil.isContainText("广告")) { - Log.e("TIAOSHI###", "此视频包含广告"); - AblStepHandler.sendMsg(AblSteps.STEP_31); - return; - } - if (AblViewUtil.isContainText("点击进入直播间")) { - Log.e("TIAOSHI###", "此视频包含点击进入直播间"); - AblStepHandler.sendMsg(AblSteps.STEP_31); - return; - } - if (AblViewUtil.isContainText("广播")) { - Log.e("TIAOSHI###", "此视频包含广播"); - AblStepHandler.sendMsg(AblSteps.STEP_31); - return; - } - if (AblViewUtil.isContainText("查看详情")) { - Log.e("TIAOSHI###", "此视频包含查看详情"); - AblStepHandler.sendMsg(AblSteps.STEP_31); - return; - } - boolean nodeInfoh = ifGaunzhu(); - if(nodeInfoh){ - Log.e("TIAOSHI###", "此视频没有关注过"); - }else { - Log.e("TIAOSHI###", "此视频已关注"); - AblStepHandler.sendMsg(AblSteps.STEP_31); - return; + Rect rect = new Rect(); + if (rect.top >= 0 && rect.bottom <= 2111 && rect.left >= 0 && rect.right <= 1080) { + AccessibilityNodeInfo liebiaokongg = AblViewUtil.findByText("广告", 0); + if (liebiaokongg != null) { + liebiaokongg.getBoundsInScreen(rect); + } + if (liebiaokongg != null) { + Log.e("TIAOSHI###", "此视频包含广告"); + AblStepHandler.sendMsg(AblSteps.STEP_31); + return; + } + AccessibilityNodeInfo zhibojian = AblViewUtil.findByText("点击进入直播间", 0); + if (zhibojian != null) { + Log.e("TIAOSHI###", "此视频包含点击进入直播间"); + AblStepHandler.sendMsg(AblSteps.STEP_31); + return; + } + AccessibilityNodeInfo guangbo = AblViewUtil.findByText("广播", 0); + if (guangbo != null) { + Log.e("TIAOSHI###", "此视频包含广播"); + AblStepHandler.sendMsg(AblSteps.STEP_31); + return; + } + AccessibilityNodeInfo xiangqing = AblViewUtil.findByText("查看详情", 0); + if (xiangqing != null) { + Log.e("TIAOSHI###", "此视频包含查看详情"); + AblStepHandler.sendMsg(AblSteps.STEP_31); + return; + } + //如果有查看详情,则滑动到下一个视频 + zhijieshanghua(); } + AblStepHandler.sendMsg(AblSteps.STEP_29); } - AblStepHandler.sendMsg(AblSteps.STEP_29); + + break; @@ -169,11 +177,11 @@ public class TestAblStepXin5 extends BaseAblStep { ChangLiang.condition = "0"; boolean guanzhu = isGuanzhu(); - if (!guanzhu) { + if(!guanzhu) { boolean condition = getCondition(); - if ((condition)) { + if ((condition)){ ChangLiang.condition = "0"; - } else { + }else { ChangLiang.condition = "1"; } } @@ -203,11 +211,11 @@ public class TestAblStepXin5 extends BaseAblStep { } ChangLiang.condition = "0"; boolean guanzhu = isGuanzhu(); - if (!guanzhu) { + if(!guanzhu) { boolean condition = getCondition(); - if ((condition)) { + if ((condition)){ ChangLiang.condition = "0"; - } else { + }else { ChangLiang.condition = "1"; } } @@ -222,32 +230,32 @@ public class TestAblStepXin5 extends BaseAblStep { } break; case AblSteps.STEP_30: - //加关注(659,576) 加关注有最大关注数的条件限制 - int maxnumber = Integer.parseInt(userProfie.getMaxnumcon()); - if (ChangLiang.guanzhunum < maxnumber) { - //满足条件执行点赞关注评论 - if (ChangLiang.condition.equals("0")) { - AblViewUtil.back(); - Log.e("TIAOSHI###", "满足点赞关注评论条件" + ChangLiang.condition); - operation(); + //加关注(659,576) 加关注有最大关注数的条件限制 + int maxnumber = Integer.parseInt(userProfie.getMaxnumcon()); + if (ChangLiang.guanzhunum < maxnumber) { + //满足条件执行点赞关注评论 + if (ChangLiang.condition.equals("0")) { + AblViewUtil.back(); + Log.e("TIAOSHI###", "满足点赞关注评论条件"+ ChangLiang.condition); + operation(); + } else { + Log.e("TIAOSHI###", "不满足点赞关注评论条件"); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + } + AblService.getInstance().randomSwipetwo(); + int num = ChangLiang.tasknum; + Log.e("TIAOSHI###", "执行第" + num + "次循环"); + int num1 = num + 1; + ChangLiang.tasknum = num1; + AblStepHandler.sendMsg(AblSteps.STEP_28); } else { - Log.e("TIAOSHI###", "不满足点赞关注评论条件"); + Log.e("TIAOSHI###", "已经达到最大关注数,停止自动加关"); + ToastUtils.showShort("已经达到最大关注数,停止自动加关"); AblViewUtil.back(); - AblViewUtil.mySleep(1); + AblStepHandler.getInstance().setStop(true); + AblViewUtil.onMessage("停止"); } - AblService.getInstance().randomSwipetwo(); - int num = ChangLiang.tasknum; - Log.e("TIAOSHI###", "执行第" + num + "次循环"); - int num1 = num + 1; - ChangLiang.tasknum = num1; - AblStepHandler.sendMsg(AblSteps.STEP_28); - } else { - Log.e("TIAOSHI###", "已经达到最大关注数,停止自动加关"); - ToastUtils.showShort("已经达到最大关注数,停止自动加关"); - AblViewUtil.back(); - AblStepHandler.getInstance().setStop(true); - AblViewUtil.onMessage("停止"); - } break; case AblSteps.STEP_31: @@ -260,7 +268,7 @@ public class TestAblStepXin5 extends BaseAblStep { private boolean getCondition() { - boolean flag = false; + boolean flag=false; AblViewUtil.mySleep(1); getargone(); //判断作品数条件 @@ -269,35 +277,33 @@ public class TestAblStepXin5 extends BaseAblStep { boolean b1 = guanzhuCon(); AblViewUtil.mySleep(1); boolean b = fensiCon(); - // if(b&&b1){ - if (b && b1 && getargfour) { - flag = true; + // if(b&&b1){ + if(b&&b1&&getargfour){ + flag=true; } return flag; } /** * 是否关注过 - * * @return */ private boolean isGuanzhu() { - boolean flag = false; + boolean flag=false; String getquxiaoguanzhu = getquxiaoguanzhu(); if (getquxiaoguanzhu.equals("0")) { Log.e("TIAOSHI###", "已经关注了,直接返回"); - flag = true; + flag=true; } return flag; } /** * 关注数条件判断 - * * @return */ private boolean guanzhuCon() { - boolean flag = true; + boolean flag=true; if (guanzhunum != null) { if (!guanzhunum.equals("-")) { if (guanzhunum.contains("w")) { @@ -309,23 +315,23 @@ public class TestAblStepXin5 extends BaseAblStep { } if (Integer.parseInt(guanzhunum) < Integer.parseInt(userProfie.getMinimumlikes()) || Integer.parseInt(guanzhunum) > Integer.parseInt(userProfie.getMaxmumlikes())) { Log.e("TIAOSHI###", "获取的该用户关注数" + Integer.parseInt(guanzhunum) + "小于设置的加关关注数(不在区间" + Integer.parseInt(userProfie.getMinimumlikes()) + "-" + Integer.parseInt(userProfie.getMaxmumlikes()) + "),关注数不满足条件"); - flag = false; + flag=false; } else { Log.e("TIAOSHI###", "获取的该用户关注数不小于设置的加关关注数,满足加关点赞评论条件"); } } else { - flag = false; + flag=false; } } - return flag; + return flag; } /** * 粉丝数条件判断 */ - private boolean fensiCon() { - boolean flag = true; + private boolean fensiCon() { + boolean flag=true; if (fensinum != null) { boolean status2 = fensinum.contains("w"); boolean status3 = fensinum.contains("亿"); @@ -336,12 +342,12 @@ public class TestAblStepXin5 extends BaseAblStep { if (!fensinum.equals("-")) { if (Integer.parseInt(fensinum) < Integer.parseInt(userProfie.getMinimumcon()) || Integer.parseInt(fensinum) > Integer.parseInt(userProfie.getMaximumcon())) { Log.e("TIAOSHI###", "获取的该用户粉丝数" + Integer.parseInt(fensinum) + "小于设置的加关粉丝数(不在区间" + Integer.parseInt(userProfie.getMinimumcon()) + "-" + Integer.parseInt(userProfie.getMaximumcon()) + "),粉丝数不满足条件"); - flag = false; + flag=false; } else { Log.e("TIAOSHI###", "获取的该用户粉丝数不小于设置的加关粉丝数,满足加关点赞评论条件"); } } else { - flag = false; + flag=false; } } } @@ -491,19 +497,19 @@ public class TestAblStepXin5 extends BaseAblStep { AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); for (int j = 0; j < rootttt.getChildCount(); j++) { AccessibilityNodeInfo child = rootttt.getChild(j); - // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); if (!"dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { - // Log.e("TIAOSHI###ViewPager", "----2Node:" + child.getChildCount()); + 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()); + Log.e("TIAOSHI###", "----2Node:" + child1.getClassName() + ":" + child1.getText()); // if ("android.widget.LinearLayout".equals(child1.getClassName())) { for (int x = 0; x < child1.getChildCount(); x++) { AccessibilityNodeInfo child6 = child1.getChild(x); - // Log.e("TIAOSHI###", "----3Node:" + child6.getClassName() + ":" + child6.getText()); + Log.e("TIAOSHI###", "----3Node:" + child6.getClassName() + ":" + child6.getText()); if ("android.widget.EditText".equals(child6.getClassName())) { infooos = child1.getChild(x); - // Log.e("TIAOSHI###", "----4Node:" + infooos.getClassName() + ":" + infooos.getText()); + Log.e("TIAOSHI###", "----4Node:" + infooos.getClassName() + ":" + infooos.getText()); } } } @@ -521,16 +527,16 @@ public class TestAblStepXin5 extends BaseAblStep { AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); for (int j = 0; j < rootttt.getChildCount(); j++) { AccessibilityNodeInfo child = rootttt.getChild(j); - // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText()); + 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 child2 = child.getChild(y); - // Log.e("TIAOSHI###", "----2Node:" + child2.getClassName() + ":" + child2.getText()); + Log.e("TIAOSHI###", "----2Node:" + child2.getClassName() + ":" + child2.getText()); for (int x = 0; x < child2.getChildCount(); x++) { AccessibilityNodeInfo child1 = child2.getChild(x); - // Log.e("TIAOSHI###", "----3Node:" + child1.getClassName() + ":" + child1.getText()); + Log.e("TIAOSHI###", "----3Node:" + child1.getClassName() + ":" + child1.getText()); if ("android.widget.ImageView".equals(child2.getChild(x).getClassName())) { AccessibilityNodeInfo infooos = child2.getChild(x); @@ -649,14 +655,12 @@ public class TestAblStepXin5 extends BaseAblStep { if (text.length() > 2) { zuopinnum = child2.getText().toString().substring(3); Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum); - if (StringUtils.isDigit(zuopinnum)) { - if (!zuopinnum.equals("-") && zuopinnum != null) { - if (Integer.parseInt(zuopinnum) < Integer.parseInt(userProfie.getMinimumzuopin()) || Integer.parseInt(zuopinnum) > Integer.parseInt(userProfie.getMaxmumzuopin())) { - Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(userProfie.getMinimumzuopin()) + "-" + Integer.parseInt(userProfie.getMaxmumzuopin()) + "),作品数不满足条件"); - flag = false; - } else { - Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件"); - } + if (!zuopinnum.equals("-") && zuopinnum != null) { + if (Integer.parseInt(zuopinnum) < Integer.parseInt(userProfie.getMinimumzuopin()) || Integer.parseInt(zuopinnum) > Integer.parseInt(userProfie.getMaxmumzuopin())) { + Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(userProfie.getMinimumzuopin()) + "-" + Integer.parseInt(userProfie.getMaxmumzuopin()) + "),作品数不满足条件"); + flag=false; + } else { + Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件"); } } } @@ -666,7 +670,67 @@ public class TestAblStepXin5 extends BaseAblStep { } } } - return flag; + return flag; + } + + + + /** + * 直接上滑 + */ + 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); + } } @@ -755,13 +819,13 @@ public class TestAblStepXin5 extends BaseAblStep { public boolean runTime() { boolean ifruntime = false; Long diff = DateUtils.diff(userProfie.getLivetimefir(), userProfie.getLivetime()); - Log.e("TIAOSHI###", "----当前的时间:" + userProfie.getLivetime()); + Log.e("TIAOSHI###", "----当前的时间:" + userProfie.getLivetime()); Log.e("TIAOSHI###", "----第一次的时间:" + userProfie.getLivetimefir()); Log.e("TIAOSHI###", "----目前运行的时间:" + diff); - String runtime = Integer.parseInt(userProfie.getRunningtime()) + ""; + String runtime = Integer.parseInt(userProfie.getRunningtime()) +""; Log.e("TIAOSHI###", "----总运行的时间:" + runtime + "小时"); Long ltwo = Long.parseLong(runtime); - if (diff.longValue() >= ltwo.longValue() * 60 * 60 * 1000) { + if (diff.longValue() >= ltwo.longValue() * 60 * 60 * 1000) { ifruntime = true; } return ifruntime; @@ -769,18 +833,18 @@ public class TestAblStepXin5 extends BaseAblStep { public boolean runTimetwo(String end_time) { boolean ifruntime = false; - Date date = new Date(); + Date date=new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - String dateString = end_time; - Date date2 = null; + String dateString=end_time; + Date date2= null; try { date2 = sdf.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } - if (date.getTime() < date2.getTime()) { - Log.e("TIAOSHI1###", date + "没有到设定的时间"); - } else { + if(date.getTime() + android:background="@mipmap/icon_dav" /> + + + + + + + + + + + + +