This commit is contained in:
2021-10-26 15:44:55 +08:00
parent 837b0edef7
commit 42e16b69e4
9 changed files with 141 additions and 45 deletions

View File

@@ -537,4 +537,25 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
return flag; return flag;
} }
/**
* 判断当前页面是否包含某文本
*/
public AccessibilityNodeInfo isContainText(String str) {
AccessibilityNodeInfo nodeInfo = null;
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>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;
}
} }

View File

@@ -131,35 +131,35 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
* *
* @return * @return
*/ */
public AccessibilityNodeInfo getNodeInfoS() { // public AccessibilityNodeInfo getNodeInfoS() {
AccessibilityNodeInfo nodeinfo = null; // AccessibilityNodeInfo nodeinfo = null;
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);
// Log.e("TIAOSHI###", "one----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); // // Log.e("TIAOSHI###", "one----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
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###", "one----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); // // Log.e("TIAOSHI###", "one----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
if (child1 != null) { // if (child1 != null) {
for (int j = 0; j < child1.getChildCount(); j++) { // for (int j = 0; j < child1.getChildCount(); j++) {
AccessibilityNodeInfo child2 = child1.getChild(j); // AccessibilityNodeInfo child2 = child1.getChild(j);
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); //// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
// nodeZuobiao(child2); //// nodeZuobiao(child2);
if (child2 != null) { // if (child2 != null) {
if ("android.widget.TextView".equals(child2.getClassName())) { // if ("android.widget.TextView".equals(child2.getClassName())) {
if (child2.getText() != null) { // if (child2.getText() != null) {
if ("说点什么...".equals(child2.getText().toString())) { // if ("说点什么...".equals(child2.getText().toString())) {
nodeinfo = child2; // nodeinfo = child2;
} // }
} // }
} // }
} // }
} // }
} // }
} // }
} // }
return nodeinfo; // return nodeinfo;
} // }
/** /**
* 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用)
@@ -570,7 +570,9 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
AblViewUtil.mySleep(5); AblViewUtil.mySleep(5);
enterOneNodeInfo(); enterOneNodeInfo();
AblViewUtil.mySleep(4); AblViewUtil.mySleep(4);
AccessibilityNodeInfo nodeInfoS = getNodeInfoS(); // AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
AccessibilityNodeInfo nodeInfoS = isContainText("说点什么...");
if (nodeInfoS != null) { if (nodeInfoS != null) {
ifEnterOne = true; ifEnterOne = true;
} }
@@ -891,7 +893,8 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
} }
public boolean enterLivetwo() { public boolean enterLivetwo() {
boolean ifEnterOne = false; boolean ifEnterOne = false;
AccessibilityNodeInfo nodeInfoS = getNodeInfoS(); // AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
AccessibilityNodeInfo nodeInfoS = isContainText("说点什么...");
if (nodeInfoS != null) { if (nodeInfoS != null) {
ifEnterOne = true; ifEnterOne = true;
} }

View File

@@ -50,8 +50,13 @@ public class TestAblStep0 extends BaseAblStep {
// getNodeInfoh(); // getNodeInfoh();
// cancelGuanzhu(AblService.getInstance()); // cancelGuanzhu(AblService.getInstance());
int randumInt40 = RandumInt.getRandumInt40(); boolean nodeInfoh = ifGaunzhu();
zhibodianzanc(randumInt40); if(nodeInfoh){
Log.e("TIAOSHI###", "此视频没有关注过");
}else {
Log.e("TIAOSHI###", "此视频已关注");
return;
}
break; break;
default: default:
} }
@@ -329,6 +334,48 @@ public class TestAblStep0 extends BaseAblStep {
} }
} }
/**
* 是否关注过 判断的准确率在百分之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;
}
} }

View File

@@ -192,7 +192,8 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
break; break;
case AblSteps.STEP_254: case AblSteps.STEP_254:
AccessibilityNodeInfo nodeInfoS = getNodeInfoS(); //AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
AccessibilityNodeInfo nodeInfoS = isContainText("说点什么...");
if (nodeInfoS != null) { if (nodeInfoS != null) {
Log.e("TIAOSHI###", "页面在直播页面"); Log.e("TIAOSHI###", "页面在直播页面");
againStart("1"); againStart("1");

View File

@@ -136,14 +136,14 @@ public class TestAblStepXin5 extends BaseAblStep {
AblStepHandler.sendMsg(AblSteps.STEP_31); AblStepHandler.sendMsg(AblSteps.STEP_31);
return; return;
} }
boolean nodeInfoh = ifGaunzhu(); // boolean nodeInfoh = ifGaunzhu();
if(nodeInfoh){ // if(nodeInfoh){
Log.e("TIAOSHI###", "此视频没有关注过"); // Log.e("TIAOSHI###", "此视频没有关注过");
}else { // }else {
Log.e("TIAOSHI###", "此视频已关注"); // Log.e("TIAOSHI###", "此视频已关注");
AblStepHandler.sendMsg(AblSteps.STEP_31); // AblStepHandler.sendMsg(AblSteps.STEP_31);
return; // return;
} // }
} }
AblStepHandler.sendMsg(AblSteps.STEP_29); AblStepHandler.sendMsg(AblSteps.STEP_29);
@@ -176,6 +176,8 @@ public class TestAblStepXin5 extends BaseAblStep {
} else { } else {
ChangLiang.condition = "1"; ChangLiang.condition = "1";
} }
}else {
ChangLiang.condition = "1";
} }
AblStepHandler.sendMsg(AblSteps.STEP_30); AblStepHandler.sendMsg(AblSteps.STEP_30);
} }

View File

@@ -390,7 +390,29 @@
/> />
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
>
</RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@@ -12,8 +12,8 @@ ext {
applicationId : "com.fisherbone.fuzhu", applicationId : "com.fisherbone.fuzhu",
minSdkVersion : 24, minSdkVersion : 24,
targetSdkVersion : 29, targetSdkVersion : 29,
versionCode : 171, versionCode : 172,
versionName : "1.7.1", versionName : "1.7.2",
testInstrumentationRunner: "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner: "androidx.test.runner.AndroidJUnitRunner"
] ]

View File

@@ -10,5 +10,5 @@
5.后台扫码24个手机分组显示23个但手机都可以自动运行 5.后台扫码24个手机分组显示23个但手机都可以自动运行
6.(群控)直播间加热,有个别手机进入不了直播间 6.(群控)直播间加热,有个别手机进入不了直播间
----------------------------------------------------------------------------------------------------
3.(群控)直播间加热,后台设置的话术不评论,还是之前的话术 (解决) 3.(群控)直播间加热,后台设置的话术不评论,还是之前的话术 (解决)