This commit is contained in:
2021-09-29 17:11:59 +08:00
parent a4864d15e8
commit 307e3f3cf4
22 changed files with 436 additions and 592 deletions

BIN
app/fuzhu.jks Normal file

Binary file not shown.

BIN
app/release/atom-latest.apk Normal file

Binary file not shown.

1
app/release/output.json Normal file
View File

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

View File

@@ -22,8 +22,9 @@ public class test2 {
@Test
public void onCreate() {
gaizaotime("关注 389");
int i = Integer.parseInt("0");
Log.e("TIAOSHI###", i+"");
// gaizaotime("关注 389");
}
private void gaizaotime(String end_time) {

View File

@@ -70,7 +70,7 @@ public class AblService extends AccessibilityService {
}
private void init() {
Log.e("TIAOSHI", "无障碍服务初始化");
}
/**
@@ -128,10 +128,10 @@ public class AblService extends AccessibilityService {
// }
LogUtils.v(event.getPackageName() + "");
if (ChangLiang.gendanopen == 1) {
scroll2PositionClick(this, "6");
}
// LogUtils.v(event.getPackageName() + "");
// if (ChangLiang.gendanopen == 1) {
// scroll2PositionClick(this, "6");
// }
int eventType = event.getEventType();
@@ -467,7 +467,6 @@ public class AblService extends AccessibilityService {
Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
} else {
Log.e("TIAOSHI###", "没有找到" + s + "按钮,直接退出了。。。。");
return;
}
}
@@ -545,6 +544,16 @@ public class AblService extends AccessibilityService {
}
}
@RequiresApi(api = Build.VERSION_CODES.N)
public void randomSwipefour() {
int a = 700 + RandumInt.getRandumInt4() * 8;
int b = 700 - RandumInt.getRandumInt4() * 10;
int c = 1700 - RandumInt.getRandumInt4() * 8; // 1920分辨率起步的滑动方式原为1800
int d = 500 - RandumInt.getRandumInt4() * 9; // 刚才是300 延迟350~400
// 800毫秒的时候有时候有点卡,但是能用,再试试其他的
swipe(540, 1800, 540, 1596, 500); //延迟330毫秒
}
@RequiresApi(api = Build.VERSION_CODES.N)
public void swipe(float x1, float y1, float x2, float y2, long duration) {
Path path = new Path();
@@ -571,83 +580,4 @@ public class AblService extends AccessibilityService {
}, null);
}
//点击右上角搜索
public void DianSou() {
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;
default:
}
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());
if ("android.widget.EditText".equals(child.getClassName())) {
infooos = child;
}
}
return infooos;
}
/**
* 直播间点赞(红米10)
*
* @param mun
*/
private void hongDianzan(int mun) {
for (int i = 0; i < mun; i++) {
int a = 500 + RandumInt.getRandumInt4() * 20;
int b = 1000 - RandumInt.getRandumInt4() * 20;
int c = 600 - RandumInt.getRandumInt4() * 50;
AblService.getInstance().clickPoint(a, b, 200);
try {
//隔200 ms 滚动一次
Thread.sleep(c);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Log.e("TIAOSHI###", "点击了");
}
}
/**
* 随机获取评论话术
*/
private String getConment() {
CommentDao commentDao = new CommentDao(FuzhuApplication.getContext());
List<CommentBeanData> 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;
}
}
}

View File

@@ -43,6 +43,32 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
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###", "点击搜索按钮");
}
/**
* 查看节点的坐标点
@@ -361,10 +387,10 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
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 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());
@@ -383,7 +409,7 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
// }
// }
// }
// }
}
}
}
}

View File

@@ -68,25 +68,7 @@ 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);
}
}
/**
* 添加悬浮界面

View File

@@ -252,6 +252,7 @@ public class AblViewUtil {
}
/**
* x轴居中竖直滑动屏幕
*

View File

@@ -72,9 +72,9 @@ public class CancleFollowActivity extends BaseActivity {
}
}
// if(!addWinEntity.cancleisopen){
// EventBus.getDefault().post(new FourEvent("success","2"));
// }
if(!addWinEntity.cancleisopen){
EventBus.getDefault().post(new FourEvent("success","2"));
}
}
});
}

View File

@@ -17,6 +17,7 @@ import com.fisherbone.fuzhu.abllib.utils.AblUtil;
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.step.TestAblStep30;
import com.fisherbone.fuzhu.step.TestAblStep34;
import com.fisherbone.fuzhu.step.TestAblStep6;
@@ -118,6 +119,7 @@ public class ControlWindow {
break;
//大V粉丝截流
case "61":
AblStepHandler.getInstance().initStepClass(new TestAblStep24());
stutas(ChangLiang.isrun);
AblStepHandler.sendMsg(AblSteps.STEP_130);
break;

View File

@@ -45,14 +45,6 @@ public class DavActivity extends BaseActivity {
mTitleBar = (TitleBar) findViewById(R.id.title_bar);
mTitleBar.setTitle("大V粉丝截流");
initNormalBack();
commentDao = new CommentDao(DavActivity.this);
//给数据库插入十条默认数据
ArrayList<CommentBeanData> commentBeanData = commentDao.queryAll();
if(commentBeanData.size()==0) {
Log.e("ceshi","添加了数据");
madeData();
}
binding.rlStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -113,18 +105,4 @@ 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<CommentBeanData> 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);
}
}
}
}

View File

@@ -43,45 +43,10 @@ public class HongBaoActivity extends BaseActivity {
.subscribe(new Consumer<Object>() {
@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<Long>() {
@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);
}
}

View File

@@ -1,6 +1,7 @@
package com.fisherbone.fuzhu.activity;
import android.Manifest;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
@@ -9,6 +10,7 @@ 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;
@@ -16,6 +18,7 @@ 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;
@@ -186,8 +189,20 @@ 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表示开启
}
checkAccessibilityEnabled("");
ChangLiang.task_id = "";//当前执行任务id
ChangLiang.id = "";//当前执行任务功能id
ChangLiang.task_type = "";//当前执行任务类型
@@ -284,7 +299,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 TestAblStep24(), 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 TestAblStep25(), new TestAblStep26(), new TestAblStep27(), new TestAblStep28(), new TestAblStep29(), new TestAblStep31(), new TestAblStep32(), new TestAblStep33());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int hasWriteContactsPermission = checkSelfPermission(Manifest.permission.READ_CONTACTS);
if (hasWriteContactsPermission != PackageManager.PERMISSION_GRANTED) {
@@ -372,10 +387,6 @@ public class MainActivity extends BaseActivity implements InfoMessage {
// JumpUtils.gotoActivity(MainActivity.this, MainActivityy.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();
@@ -454,12 +465,13 @@ public class MainActivity extends BaseActivity implements InfoMessage {
UpdateTuoguan("1");
} else if (toastMsg.contains("账号下线")) {
UpdateTuoguan("1");
} else if (toastMsg.contains("粉丝列表不可见")) {
AblStepHandler.getInstance().setStop(true);
AblViewUtil.onMessage("停止");
}else if(toastMsg.contains("已切换到")){
UpdateTuoguan("0");
}
else if(toastMsg.contains("由于该用户隐私设置,粉丝列表不可见")){
AblStepHandler.getInstance().setStop(true);
AblViewUtil.onMessage("停止");
}
}
}
}
@@ -558,20 +570,17 @@ public class MainActivity extends BaseActivity implements InfoMessage {
} else {
Log.e("TIAOSHI###", "无障碍服务异常");
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu.abllib/AblService");
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.fisherbone.fuzhu/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.abllib/AblService");
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, "0");//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, "0");//1表示开启
}
}
}).subscribe(new Observer<Long>() {
@@ -703,7 +712,9 @@ public class MainActivity extends BaseActivity implements InfoMessage {
@Override
public void mesagefinish(String str) {
if ("停止".equals(str)) {
mdDisposable.dispose();
if(mdDisposable!=null) {
mdDisposable.dispose();
}
AblStepHandler.getInstance().setStop(true);
FinishTask();
}
@@ -717,7 +728,9 @@ public class MainActivity extends BaseActivity implements InfoMessage {
@Override
public void mesagezhuang(String str) {
if ("停止".equals(str)) {
mdDisposable.dispose();
if(mdDisposable!=null) {
mdDisposable.dispose();
}
AblStepHandler.getInstance().setStop(true);
touchResult();
controlWindow.stutas(true);
@@ -738,6 +751,10 @@ 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();
}
}
@@ -745,15 +762,14 @@ 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();
@@ -1332,7 +1348,6 @@ public class MainActivity extends BaseActivity implements InfoMessage {
{
//注意:不能先杀掉主进程,否则逻辑代码无法继续执行,需先杀掉相关进程最后杀掉主进程
ActivityManager mActivityManager = (ActivityManager) MainActivity.this.getSystemService(Context.ACTIVITY_SERVICE);
// List<ActivityManager.RunningAppProcessInfo mList = mActivityManager.getRunningAppProcesses();
List<ActivityManager.RunningAppProcessInfo> mList = mActivityManager.getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : mList)
{
@@ -1344,4 +1359,22 @@ 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<AccessibilityServiceInfo> accessibilityServices = mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
for (AccessibilityServiceInfo info : accessibilityServices) {
Log.e("TIAOSHI###", "服务进程" + info.getId());
if (info.getId().equals(serviceName)) {
return true;
}
}
return false;
}
}

View File

@@ -822,7 +822,6 @@ 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);
}

View File

@@ -1,27 +1,37 @@
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.callback.GestureCallBack;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.db.DouyinBean;
import com.fisherbone.fuzhu.entity.LiwuBean;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
/**
* 获得作品时间
*/
public class TestAblStep0 extends BaseAblStep {
private String substring = "1000000";//当前的关注数
public String IFCONTIAN = "x";
private int liwusubstring;
@Override
public void onStep(int step, Message msg) {
@@ -33,49 +43,25 @@ public class TestAblStep0 extends BaseAblStep {
break;
case AblSteps.STEP_2:
AblViewUtil.mySleep(2);
// getNodeInfoh();
// getNum();
cancelGuanzhu();
// getNodeInfoh();
geliwu("");
break;
default:
}
}
/**
* 获得左上角主播的昵称
* @return
* 获得背包中第一排位置的了礼物
*/
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());
// 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);
//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() + ":" + child3.getContentDescription());
nodeZuobiao(child3);
nikename = AblViewUtil.getString(nikename, child3, 253, 308, 208, 540, "android.widget.TextView");
}
}
}
}
return nikename;
}
private int geliwu(String text) {
int doubiNum = 0;
ArrayList<LiwuBean> liwuBeans = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> oneInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> twoInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> threeInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> fourInfos = new ArrayList<>();
private void cancelGuanzhu() {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i);
@@ -93,67 +79,91 @@ public class TestAblStep0 extends BaseAblStep {
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);
yiguanzhu(child5);
}
Rect rect = new Rect();
child3.getBoundsInScreen(rect);
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 30 && rect.right <= 248) {
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3);
oneInfos.add(child3);
}
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 248 && rect.right <= 540) {
Log.e("TIAOSHI###", "----fourNodetwo:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3);
twoInfos.add(child3);
}
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 540 && rect.right <= 810) {
Log.e("TIAOSHI###", "----fourNodehree:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3);
threeInfos.add(child3);
}
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 810 && rect.right <= 1080) {
Log.e("TIAOSHI###", "----fourNodefour:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3);
fourInfos.add(child3);
}
}
}
}
}
addLiwuData(liwuBeans, oneInfos);
addLiwuData(liwuBeans, twoInfos);
addLiwuData(liwuBeans, threeInfos);
addLiwuData(liwuBeans, fourInfos);
Gson gson = new Gson();
String s1 = gson.toJson(liwuBeans);
Log.e("礼物的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}]
for(int j=0;j<liwuBeans.size();j++){
LiwuBean liwuBean = liwuBeans.get(j);
String liwuDoubi = liwuBean.getLiwuDoubi();
int integer = Integer.valueOf(liwuDoubi);
doubiNum = integer+doubiNum;
}
return doubiNum;
}
// 3.遍历info中的子节点 (优化方法,正在测试)
public void yiguanzhu(AccessibilityNodeInfo child2) {
// 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;
}
}
AblViewUtil.mySleep(1);
if (childw.getText() != null) {
if (childw.getText().toString().equals("互相关注")) {
clickcommontwo(childw, "互相关注");
AblViewUtil.mySleep(2);
AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
clickcommontwo(quxiao, "取消关注");
}
}
}
private void addLiwuData(ArrayList<LiwuBean> liwuBeans, ArrayList<AccessibilityNodeInfo> oneInfos) {
LiwuBean liwuBean = new LiwuBean();
if (oneInfos.size() > 0) {
String s0 = oneInfos.get(0).getText().toString();
liwuBean.setLiwuTime(s0);
String s1 = oneInfos.get(1).getText().toString();
liwuBean.setLiwuName(s1);
String s2 = oneInfos.get(2).getText().toString();
if(s1.equals("大啤酒")) {
liwuBean.setLiwuDanjia("2");
}else if(s1.equals("小心心")){
liwuBean.setLiwuDanjia("1");
}else if(s1.equals("棒棒糖")){
liwuBean.setLiwuDanjia("9");
}else if(s1.equals("玫瑰")){
liwuBean.setLiwuDanjia("1");
}else{
liwuBean.setLiwuDanjia("1");
}
String s3 = oneInfos.get(3).getText().toString();
if (s3.contains(IFCONTIAN)) {
String substring = s3.substring(1);
liwusubstring = Integer.valueOf(substring);
Log.e("TIAOSHI###", "----礼物个数=:" + substring);
}
liwuBean.setLiwuNum(liwusubstring+"");
String liwuDanjia = liwuBean.getLiwuDanjia();
int danjia = Integer.valueOf(liwuDanjia);
liwuBean.setLiwuDoubi(liwusubstring*danjia+"");
liwuBeans.add(liwuBean);
}
}
}

