diff --git a/app/release/atom-latest.apk b/app/release/atom-latest.apk index 68ea5e5..d83a047 100644 Binary files a/app/release/atom-latest.apk and b/app/release/atom-latest.apk differ diff --git a/app/release/output.json b/app/release/output.json index 4907ed9..86eb96e 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -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":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":171,"versionName":"1.7.1","enabled":true,"outputFile":"atom-latest.apk","fullName":"release","baseName":"release"},"path":"atom-latest.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java index 524faba..ef7218c 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java @@ -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; } } \ No newline at end of file diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/CancelThumbUpActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/CancelThumbUpActivity.java new file mode 100644 index 0000000..06867e7 --- /dev/null +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/CancelThumbUpActivity.java @@ -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("请先开启辅助服务"); + } + } + }); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fisherbone/fuzhu/entity/CancelThumbUpBean.java b/app/src/main/java/com/fisherbone/fuzhu/entity/CancelThumbUpBean.java new file mode 100644 index 0000000..52b8758 --- /dev/null +++ b/app/src/main/java/com/fisherbone/fuzhu/entity/CancelThumbUpBean.java @@ -0,0 +1,6 @@ +package com.fisherbone.fuzhu.entity; + +import androidx.databinding.BaseObservable; + +public class CancelThumbUpBean extends BaseObservable { +} diff --git a/app/src/main/java/com/fisherbone/fuzhu/quzan/AblStep1.java b/app/src/main/java/com/fisherbone/fuzhu/quzan/AblStep1.java new file mode 100644 index 0000000..b3dc19b --- /dev/null +++ b/app/src/main/java/com/fisherbone/fuzhu/quzan/AblStep1.java @@ -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: + } + + } +} diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java index c8ad943..05e8f9d 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -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); + } + } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java index 04e60f2..fb5dbfe 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java @@ -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(); + } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java index ea446e5..c5ecdea 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java @@ -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 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, "取消关注"); } } diff --git a/app/src/main/res/layout/activity_cancel_thumb_up.xml b/app/src/main/res/layout/activity_cancel_thumb_up.xml new file mode 100644 index 0000000..606483e --- /dev/null +++ b/app/src/main/res/layout/activity_cancel_thumb_up.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app_config.gradle b/app_config.gradle index 4da478e..b607943 100644 --- a/app_config.gradle +++ b/app_config.gradle @@ -12,8 +12,8 @@ ext { applicationId : "com.fisherbone.fuzhu", minSdkVersion : 24, targetSdkVersion : 29, - versionCode : 170, - versionName : "1.7.0", + versionCode : 171, + versionName : "1.7.1", testInstrumentationRunner: "androidx.test.runner.AndroidJUnitRunner" ]