This commit is contained in:
2021-10-09 18:24:53 +08:00
parent 14d0786fc1
commit 62812f9baa
13 changed files with 339 additions and 260 deletions

Binary file not shown.

View File

@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":168,"versionName":"1.6.8","enabled":true,"outputFile":"atom-latest.apk","fullName":"release","baseName":"release"},"path":"atom-latest.apk","properties":{}}] [{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":170,"versionName":"1.7.0","enabled":true,"outputFile":"atom-latest.apk","fullName":"release","baseName":"release"},"path":"atom-latest.apk","properties":{}}]

View File

@@ -151,7 +151,7 @@ public class AblService extends AccessibilityService {
String str = charSequence.toString(); String str = charSequence.toString();
// Log.w("TIAOSHI", "有弹出==" + str + "==classname==" + classname); // Log.w("TIAOSHI", "有弹出==" + str + "==classname==" + classname);
String s = charSequence.toString(); String s = charSequence.toString();
Log.w("TIAOSHI", "有弹出==" + s + "==classname==" + classname); Log.e("TIAOSHI", "有弹出==55555" + s + "==classname==" + classname);
if (!TextUtils.isEmpty(s)) { if (!TextUtils.isEmpty(s)) {
EventBus.getDefault().post(new SixEvent("success", s)); EventBus.getDefault().post(new SixEvent("success", s));
} }

View File

@@ -352,18 +352,20 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
public boolean allowed() { public boolean allowed() {
boolean ifOpen = false; boolean ifOpen = false;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) { if(root!=null) {
AccessibilityNodeInfo child = root.getChild(i); for (int i = 0; i < root.getChildCount(); i++) {
// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); AccessibilityNodeInfo child = root.getChild(i);
if ("android.widget.TextView".equals(child.getClassName())) { // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
if(child.getText()!=null) { if ("android.widget.TextView".equals(child.getClassName())) {
if (child.getText().toString().contains("正在尝试开启") || child.getText().toString().contains("是否允许")) { if (child.getText() != null) {
int childCount = root.getChildCount(); if (child.getText().toString().contains("正在尝试开启") || child.getText().toString().contains("是否允许")) {
AccessibilityNodeInfo child1 = root.getChild(childCount - 1); int childCount = root.getChildCount();
clickNodeInfo(child1, "点击了允许"); AccessibilityNodeInfo child1 = root.getChild(childCount - 1);
clickNodeInfo(child1, "点击了允许");
}
} }
ifOpen = true;
} }
ifOpen = true;
} }
} }
return ifOpen; return ifOpen;
@@ -437,4 +439,55 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
return infooos; 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());
//
// }
// }
// }
// }
}
}
}
}
}
}
} }

View File

@@ -449,6 +449,35 @@ public class AblViewUtil {
} }
/**
* 判断当前页面是否包含某文本
*/
public static boolean isContainText(String str) {
boolean flag = false;
List<AccessibilityNodeInfo> nodeInfos = AblViewUtil.findByText(str);
for (int i=0;i<nodeInfos.size();i++){
AccessibilityNodeInfo child = nodeInfos.get(i);
Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child);
Rect rect = new Rect();
child.getBoundsInScreen(rect);
if(rect.left>0&&rect.top>0&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) {
Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child);
flag = true;
}
}
return flag;
}
/**
* 查看节点的坐标点
*/
public static void nodeZuobiao(AccessibilityNodeInfo nodeinfo){
Rect rect = new Rect();
nodeinfo.getBoundsInScreen(rect);
Log.e("TIAOSHI###", "----显示节点的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")");
}
/** /**
* @param * @param
@@ -490,8 +519,6 @@ public class AblViewUtil {
/** /**
*
* @param nikename 方法内字符串变量 * @param nikename 方法内字符串变量
* @param child1 * @param child1
* @param numt 上坐标点 * @param numt 上坐标点

View File

@@ -122,7 +122,7 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
* 进入第一个直播间 * 进入第一个直播间
*/ */
public void enterOneNodeInfo() { public void enterOneNodeInfo() {
AblService.getInstance().clickPoint(121, 379, 300); AblService.getInstance().clickPoint(321, 379, 300);
} }

View File