View File

@@ -108,19 +108,6 @@ 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###", "点击点赞按钮");
}
/**
* 随机获取评论话术
*/

View File

@@ -3,6 +3,7 @@ package com.fisherbone.fuzhu.step;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.GestureDescription;
import android.graphics.Path;
import android.graphics.Rect;
import android.os.Build;
import android.os.Message;
import android.util.Log;
@@ -16,10 +17,19 @@ 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.jeremyliao.liveeventbus.LiveEventBus;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
/**
* @param
@@ -32,21 +42,24 @@ public class TestAblStep24 extends BaseAblStep {
private List<AccessibilityNodeInfo> 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);
// objects.add("dyh48hvfd4yc");
// objects.add("dyh48hvfd4yc");
AblViewUtil.mySleep(3);
AblStepHandler.sendMsg(AblSteps.STEP_131);
//开启运行倒计时
daojishitwo(Integer.parseInt(ChangLiang.dav_runningtime) * 60 *60);
// daojishitwo(40);
break;
case AblSteps.STEP_131:
//点击右上角搜索
@@ -60,16 +73,11 @@ public class TestAblStep24 extends BaseAblStep {
//输入关键词
//判断有无要加关的关键词如果有则执行112没有则执行113
if (objects.size() > 0) {
//复制文本粘贴在留言板
AccessibilityNodeInfo findcomentt = findEditText();
String conment = objects.get(0);
Log.e("TIAOSHI###", "获得的关键词内容" + conment);
AblViewUtil.mySleep(1);
if (ChangLiang.phonetype.equals("0")) {
AblViewUtil.sayInput(conment, findcomentt);
} else {
AblViewUtil.sayInput(conment, findcomentt);//华为畅享20
}
AblViewUtil.sayInput(conment, findcomentt);
AblViewUtil.mySleep(3);
AblStepHandler.sendMsg(AblSteps.STEP_133);
}
@@ -78,20 +86,20 @@ public class TestAblStep24 extends BaseAblStep {
//点击列表第一个,进入加关页面
DianSou();
AblViewUtil.mySleep(2);
// AblService.getInstance().inputClickId("用户");//红米7a
// AblService.getInstance().inputClickId("用户");//红米7a
selecttype("1");
AblViewUtil.mySleep(2);
//用坐标点的方式点击第一条 0256 720404
AblService.getInstance().clickPoint(360, 330, 300);
AblViewUtil.mySleep(2);
getfensi();
AblViewUtil.mySleep(2);
AblService.getInstance().clickcommontwo(child3, "进入用户粉丝页");
AblStepHandler.sendMsg(AblSteps.STEP_134);
//用坐标点的方式点击第一条 0256 720404
AblService.getInstance().clickPoint(540, 456, 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);
@@ -119,6 +127,7 @@ public class TestAblStep24 extends BaseAblStep {
}
}
/**
* 选择搜索的分类
* 1为用户 2为直播
@@ -131,32 +140,36 @@ public class TestAblStep24 extends BaseAblStep {
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());
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, "");
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(child2.getClassName())) {
if (child2.getText() != null) {
if (child2.getText().toString().equals("直播")) {
AblService.getInstance().clickcommontwo(child2, "");
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:
break;
default:
}
}
}
}
@@ -181,6 +194,7 @@ public class TestAblStep24 extends BaseAblStep {
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();
@@ -216,65 +230,83 @@ 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());
// 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);
for (int j = 0; j < child1.getChildCount(); j++) {
AccessibilityNodeInfo child2 = child1.getChild(j);
// 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())) {
clickcommontwo(child1, "关注");
}
}
}
}
}
private void getCondition() {
String getquxiaoguanzhu = getquxiaoguanzhu();
if (getquxiaoguanzhu.equals("0")) {
Log.e("TIAOSHI###", "已经关注了,直接返回");
ChangLiang.dav_condition = "1";
return;
}
//___________________________________________________________________________________
AblViewUtil.mySleep(1);
// getUserInfo();
getargone();
//判断作品数条件
getargfour();
@@ -319,36 +351,6 @@ 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;
}
@@ -359,25 +361,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());
//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())) {
// 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());
for (int j = 0; j < child1.getChildCount(); j++) {
AccessibilityNodeInfo child2 = child1.getChild(j);
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText());
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
// nodeZuobiao(child2);
if (child2.getText() != null) {
if (child2.getText().equals("粉丝")) {
AccessibilityNodeInfo parent = child2.getParent();
child3 = parent.getChild(0);
Log.e("TIAOSHI###", "获得的关注数==" + child3.getText().toString());
// guanzhunum = child3.getText().toString();
if (child3.getText().toString().equals("-")) {
Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。");
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;
}
@@ -397,79 +399,19 @@ public class TestAblStep24 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());
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());
// Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText());
for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(0);
infooos = child1;
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;
}
// 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);
// }
// }
// }
// }
/**
* 获得最近作品时间
*/
@@ -477,38 +419,33 @@ 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());
//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###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件");
}
}
}
// 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);
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###", "获取的该用户作品数不小于设置的加关作品数,满足加关点赞评论条件");
}
}
}
@@ -516,7 +453,6 @@ public class TestAblStep24 extends BaseAblStep {
}
}
}
// AblViewUtil.mySleep(2);
}
}
}
@@ -528,48 +464,50 @@ 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());
// 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###", "----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());
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);
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) {
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(0);
}
if (child2.getText().equals("关注")) {
AccessibilityNodeInfo parent = child2.getParent();
AccessibilityNodeInfo child3 = parent.getChild(1);
if (child3.getText() != null) {
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(0);
}
if (child2.getText().equals("粉丝")) {
AccessibilityNodeInfo parent = child2.getParent();
AccessibilityNodeInfo child3 = parent.getChild(1);
if (child3.getText() != null) {
Log.e("TIAOSHI###", "获得的粉丝数==" + child3.getText().toString());
fensinum = child3.getText().toString();
fensinum = child3.getText().toString();
if (child3.getText().toString().equals("-")) {
Log.e("TIAOSHI###", "数据异常,停止服务。。。。。。。。。。。。");
}
return;
}
return;
}
}
}
@@ -577,4 +515,36 @@ public class TestAblStep24 extends BaseAblStep {
}
}
}
/**
* 模拟结束任务
*
* @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<Long>() {
@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 {
ChangLiang.dav_ishuadong = "F";
Log.e("TIAOSHI###", "运行时间已到,停止自动加关");
// runLog("任务运行即将结束");
AblViewUtil.potgegin("停止");
}
})
.subscribe();
}
}

View File

@@ -384,31 +384,6 @@ 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() {
@@ -745,16 +720,6 @@ 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);
@@ -1041,7 +1006,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 >= 37 && rect.right <= 248) {
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 30 && rect.right <= 248) {
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3);

View File

@@ -129,12 +129,12 @@ public class TestAblStepXin5 extends BaseAblStep {
AblStepHandler.sendMsg(AblSteps.STEP_31);
return;
}
AccessibilityNodeInfo zhibojian = AblViewUtil.findByText("点击进入直播间", 0);
if (zhibojian != 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###", "此视频包含广播");