atom quzan

This commit is contained in:
2021-10-19 11:26:35 +08:00
committed by dyx123
parent d556b49e68
commit 7b41a58731
11 changed files with 369 additions and 34 deletions

Binary file not shown.

View File

@@ -1 +1 @@
[{"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":{}}]
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":171,"versionName":"1.7.1","enabled":true,"outputFile":"atom-latest.apk","fullName":"release","baseName":"release"},"path":"atom-latest.apk","properties":{}}]

View File

@@ -17,6 +17,10 @@ public class RandumInt {
return new Random().nextInt(15)+1;
}
public static int getRandumInt40(){
return new Random().nextInt(95)+40;
return new Random().nextInt(40)+40;
}
public static int getRandumInt10(){
return new Random().nextInt(15)+10;
}
}

View File

@@ -0,0 +1,54 @@
package com.fisherbone.fuzhu.activity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import com.fisherbone.fuzhu.BaseActivity;
import com.fisherbone.fuzhu.R;
import com.fisherbone.fuzhu.abllib.AblStepHandler;
import com.fisherbone.fuzhu.abllib.AblSteps;
import com.fisherbone.fuzhu.abllib.utils.AblUtil;
import com.fisherbone.fuzhu.databinding.ActivityCancelThumbUpBinding;
import com.fisherbone.fuzhu.entity.CancelThumbUpBean;
import com.fisherbone.fuzhu.entity.FourEvent;
import com.fisherbone.fuzhu.widget.TitleBar;
import de.greenrobot.event.EventBus;
/**
* @author Administrator
*/
public class CancelThumbUpActivity extends BaseActivity {
private CancelThumbUpBean cancelThumbUpBean;
private ActivityCancelThumbUpBinding binding;
private TitleBar mTitleBar;
@SuppressLint("WrongViewCast")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cancel_thumb_up);
binding = DataBindingUtil.setContentView(this, R.layout.activity_cancel_thumb_up);
mTitleBar = (TitleBar) findViewById(R.id.title_bar);
mTitleBar.setTitle("一键取赞");
initNormalBack();
binding.rlStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (AblUtil.isAccessibilityServiceOpen(CancelThumbUpActivity.this)) {
AblStepHandler.getInstance().setStop(false);
//startApplicationtwo(MainActivity.this,"com.ss.android.ugc.aweme");
//jumpAPP();
EventBus.getDefault().post(new FourEvent("success", "11"));
AblStepHandler.sendMsg(AblSteps.STEP_260);
} else {
AblUtil.openAccessibilitySettings();
//ToastUtils.showShort("请先开启辅助服务");
}
}
});
}
}

View File

@@ -0,0 +1,6 @@
package com.fisherbone.fuzhu.entity;
import androidx.databinding.BaseObservable;
public class CancelThumbUpBean extends BaseObservable {
}

View File

@@ -0,0 +1,49 @@
package com.fisherbone.fuzhu.quzan;
import android.os.Message;
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.utils.AblViewUtil;
public class AblStep1 extends BaseAblStep {
int i = 0;
int j = 0;
@Override
public void onStep(int step, Message msg) {
switch ( step ){
case AblSteps.STEP_260:
AblViewUtil.startApplication();
AblViewUtil.mySleep(8);
AblStepHandler.sendMsg(AblSteps.STEP_261);
break;
case AblSteps.STEP_261:
AblService instance = AblService.getInstance();
AblViewUtil.mySleep(4);
myClick();
AblStepHandler.sendMsg(AblSteps.STEP_262);
break;
case AblSteps.STEP_262:
AblViewUtil.clickScreen(12,12);
AblStepHandler.sendMsg(AblSteps.STEP_263);
break;
case AblSteps.STEP_263:
AblViewUtil.clickScreen(3,16);
AblStepHandler.sendMsg(AblSteps.STEP_264);
break;
case AblSteps.STEP_264:
AblViewUtil.clickScreen(18,11);
AblStepHandler.sendMsg(AblSteps.STEP_265);
break;
case AblSteps.STEP_265:
AblViewUtil.scrollVertical(15,2);
AblStepHandler.sendMsg(AblSteps.STEP_264);
break;
default:
}
}
}

View File