@@ -24,6 +24,7 @@ import com.fisherbone.fuzhu.entity.LiwuBean;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* 获得作品时间 * 获得作品时间
@@ -43,81 +44,37 @@ public class TestAblStep0 extends BaseAblStep {
break; break;
case AblSteps.STEP_2: case AblSteps.STEP_2:
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
// getNodeInfoh(); // getNodeInfoh();
// AblService.getInstance().randomSwipetwo();
// ArrayList<AccessibilityNodeInfo> nodeInfodh = getNodeInfodh();
// AccessibilityNodeInfo nodeInfo = nodeInfodh.get(0);
// clickcommontwo(nodeInfo,"");
// geliwu("");
// ArrayList<AccessibilityNodeInfo> getrecy = getrecy();
// Log.e("TIAOSHI###", "向上滑动");
// getrecy.get(1).performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); //触发容器元素的滚动事件
clickGuanzhu();
DianSou();
AblViewUtil.mySleep(2);
selecttype("1");
AblViewUtil.mySleep(2);
AblViewUtil.mySleep(2);
//用坐标点的方式点击第一条 0256 720404
//华为畅享20
AblService.getInstance().clickPoint(790, 456, 300);
// AblService.getInstance().clickPoint(540, 478, 300);
break; break;
default: default:
} }
} }
/** /**
* 添加关注 * 寻找控件
*/ */
private void getdouyin() { public ArrayList<AccessibilityNodeInfo> getNodeInfodh() {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); ArrayList<AccessibilityNodeInfo> accessibilityNodeInfos = new ArrayList<>();
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());
if(child1!=null) {
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);
}
}
}
}
}
}
}
}
}
}
}
}
private void clickGuanzhu() {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) { for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i); AccessibilityNodeInfo child = root.getChild(i);
@@ -127,20 +84,22 @@ public class TestAblStep0 extends BaseAblStep {
AccessibilityNodeInfo child1 = child.getChild(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); nodeZuobiao(child1);
Rect rect = new Rect(); for (int j = 0; j < child1.getChildCount(); j++) {
child1.getBoundsInScreen(rect); AccessibilityNodeInfo child2 = child1.getChild(j);
if (rect.top >= 800 && rect.bottom <= 1366) { Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
if ("android.widget.TextView".equals(child1.getClassName())) { nodeZuobiao(child2);
if(child1.getText()!=null) { for (int x = 0; x < child2.getChildCount(); x++) {
if ("关注".equals(child1.getText().toString())) { AccessibilityNodeInfo child3 = child2.getChild(x);
clickcommontwo(child1, "关注"); Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
break; nodeZuobiao(child3);
} if("android.widget.FrameLayout".equals(child3.getClassName())){
accessibilityNodeInfos.add(child3);
} }
} }
} }
} }
} }
return accessibilityNodeInfos;
} }
} }

View File

@@ -11,6 +11,7 @@ import com.fisherbone.fuzhu.abllib.AblStepHandler;
import com.fisherbone.fuzhu.abllib.AblSteps; import com.fisherbone.fuzhu.abllib.AblSteps;
import com.fisherbone.fuzhu.abllib.BaseAblStep; import com.fisherbone.fuzhu.abllib.BaseAblStep;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -67,7 +68,7 @@ public class TestAblStep24 extends BaseAblStep {
selecttype("1"); selecttype("1");
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
//用坐标点的方式点击第一条 0256 720404 //用坐标点的方式点击第一条 0256 720404
AblService.getInstance().clickPoint(540, 456, 300); AblService.getInstance().clickPoint(790, 456, 300);
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
getfensi(); getfensi();
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
@@ -329,14 +330,16 @@ public class TestAblStep24 extends BaseAblStep {
if (status) { if (status) {
if (text.length() > 2) { if (text.length() > 2) {
String zuopinnum = child3.getText().toString().substring(3); String zuopinnum = child3.getText().toString().substring(3);
Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum); if (StringUtils.isDigit(zuopinnum)) {
if (Integer.parseInt(zuopinnum) < Integer.parseInt(ChangLiang.dav_minimumzuopin) || Integer.parseInt(zuopinnum) > Integer.parseInt(ChangLiang.dav_maxmumzuopin)) { Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum);
Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(ChangLiang.dav_minimumzuopin) + "-" + Integer.parseInt(ChangLiang.dav_maxmumzuopin) + "),作品数不满足条件"); if (Integer.parseInt(zuopinnum) < Integer.parseInt(ChangLiang.dav_minimumzuopin) || Integer.parseInt(zuopinnum) > Integer.parseInt(ChangLiang.dav_maxmumzuopin)) {
AblViewUtil.onMessage("作品数不满足条件"); Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(ChangLiang.dav_minimumzuopin) + "-" + Integer.parseInt(ChangLiang.dav_maxmumzuopin) + ")作品数不满足条件");
ChangLiang.dav_condition = "1"; AblViewUtil.onMessage("作品数不满足条件");
return; ChangLiang.dav_condition = "1";
} else { return;
Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件"); } else {
Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件");
}
} }
} }
} }