@@ -18,6 +18,7 @@ import com.fisherbone.fuzhu.abllib.AblService;
import com.fisherbone.fuzhu.abllib.AblStepHandler;
import com.fisherbone.fuzhu.abllib.AblSteps;
import com.fisherbone.fuzhu.abllib.BaseAblStep;
import com.fisherbone.fuzhu.abllib.RandumInt;
import com.fisherbone.fuzhu.abllib.callback.GestureCallBack;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.entity.LiwuBean;
@@ -26,6 +27,7 @@ import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* 获得作品时间
@@ -45,13 +47,43 @@ public class TestAblStep0 extends BaseAblStep {
break;
case AblSteps.STEP_2:
AblViewUtil.mySleep(5);
getNodeInfoh();
// cancelGuanzhu(AblService.getInstance());
// getNodeInfoh();
// cancelGuanzhu(AblService.getInstance());
int randumInt40 = RandumInt.getRandumInt40();
zhibodianzanc(randumInt40);
break;
default:
}
}
/**
* 直播间点赞
*100-300
* @param mun
*/
public void zhibodianzanc(int mun) {
// for (int i = 0; i < mun; i++) {
// int a = 640 + RandumInt.getRandumInt4() * 30;
// int b = 490;
// int c = 200 - RandumInt.getRandumInt4() * 20;
// AblService.getInstance().clickPoint(a, b, 100);
// try {
// //隔200 ms
// Thread.sleep(c);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
Random r = new Random();
for (int i = 0; i < 10; i++) {
//r.nextInt(n) n为几 就产生0~n-1的随机数
int num = r.nextInt(2)+1;
// System.out.print(num+"\t");
Log.e("TIAOSHI###", num+"");
}
}
/**
* 发送节点
* @return
@@ -191,12 +223,18 @@ public class TestAblStep0 extends BaseAblStep {
if("android.widget.RelativeLayout".equals(child3.getClassName())) {
for (int r = 0; r < child3.getChildCount(); r++) {
AccessibilityNodeInfo child4 = child3.getChild(r);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
for (int m = 0; m < child4.getChildCount(); m++) {
AccessibilityNodeInfo child5 = child4.getChild(m);
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription());
if("android.widget.FrameLayout".equals(child4.getClassName())) {
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
for (int m = 0; m < child4.getChildCount(); m++) {
AccessibilityNodeInfo child5 = child4.getChild(m);
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription());
for (int p = 0; p < child5.getChildCount(); p++) {
AccessibilityNodeInfo child6 = child5.getChild(p);
Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription());
// nodeZuobiao(child5);
// yiguanzhu(child5);
}
}
}
}
}

View File

@@ -115,16 +115,10 @@ public class TestAblStep30 extends NoticeBase {
case AblSteps.STEP_214:
AblViewUtil.mySleep(1);
if(liveBean.getSwitchtwo()) {
//直播间点赞
if ("3".equals(ChangLiang.phonetype)) {
//每秒点赞4-9次 每次点赞10-15秒
//点赞次数40-145次
int randumInt40 = RandumInt.getRandumInt40();
zhibodianzanc(randumInt40);
} else {
int randumInt40 = RandumInt.getRandumInt40();
zhibodianzan(randumInt40);
}
//每次点赞次数40-80次
//每个功能间隔时间随机在5到15s之间
int randumInt40 = RandumInt.getRandumInt40();
zhibodianzanc(randumInt40);
}
AblViewUtil.mySleep(2);
AblStepHandler.sendMsg(AblSteps.STEP_215);
@@ -135,7 +129,9 @@ public class TestAblStep30 extends NoticeBase {
String conment = getConment();
//直播间发送评论
fasongpinglun(conment);
AblViewUtil.mySleep(5);
int randumInt10 = RandumInt.getRandumInt10();
AblViewUtil.mySleep(randumInt10);
}
AblStepHandler.sendMsg(AblSteps.STEP_216);
//AblStepHandler.sendMsg(AblSteps.STEP_217);
@@ -191,6 +187,9 @@ public class TestAblStep30 extends NoticeBase {
}
}
// AblStepHandler.sendMsg(AblSteps.STEP_217);
int randumInt10 = RandumInt.getRandumInt10();
AblViewUtil.mySleep(randumInt10);
AblStepHandler.sendMsg(AblSteps.STEP_214);
break;
case AblSteps.STEP_217:
@@ -537,16 +536,34 @@ public class TestAblStep30 extends NoticeBase {
* @param mun
*/
public void zhibodianzanc(int mun) {
for (int i = 0; i < mun; i++) {
int a = 540 + RandumInt.getRandumInt4() * 10;
int b = 500 - RandumInt.getRandumInt4() * 12;
int c = 200 - RandumInt.getRandumInt4() * 20;
AblService.getInstance().clickPoint(a, b, 100);
try {
//隔200 ms
Thread.sleep(c);
} catch (InterruptedException e) {
e.printStackTrace();
Random r = new Random();
int num = r.nextInt(2)+1;
if(num==1) {
for (int i = 0; i < mun; i++) {
int a = 540 + RandumInt.getRandumInt4() * 10;
int b = 500 - RandumInt.getRandumInt4() * 12;
int c = 200 - RandumInt.getRandumInt4() * 20;
AblService.getInstance().clickPoint(a, b, 100);
try {
//隔200 ms
Thread.sleep(c);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}else {
for (int i = 0; i < mun; i++) {
int a = 640 + RandumInt.getRandumInt4() * 30;
int b = 490;
int c = 200 - RandumInt.getRandumInt4() * 20;
AblService.getInstance().clickPoint(a, b, 100);
try {
//隔200 ms
Thread.sleep(c);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -229,6 +229,132 @@ public class TestAblStep6 extends BaseAblStep {
}
}
// private void cancelGuanzhu(AblService instance) {
// AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
// for (int i = 0; i < root.getChildCount(); i++) {
// AccessibilityNodeInfo child = root.getChild(i);
//// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
//// nodeZuobiao(child);
// for (int y = 0; y < child.getChildCount(); y++) {
// AccessibilityNodeInfo child1 = child.getChild(y);
//// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
//// nodeZuobiao(child1);
// for (int j = 0; j < child1.getChildCount(); j++) {
// AccessibilityNodeInfo child2 = child1.getChild(j);
//// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
//// nodeZuobiao(child2);
// for (int x = 0; x < child2.getChildCount(); x++) {
// AccessibilityNodeInfo child3 = child2.getChild(x);
// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
//// nodeZuobiao(child3);
// if ("android.widget.RelativeLayout".equals(child3.getClassName())) {
// for (int r = 0; r < child3.getChildCount(); r++) {
// AccessibilityNodeInfo child4 = child3.getChild(r);
// if ("android.widget.FrameLayout".equals(child4.getClassName())) {
// Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
// for (int m = 0; m < child4.getChildCount(); m++) {
// AccessibilityNodeInfo child5 = child4.getChild(m);
// Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription());
// for (int p = 0; p < child5.getChildCount(); p++) {
// AccessibilityNodeInfo child6 = child5.getChild(p);
// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription());
// nodeZuobiao(child5);
// yiguanzhutwo(child6);
// }
// }
// }
// }
// }
// }
// }
// }
// }
// }
// 3.遍历info中的子节点 (优化方法,正在测试)
public void yiguanzhutwo(AccessibilityNodeInfo child2) {
boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed();
boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor();
if (cancelclosed && !cancelcrosscor) {
Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ");
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (child2.getText() != null) {
if (child2.getText().toString().equals("已关注")) {
Rect rect = new Rect();
if (child2 != null) {
child2.getBoundsInScreen(rect);
if (rect.top <= 2100) {
clickcommontwo(child2, "已关注");
}
}
}
}
}
if (cancelcrosscor && !cancelclosed) {
Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV");
AblViewUtil.mySleep(1);
if (child2.getText() != null) {
if (child2.getText().toString().equals("互相关注")) {
Rect rect = new Rect();
if (child2 != null) {
child2.getBoundsInScreen(rect);
if (rect.top <= 2100) {
clickcommontwo(child2, "互相关注");
AblViewUtil.mySleep(2);
//(0,1868),(1080,2028)
AblService.getInstance().clickPoint(720, 1948, 300);
// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
// clickcommontwo(quxiao, "取消关注");
AblViewUtil.mySleep(1);
}
}
}
}
}
if (cancelclosed && cancelcrosscor) {
Log.e("TIAOSHI###", "WWWWWWWWWWWWWWWWWWWWW");
if (child2.getChildCount() != 0) {
for (int i = 0; i < child2.getChildCount(); i++) {
AccessibilityNodeInfo child = child2.getChild(i);
if (child.getText() != null) {
if (child.getText().toString().equals("已关注")) {
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
clickcommontwo(child, "已关注");
}
if (child.getText().toString().equals("互相关注")) {
AblViewUtil.mySleep(1);
clickcommontwo(child, "互相关注");
AblViewUtil.mySleep(2);
AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
clickcommontwo(quxiao, "取消关注");
AblViewUtil.mySleep(1);
}
}
}
}
}
}
// 3.遍历info中的子节点 (优化方法,正在测试)
public void yiguanzhu(AccessibilityNodeInfo child2) {
boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed();
@@ -286,13 +412,19 @@ public class TestAblStep6 extends BaseAblStep {
childw.getBoundsInScreen(rect);
if (rect.top <= 2100) {
clickcommontwo(childw, "互相关注");
AblViewUtil.mySleep(2);
List<AccessibilityNodeInfo> liats = AblViewUtil.findByText("取消关注");
if(liats.size()>0) {
AblService.getInstance().clickPoint(720, 1948, 300);
AblViewUtil.mySleep(1);
}
}
}
AblViewUtil.mySleep(2);
AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
clickcommontwo(quxiao, "取消关注");
// AblViewUtil.mySleep(2);
// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
// clickcommontwo(quxiao, "取消关注");
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View" />
<variable
name="cancelthumbupbean"
type="com.fisherbone.fuzhu.entity.CancelThumbUpBean" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.fisherbone.fuzhu.widget.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="48dp" />
<RelativeLayout
android:id="@+id/rl_start"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@drawable/bg_recfollow_zhixing">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableLeft="@mipmap/icon_zhixing"
android:text="开始运行"
android:textColor="#ffffffff"
android:textSize="16sp" />
</RelativeLayout>
</LinearLayout>
</layout>