View File

@@ -57,7 +57,7 @@ public class TestAblStep31 extends HongbaoBase {
AblViewUtil.mySleep(3); AblViewUtil.mySleep(3);
allowed(); allowed();
AblViewUtil.mySleep(5); AblViewUtil.mySleep(5);
Log.e("TIAOSHI###", "是否抢红包"+ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()+""); Log.e("TIAOSHI###", "是否抢红包" + ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive() + "");
if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) {
AblService.getInstance().clickPoint(90, 163, 300); AblService.getInstance().clickPoint(90, 163, 300);
AblViewUtil.mySleep(3); AblViewUtil.mySleep(3);
@@ -128,9 +128,9 @@ public class TestAblStep31 extends HongbaoBase {
*/ */
private void huodong() { private void huodong() {
if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) {
AblService.getInstance().randomSwipetwo(); AblService.getInstance().randomSwipetwo();
AblViewUtil.mySleep(3); AblViewUtil.mySleep(3);
AblStepHandler.sendMsg(AblSteps.STEP_222); AblStepHandler.sendMsg(AblSteps.STEP_222);
} }
if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchsix()) { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchsix()) {
if (slidingDir) { if (slidingDir) {
@@ -217,19 +217,7 @@ public class TestAblStep31 extends HongbaoBase {
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
int pagetype = pagetype(); int pagetype = pagetype();
if (pagetype == 1) { if (pagetype == 1) {
AblViewUtil.mySleep(1); operationYouhui();
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) { } else if (pagetype == 2) {
jiluBeans.add("福袋"); jiluBeans.add("福袋");
boolean enterfensituan = enterfensituan(); boolean enterfensituan = enterfensituan();
@@ -254,10 +242,6 @@ public class TestAblStep31 extends HongbaoBase {
} else if (pagetype == 21) { } else if (pagetype == 21) {
jiluBeans.add("红包"); jiluBeans.add("红包");
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
if (!ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchthree()) {
AblService.getInstance().clickPoint(100, 100, 300);
AblViewUtil.mySleep(1);
}
if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchthree()) { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchthree()) {
boolean getdoubi = getdoubi(); boolean getdoubi = getdoubi();
if (getdoubi) { if (getdoubi) {
@@ -265,9 +249,11 @@ public class TestAblStep31 extends HongbaoBase {
} else { } else {
Log.e("TIAOSHI###", "----抖币数不够条件"); Log.e("TIAOSHI###", "----抖币数不够条件");
} }
break; }else {
AblService.getInstance().clickPoint(100, 100, 300);
AblViewUtil.mySleep(1);
} }
break;
} else if (pagetype == 4) { } else if (pagetype == 4) {
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
AblService.getInstance().clickPoint(100, 100, 300); AblService.getInstance().clickPoint(100, 100, 300);
@@ -281,6 +267,25 @@ 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###", "优惠卷弹框关闭了");
}
}
/** /**
* 获取参与抢福袋的条件值 * 获取参与抢福袋的条件值
* *
@@ -326,11 +331,11 @@ public class TestAblStep31 extends HongbaoBase {
// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText() + ":" + child7.getContentDescription()); // Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText() + ":" + child7.getContentDescription());
for (int u = 0; u < child7.getChildCount(); u++) { for (int u = 0; u < child7.getChildCount(); u++) {
AccessibilityNodeInfo child8 = child7.getChild(u); AccessibilityNodeInfo child8 = child7.getChild(u);
Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription()); // Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription());
nodeZuobiao(child8); // nodeZuobiao(child8);
Rect rect = new Rect(); Rect rect = new Rect();
child8.getBoundsInScreen(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 (SHEBEITIPE_VILUETHREE.equals(ChangLiang.phonetype)) {
if (rect.top >= 1351 && rect.bottom <= 1459 && rect.left >= 91 && rect.right <= 273) { if (rect.top >= 1351 && rect.bottom <= 1459 && rect.left >= 91 && rect.right <= 273) {
@@ -397,8 +402,8 @@ public class TestAblStep31 extends HongbaoBase {
} }
for (int q = 0; q < child8.getChildCount(); q++) { for (int q = 0; q < child8.getChildCount(); q++) {
AccessibilityNodeInfo child9 = child8.getChild(q); AccessibilityNodeInfo child9 = child8.getChild(q);
Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); // Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription());
nodeZuobiao(child9); // nodeZuobiao(child9);
if ("android.view.View".equals(child9.getClassName())) { if ("android.view.View".equals(child9.getClassName())) {
String text = child9.getText().toString(); String text = child9.getText().toString();
if (!TextUtils.isEmpty(text)) { if (!TextUtils.isEmpty(text)) {
@@ -453,7 +458,9 @@ public class TestAblStep31 extends HongbaoBase {
Log.e("TIAOSHI###", "noqinmidu==" + noqinmidu); Log.e("TIAOSHI###", "noqinmidu==" + noqinmidu);
if (timeconditions && winningpro && noqinmidu) { if (timeconditions && winningpro && noqinmidu) {
conditions = true; conditions = true;
Log.e("TIAOSHI###", "是否满足条件1==" + conditions);
} }
Log.e("TIAOSHI###", "是否满足条件2==" + conditions);
return conditions; return conditions;
} }
@@ -508,8 +515,8 @@ public class TestAblStep31 extends HongbaoBase {
// Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription()); // Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText() + ":" + child8.getContentDescription());
for (int q = 0; q < child8.getChildCount(); q++) { for (int q = 0; q < child8.getChildCount(); q++) {
AccessibilityNodeInfo child9 = child8.getChild(q); AccessibilityNodeInfo child9 = child8.getChild(q);
Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription()); // Log.e("TIAOSHI###", "----10Node:" + child9.getClassName() + ":" + child9.getText() + ":" + child9.getContentDescription());
nodeZuobiao(child9); // nodeZuobiao(child9);
if ("android.view.View".equals(child9.getClassName())) { if ("android.view.View".equals(child9.getClassName())) {
String text = child9.getText().toString(); String text = child9.getText().toString();
if (!TextUtils.isEmpty(text)) { if (!TextUtils.isEmpty(text)) {
@@ -574,7 +581,7 @@ public class TestAblStep31 extends HongbaoBase {
@Override @Override
public void accept(Long aLong) throws Exception { public void accept(Long aLong) throws Exception {
long b = a - aLong; long b = a - aLong;
Log.e("TIAOSHI###", b + ""); Log.e("TIAOSHI###福袋", b + "");
if (b == 30) { if (b == 30) {
//打开福袋 //打开福袋
if (ifControlView()) { if (ifControlView()) {
@@ -612,19 +619,7 @@ public class TestAblStep31 extends HongbaoBase {
int pagetype = pagetype(); int pagetype = pagetype();
if (pagetype == 1) { if (pagetype == 1) {
Log.e("TIAOSHI###", "福袋测试1"); Log.e("TIAOSHI###", "福袋测试1");
AblViewUtil.mySleep(1); operationYouhui();
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) { } else if (pagetype == 2) {
break; break;
} else if (pagetype == 21) { } else if (pagetype == 21) {
@@ -817,7 +812,7 @@ public class TestAblStep31 extends HongbaoBase {
// nodeZuobiao(child); // nodeZuobiao(child);
for (int y = 0; y < child.getChildCount(); y++) { for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(y); AccessibilityNodeInfo child1 = child.getChild(y);
nodeZuobiao(child1); // nodeZuobiao(child1);
Rect rect = new Rect(); Rect rect = new Rect();
child1.getBoundsInScreen(rect); child1.getBoundsInScreen(rect);
if (rect.top >= 1192 && rect.bottom <= 1286) { if (rect.top >= 1192 && rect.bottom <= 1286) {
@@ -838,8 +833,8 @@ public class TestAblStep31 extends HongbaoBase {
AblService.getInstance().clickPoint(540, 1239, 300); AblService.getInstance().clickPoint(540, 1239, 300);
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
AblViewUtil.back(); AblViewUtil.back();
AblStepHandler.sendMsg(AblSteps.STEP_222);
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
AblStepHandler.sendMsg(AblSteps.STEP_222);
} }
} }
@@ -847,7 +842,7 @@ public class TestAblStep31 extends HongbaoBase {
private void qiangHongbao(AccessibilityNodeInfo child1) { private void qiangHongbao(AccessibilityNodeInfo child1) {
String s = child1.getText().toString(); String s = child1.getText().toString();
int daojishimiao = daojishimiao(s); int daojishimiao = daojishimiao(s);
String qiehuantime = "60"; String qiehuantime = "90";
int qihuanshijian = Integer.valueOf(qiehuantime); int qihuanshijian = Integer.valueOf(qiehuantime);
if (daojishimiao < qihuanshijian) { if (daojishimiao < qihuanshijian) {
Log.e("TIAOSHI###", "时间在" + qihuanshijian + "秒内"); Log.e("TIAOSHI###", "时间在" + qihuanshijian + "秒内");
@@ -885,7 +880,7 @@ public class TestAblStep31 extends HongbaoBase {
@Override @Override
public void accept(Long aLong) throws Exception { public void accept(Long aLong) throws Exception {
long b = a - aLong; long b = a - aLong;
Log.e("TIAOSHI###", b + ""); Log.e("TIAOSHI###红包", b + "");
} }
}) })
.doOnComplete(new Action() { .doOnComplete(new Action() {

View File

@@ -23,6 +23,7 @@ import com.fisherbone.fuzhu.okgonet.HttpConstants;
import com.fisherbone.fuzhu.okgonet.NetApi; import com.fisherbone.fuzhu.okgonet.NetApi;
import com.fisherbone.fuzhu.utils.DateUtils; import com.fisherbone.fuzhu.utils.DateUtils;
import com.fisherbone.fuzhu.utils.ProfileSpUtils; import com.fisherbone.fuzhu.utils.ProfileSpUtils;
import com.fisherbone.fuzhu.utils.StringUtils;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response; import com.lzy.okgo.model.Response;
@@ -55,7 +56,7 @@ public class TestAblStepXin5 extends BaseAblStep {
public TestAblStepXin5(Context nContext) { public TestAblStepXin5(Context nContext) {
super(); super();
this.mContext=nContext; this.mContext = nContext;
} }
@Override @Override
@@ -63,7 +64,7 @@ public class TestAblStepXin5 extends BaseAblStep {
switch (step) { switch (step) {
case AblSteps.STEP_9: case AblSteps.STEP_9:
isStart = true; isStart = true;
ChangLiang.guanzhunum=0; ChangLiang.guanzhunum = 0;
userProfie = ProfileSpUtils.getInstance().getUserProfie(); userProfie = ProfileSpUtils.getInstance().getUserProfie();
AblViewUtil.startApplication(); AblViewUtil.startApplication();
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
@@ -88,21 +89,18 @@ public class TestAblStepXin5 extends BaseAblStep {
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
AblStepHandler.sendMsg(AblSteps.STEP_28); AblStepHandler.sendMsg(AblSteps.STEP_28);
// LiveEventBus.get("jiaguantime").post(Integer.parseInt(userProfie.getRunningtime()) * 3600+""); // LiveEventBus.get("jiaguantime").post(Integer.parseInt(userProfie.getRunningtime()) * 3600+"");
break; break;
case AblSteps.STEP_28: case AblSteps.STEP_28:
recordDoubi(DateUtils.getNowString()); recordDoubi(DateUtils.getNowString());
Log.e("TIAOSHI###", "初始时间" + userProfie.getLivetimefir()); Log.e("TIAOSHI###", "初始时间" + userProfie.getLivetimefir());
Log.e("TIAOSHI###", "当前时间" + userProfie.getLivetime()); 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(); boolean redswitchone = ProfileSpUtils.getInstance().getSetBean().isRedswitchone();
Log.e("TIAOSHI###", "当前sp==" + redswitchone); Log.e("TIAOSHI###", "当前sp,false表示本地true表示云端==" + redswitchone);
if(redswitchone){ if (redswitchone) {
ifend = runTimetwo(userProfie.getEnd_time()); ifend = runTimetwo(userProfie.getEnd_time());
}else { } else {
ifend = runTime(); ifend = runTime();
} }
if (ifend) { if (ifend) {
@@ -118,42 +116,30 @@ public class TestAblStepXin5 extends BaseAblStep {
AblViewUtil.mySleep(2 + randnum); AblViewUtil.mySleep(2 + randnum);
} }
Rect rect = new Rect(); if (AblViewUtil.isContainText("广告")) {
if (rect.top >= 0 && rect.bottom <= 2111 && rect.left >= 0 && rect.right <= 1080) { Log.e("TIAOSHI###", "此视频包含广告");
AccessibilityNodeInfo liebiaokongg = AblViewUtil.findByText("广告", 0); AblStepHandler.sendMsg(AblSteps.STEP_31);
if (liebiaokongg != null) { return;
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); 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;
}
//如果有查看详情,则滑动到下一个视频
zhijieshanghua();
} }
AblStepHandler.sendMsg(AblSteps.STEP_29);
break; break;
@@ -177,11 +163,11 @@ public class TestAblStepXin5 extends BaseAblStep {
ChangLiang.condition = "0"; ChangLiang.condition = "0";
boolean guanzhu = isGuanzhu(); boolean guanzhu = isGuanzhu();
if(!guanzhu) { if (!guanzhu) {
boolean condition = getCondition(); boolean condition = getCondition();
if ((condition)){ if ((condition)) {
ChangLiang.condition = "0"; ChangLiang.condition = "0";
}else { } else {
ChangLiang.condition = "1"; ChangLiang.condition = "1";
} }
} }
@@ -211,11 +197,11 @@ public class TestAblStepXin5 extends BaseAblStep {
} }
ChangLiang.condition = "0"; ChangLiang.condition = "0";
boolean guanzhu = isGuanzhu(); boolean guanzhu = isGuanzhu();
if(!guanzhu) { if (!guanzhu) {
boolean condition = getCondition(); boolean condition = getCondition();
if ((condition)){ if ((condition)) {
ChangLiang.condition = "0"; ChangLiang.condition = "0";
}else { } else {
ChangLiang.condition = "1"; ChangLiang.condition = "1";
} }
} }
@@ -230,32 +216,32 @@ public class TestAblStepXin5 extends BaseAblStep {
} }
break; break;
case AblSteps.STEP_30: case AblSteps.STEP_30:
//加关注(659,576) 加关注有最大关注数的条件限制 //加关注(659,576) 加关注有最大关注数的条件限制
int maxnumber = Integer.parseInt(userProfie.getMaxnumcon()); int maxnumber = Integer.parseInt(userProfie.getMaxnumcon());
if (ChangLiang.guanzhunum < maxnumber) { if (ChangLiang.guanzhunum < maxnumber) {
//满足条件执行点赞关注评论 //满足条件执行点赞关注评论
if (ChangLiang.condition.equals("0")) { 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###", "已经达到最大关注数,停止自动加关");
ToastUtils.showShort("已经达到最大关注数,停止自动加关");
AblViewUtil.back(); AblViewUtil.back();
AblStepHandler.getInstance().setStop(true); Log.e("TIAOSHI###", "满足点赞关注评论条件" + ChangLiang.condition);
AblViewUtil.onMessage("停止"); 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###", "已经达到最大关注数,停止自动加关");
ToastUtils.showShort("已经达到最大关注数,停止自动加关");
AblViewUtil.back();
AblStepHandler.getInstance().setStop(true);
AblViewUtil.onMessage("停止");
}
break; break;
case AblSteps.STEP_31: case AblSteps.STEP_31:
@@ -268,7 +254,7 @@ public class TestAblStepXin5 extends BaseAblStep {
private boolean getCondition() { private boolean getCondition() {
boolean flag=false; boolean flag = false;
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
getargone(); getargone();
//判断作品数条件 //判断作品数条件
@@ -277,33 +263,35 @@ public class TestAblStepXin5 extends BaseAblStep {
boolean b1 = guanzhuCon(); boolean b1 = guanzhuCon();
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
boolean b = fensiCon(); boolean b = fensiCon();
// if(b&&b1){ // if(b&&b1){
if(b&&b1&&getargfour){ if (b && b1 && getargfour) {
flag=true; flag = true;
} }
return flag; return flag;
} }
/** /**
* 是否关注过 * 是否关注过
*
* @return * @return
*/ */
private boolean isGuanzhu() { private boolean isGuanzhu() {
boolean flag=false; boolean flag = false;
String getquxiaoguanzhu = getquxiaoguanzhu(); String getquxiaoguanzhu = getquxiaoguanzhu();
if (getquxiaoguanzhu.equals("0")) { if (getquxiaoguanzhu.equals("0")) {
Log.e("TIAOSHI###", "已经关注了,直接返回"); Log.e("TIAOSHI###", "已经关注了,直接返回");
flag=true; flag = true;
} }
return flag; return flag;
} }
/** /**
* 关注数条件判断 * 关注数条件判断
*
* @return * @return
*/ */
private boolean guanzhuCon() { private boolean guanzhuCon() {
boolean flag=true; boolean flag = true;
if (guanzhunum != null) { if (guanzhunum != null) {
if (!guanzhunum.equals("-")) { if (!guanzhunum.equals("-")) {
if (guanzhunum.contains("w")) { if (guanzhunum.contains("w")) {
@@ -315,23 +303,23 @@ public class TestAblStepXin5 extends BaseAblStep {
} }
if (Integer.parseInt(guanzhunum) < Integer.parseInt(userProfie.getMinimumlikes()) || Integer.parseInt(guanzhunum) > Integer.parseInt(userProfie.getMaxmumlikes())) { 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()) + "),关注数不满足条件"); Log.e("TIAOSHI###", "获取的该用户关注数" + Integer.parseInt(guanzhunum) + "小于设置的加关关注数(不在区间" + Integer.parseInt(userProfie.getMinimumlikes()) + "-" + Integer.parseInt(userProfie.getMaxmumlikes()) + "),关注数不满足条件");
flag=false; flag = false;
} else { } else {
Log.e("TIAOSHI###", "获取的该用户关注数不小于设置的加关关注数,满足加关点赞评论条件"); Log.e("TIAOSHI###", "获取的该用户关注数不小于设置的加关关注数,满足加关点赞评论条件");
} }
} else { } else {
flag=false; flag = false;
} }
} }
return flag; return flag;
} }
/** /**
* 粉丝数条件判断 * 粉丝数条件判断
*/ */
private boolean fensiCon() { private boolean fensiCon() {
boolean flag=true; boolean flag = true;
if (fensinum != null) { if (fensinum != null) {
boolean status2 = fensinum.contains("w"); boolean status2 = fensinum.contains("w");
boolean status3 = fensinum.contains("亿"); boolean status3 = fensinum.contains("亿");
@@ -342,12 +330,12 @@ public class TestAblStepXin5 extends BaseAblStep {
if (!fensinum.equals("-")) { if (!fensinum.equals("-")) {
if (Integer.parseInt(fensinum) < Integer.parseInt(userProfie.getMinimumcon()) || Integer.parseInt(fensinum) > Integer.parseInt(userProfie.getMaximumcon())) { 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()) + "),粉丝数不满足条件"); Log.e("TIAOSHI###", "获取的该用户粉丝数" + Integer.parseInt(fensinum) + "小于设置的加关粉丝数(不在区间" + Integer.parseInt(userProfie.getMinimumcon()) + "-" + Integer.parseInt(userProfie.getMaximumcon()) + "),粉丝数不满足条件");
flag=false; flag = false;
} else { } else {
Log.e("TIAOSHI###", "获取的该用户粉丝数不小于设置的加关粉丝数,满足加关点赞评论条件"); Log.e("TIAOSHI###", "获取的该用户粉丝数不小于设置的加关粉丝数,满足加关点赞评论条件");
} }
} else { } else {
flag=false; flag = false;
} }
} }
} }
@@ -497,19 +485,19 @@ public class TestAblStepXin5 extends BaseAblStep {
AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow();
for (int j = 0; j < rootttt.getChildCount(); j++) { for (int j = 0; j < rootttt.getChildCount(); j++) {
AccessibilityNodeInfo child = rootttt.getChild(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())) { 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++) { for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(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())) { // if ("android.widget.LinearLayout".equals(child1.getClassName())) {
for (int x = 0; x < child1.getChildCount(); x++) { for (int x = 0; x < child1.getChildCount(); x++) {
AccessibilityNodeInfo child6 = child1.getChild(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())) { if ("android.widget.EditText".equals(child6.getClassName())) {
infooos = child1.getChild(x); infooos = child1.getChild(x);
Log.e("TIAOSHI###", "----4Node:" + infooos.getClassName() + ":" + infooos.getText()); // Log.e("TIAOSHI###", "----4Node:" + infooos.getClassName() + ":" + infooos.getText());
} }
} }
} }
@@ -527,16 +515,16 @@ public class TestAblStepXin5 extends BaseAblStep {
AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow();
for (int j = 0; j < rootttt.getChildCount(); j++) { for (int j = 0; j < rootttt.getChildCount(); j++) {
AccessibilityNodeInfo child = rootttt.getChild(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())) { 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++) { for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child2 = child.getChild(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++) { for (int x = 0; x < child2.getChildCount(); x++) {
AccessibilityNodeInfo child1 = child2.getChild(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())) { if ("android.widget.ImageView".equals(child2.getChild(x).getClassName())) {
AccessibilityNodeInfo infooos = child2.getChild(x); AccessibilityNodeInfo infooos = child2.getChild(x);
@@ -655,12 +643,14 @@ public class TestAblStepXin5 extends BaseAblStep {
if (text.length() > 2) { if (text.length() > 2) {
zuopinnum = child2.getText().toString().substring(3); zuopinnum = child2.getText().toString().substring(3);
Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum); Log.e("TIAOSHI###", "获得的作品数==" + zuopinnum);
if (!zuopinnum.equals("-") && zuopinnum != null) { if (StringUtils.isDigit(zuopinnum)) {
if (Integer.parseInt(zuopinnum) < Integer.parseInt(userProfie.getMinimumzuopin()) || Integer.parseInt(zuopinnum) > Integer.parseInt(userProfie.getMaxmumzuopin())) { if (!zuopinnum.equals("-") && zuopinnum != null) {
Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(userProfie.getMinimumzuopin()) + "-" + Integer.parseInt(userProfie.getMaxmumzuopin()) + "),作品数不满足条件"); if (Integer.parseInt(zuopinnum) < Integer.parseInt(userProfie.getMinimumzuopin()) || Integer.parseInt(zuopinnum) > Integer.parseInt(userProfie.getMaxmumzuopin())) {
flag=false; Log.e("TIAOSHI###", "获取的该用户作品数" + Integer.parseInt(zuopinnum) + "小于设置的加关作品数(不在区间" + Integer.parseInt(userProfie.getMinimumzuopin()) + "-" + Integer.parseInt(userProfie.getMaxmumzuopin()) + "),作品数不满足条件");
} else { flag = false;
Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件"); } else {
Log.e("TIAOSHI###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件");
}
} }
} }
} }
@@ -670,11 +660,10 @@ public class TestAblStepXin5 extends BaseAblStep {
} }
} }
} }
return flag; return flag;
} }
/** /**
* 直接上滑 * 直接上滑
*/ */
@@ -819,13 +808,13 @@ public class TestAblStepXin5 extends BaseAblStep {
public boolean runTime() { public boolean runTime() {
boolean ifruntime = false; boolean ifruntime = false;
Long diff = DateUtils.diff(userProfie.getLivetimefir(), userProfie.getLivetime()); 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###", "----第一次的时间:" + userProfie.getLivetimefir());
Log.e("TIAOSHI###", "----目前运行的时间:" + diff); Log.e("TIAOSHI###", "----目前运行的时间:" + diff);
String runtime = Integer.parseInt(userProfie.getRunningtime()) +""; String runtime = Integer.parseInt(userProfie.getRunningtime()) + "";
Log.e("TIAOSHI###", "----总运行的时间:" + runtime + "小时"); Log.e("TIAOSHI###", "----总运行的时间:" + runtime + "小时");
Long ltwo = Long.parseLong(runtime); Long ltwo = Long.parseLong(runtime);
if (diff.longValue() >= ltwo.longValue() * 60 * 60 * 1000) { if (diff.longValue() >= ltwo.longValue() * 60 * 60 * 1000) {
ifruntime = true; ifruntime = true;
} }
return ifruntime; return ifruntime;
@@ -833,18 +822,18 @@ public class TestAblStepXin5 extends BaseAblStep {
public boolean runTimetwo(String end_time) { public boolean runTimetwo(String end_time) {
boolean ifruntime = false; boolean ifruntime = false;
Date date=new Date(); Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String dateString=end_time; String dateString = end_time;
Date date2= null; Date date2 = null;
try { try {
date2 = sdf.parse(dateString); date2 = sdf.parse(dateString);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(date.getTime()<date2.getTime()){ if (date.getTime() < date2.getTime()) {
Log.e("TIAOSHI1###", date+"没有到设定的时间"); Log.e("TIAOSHI1###", date + "没有到设定的时间");
}else { } else {
ifruntime = true; ifruntime = true;
Log.e("TIAOSHI2###", date2 + "到时间了"); Log.e("TIAOSHI2###", date2 + "到时间了");
} }

View File

@@ -0,0 +1,49 @@
package com.fisherbone.fuzhu.step;
import android.graphics.Rect;
import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import java.util.List;
/**
*
*/
public class methodUtil {
/**
* 判断当前页面是否包含某文本
*/
public static boolean isContainText(String str) {
boolean flag = false;
List<AccessibilityNodeInfo> nodeInfos = AblViewUtil.findByText(str);
for (int i=0;i<nodeInfos.size();i++){
AccessibilityNodeInfo child = nodeInfos.get(i);
Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child);
Rect rect = new Rect();
child.getBoundsInScreen(rect);
if(rect.left>0&&rect.top>0&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) {
Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child);
flag = true;
}
}
return flag;
}
/**
* 查看节点的坐标点
*/
public static void nodeZuobiao(AccessibilityNodeInfo nodeinfo){
Rect rect = new Rect();
nodeinfo.getBoundsInScreen(rect);
Log.e("TIAOSHI###", "----显示节点的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")");
}
}

View File

@@ -245,4 +245,8 @@ public class StringUtils {
return decimalFormat.format(s); return decimalFormat.format(s);
} }
// 判断一个字符串是否都为数字
public static boolean isDigit(String strNum) {
return strNum.matches("[0-9]{1,}");
}
} }

View File

@@ -12,8 +12,8 @@ ext {
applicationId : "com.fisherbone.fuzhu", applicationId : "com.fisherbone.fuzhu",
minSdkVersion : 24, minSdkVersion : 24,
targetSdkVersion : 29, targetSdkVersion : 29,
versionCode : 168, versionCode : 170,
versionName : "1.6.8", versionName : "1.7.0",
testInstrumentationRunner: "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner: "androidx.test.runner.AndroidJUnitRunner"
] ]