指定抖音号点赞评论

This commit is contained in:
wming-black
2021-12-11 09:20:47 +08:00
parent fc0f6cb7ef
commit a92b2154a2
20 changed files with 257 additions and 40 deletions

7
.idea/fileColors.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SharedFileColors">
<fileColor scope="Tests" color="Blue" />
<fileColor scope="Non-Project Files" color="Blue" />
</component>
</project>

View File

@@ -1,12 +1,16 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AliDeprecation" enabled="false" level="CRITICAL" enabled_by_default="false" />
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaAvoidCommentBehindStatement" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaAvoidNewDateGetTime" enabled="false" level="BLOCKER" enabled_by_default="false" />
<inspection_tool class="AlibabaClassNamingShouldBeCamel" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaCommentsMustBeJavadocFormat" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaMethodTooLong" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaRemoveCommentedCode" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaUndefineMagicConstant" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>

37
.idea/misc.xml generated
View File

@@ -1,22 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/fuzhu/app/src/main/res/layout/activity_cancle_follow.xml" value="0.35885416666666664" />
<entry key="..\:/fuzhu/app/src/main/res/layout/activity_keyword.xml" value="0.35885416666666664" />
<entry key="..\:/picture/fuzhu/app/src/main/res/layout/activity_cancel_thumb_up.xml" value="0.3170289855072464" />
<entry key="..\:/picture/fuzhu/app/src/main/res/layout/activity_cancle_follow.xml" value="0.3541666666666667" />
<entry key="..\:/picture/fuzhu/app/src/main/res/layout/activity_hong_bao.xml" value="0.17451874366767983" />
<entry key="..\:/picture/fuzhu/app/src/main/res/layout/activity_main.xml" value="0.3170289855072464" />
<entry key="..\:/picture/fuzhu/app/src/main/res/layout/view_test.xml" value="0.17451874366767983" />
<entry key="..\:/fuzhu/app/src/main/res/layout/activity_cancel_thumb_up.xml" value="0.17451874366767983" />
<entry key="..\:/fuzhu/app/src/main/res/layout/activity_main.xml" value="0.35280797101449274" />
<entry key="..\:/fuzhu/app/src/main/res/layout/activity_rec_follow.xml" value="0.35885416666666664" />
<entry key="..\:/fuzhu/app/src/main/res/layout/activity_setting.xml" value="0.35885416666666664" />
<entry key="..\:/fuzhu/wechat/src/main/res/drawable/btn_style.xml" value="0.36923076923076925" />
<entry key="..\:/fuzhu/wechat/src/main/res/drawable/mybutton.xml" value="0.36923076923076925" />
<entry key="..\:/fuzhu/wechat/src/main/res/layout/activity_we_chat_channel.xml" value="0.17451874366767983" />
<entry key="..\:/fuzhu/wechat/src/main/res/layout/layout_wechatplate.xml" value="0.33" />
<entry key="..\:/fuzhu/wechat/src/main/res/layout/view_test_w.xml" value="0.35885416666666664" />
<entry key="..\:/fuzhu/wechat/src/main/res/layout/w_activity_debug.xml" value="0.5" />
<entry key="..\:/fuzhu/wechat/src/main/res/layout/w_activity_main.xml" value="0.33" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
<component name="FindBugsConfigurable">
<option name="make" value="true" />
<option name="effort" value="default" />
<option name="priority" value="Medium" />
<option name="excludeFilter" value="" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SuppressionsComponent">
<option name="suppComments" value="[]" />
</component>
</project>

View File

@@ -0,0 +1,15 @@
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.derry.wechat.debug;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.derry.wechat.debug";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 181;
public static final String VERSION_NAME = "1.8.1";
// Fields from default config.
public static final boolean isRelease = false;
}

View File

@@ -417,6 +417,14 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
}
}
break;
case "3":
if ("android.widget.TextView".equals(child3.getClassName())){
if (child3.getText() != null) {
if (child3.getText().toString().equals("综合")) {
AblService.getInstance().clickcommontwo(child3,"");
}
}
}
default:
}
}

View File

@@ -2,6 +2,7 @@ package com.fisherbone.fuzhu.activity;
import android.Manifest;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
@@ -24,7 +25,7 @@ import android.widget.TextView;
import com.blankj.utilcode.util.ToastUtils;
import com.fisherbone.fuzhu.BaseActivity;
import com.fisherbone.fuzhu.BuildConfig;
import com.derry.wechat.debug.BuildConfig;
import com.fisherbone.fuzhu.ChangLiang;
import com.fisherbone.fuzhu.FZConfig;
import com.fisherbone.fuzhu.FuzhuApplication;
@@ -170,6 +171,7 @@ public class MainActivity extends BaseActivity implements InfoMessage {
private TextView tvShowInfo, tvStutas,yunduanStu,tv_ifcunzai;
private ZhanghaoDao zhanghaoDao;
@SuppressLint("ObsoleteSdkInt")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -60,6 +60,7 @@ class NoticeBase extends BaseAblStep {
return sb.toString();
}
@Override
public boolean allowed() {
boolean ifOpen = false;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
@@ -487,6 +488,7 @@ class NoticeBase extends BaseAblStep {
}
}
//点击右上角搜索
@Override
public void DianSou() {
//华为畅享20
AblService.getInstance().clickPoint(990, 163, 300);

View File

@@ -205,6 +205,7 @@ public class TestAblStep2 extends BaseAblStep {
return name;
}
@Override
public boolean allowed() {
boolean ifOpen = false;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();

View File

@@ -499,6 +499,7 @@ public class TestAblStep30 extends NoticeBase {
/**
* 判断当前页面是否包含某文本
*/
@Override
public AccessibilityNodeInfo isContainText(String str) {
AccessibilityNodeInfo nodeInfo = null;
List<AccessibilityNodeInfo> nodeInfos = AblViewUtil.findByText(str);

View File

@@ -6,14 +6,19 @@ import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo;
import com.fisherbone.fuzhu.ChangLiang;
import com.fisherbone.fuzhu.FuzhuApplication;
import com.fisherbone.fuzhu.abllib.AblService;
import com.fisherbone.fuzhu.abllib.AblStepHandler;
import com.fisherbone.fuzhu.abllib.AblSteps;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.db.CommentBeanData;
import com.fisherbone.fuzhu.db.dao.CommentDao;
import com.fisherbone.fuzhu.entity.AppoBean;
import com.fisherbone.fuzhu.utils.ProfileSpUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* @author keriezhang
@@ -68,12 +73,12 @@ public class TestAblStep32 extends NoticeBase {
// AccessibilityNodeInfo getdaohang = getdaohang();
// //触发容器元素的滚动事件
// getdaohang.performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
AblViewUtil.mySleep(1);
//1为用户 2为直播
//AblViewUtil.mySleep(1);
//1为用户 2为直播 3为综合
selecttype("1");
AblViewUtil.mySleep(3);
getNodeInfoy();
AblStepHandler.sendMsg(AblSteps.STEP_234);
AblStepHandler.sendMsg(AblSteps.STEP_235);
break;
case AblSteps.STEP_234:
AblViewUtil.mySleep(2);
@@ -85,6 +90,20 @@ public class TestAblStep32 extends NoticeBase {
//搜索下一个
AblStepHandler.sendMsg(AblSteps.STEP_232);
break;
case AblSteps.STEP_235:
AblViewUtil.mySleep(1);
selecttype("3");
AblViewUtil.mySleep(1);
AblService.getInstance().clickPoint(256,1198,300);
AblViewUtil.mySleep(3);
AblService.getInstance().clickPoint(999,1261,300);
AblStepHandler.sendMsg(AblSteps.STEP_236);
break;
case AblSteps.STEP_236:
AblViewUtil.mySleep(2);
pinglun();
AblStepHandler.sendMsg(AblSteps.STEP_234);
break;
default:
}
}
@@ -150,6 +169,148 @@ public class TestAblStep32 extends NoticeBase {
}
}
}
private void pinglun() {
AblViewUtil.mySleep(2);
commentClick(AblService.getInstance());
AblViewUtil.mySleep(3);
if (ChangLiang.phonetype.equals("0")) {
//红米7a
AblService.getInstance().clickPoint(153, 1292, 300);
} else if ("3".equals(ChangLiang.phonetype)) {
//红米9a
AblService.getInstance().clickPoint(288, 2121, 300);
} else {
//华为
AblService.getInstance().clickPoint(288, 1548, 300);
}
AblViewUtil.mySleep(2);
//复制文本粘贴在留言板
AccessibilityNodeInfo findcomentt = findcoment();
String conment = getConment();
Log.e("TIAOSHI###", "获得的评论内容" + conment);
AblViewUtil.mySleep(1);
Log.e("TIAOSHI###", "获得的评论内容" + conment);
if (findcomentt != null) {
if (ChangLiang.phonetype.equals("0")) {
Log.e("TIAOSHI###", "获得手机类型" + ChangLiang.phonetype);
//郝总的手机用第一个评论不上去
// AblViewUtil.paste(findcomentt, conment);//红米7a
AblViewUtil.sayInput(conment, findcomentt);
} else {
Log.e("TIAOSHI###", "获得手机类型" + ChangLiang.phonetype);
AblViewUtil.sayInput(conment, findcomentt);//华为畅享20
}
}
//发送
AblViewUtil.mySleep(2);
AccessibilityNodeInfo findcomenttt = findcomentt();
if (findcomenttt != null) {
AblService.getInstance().clickcommontwo(findcomenttt, "发送");
AblViewUtil.mySleep(2);
}
//返回上级页面
AblViewUtil.back();
}
/**
* 随机获取评论话术
*/
private String getConment() {
CommentDao commentDao = new CommentDao(FuzhuApplication.getContext());
List<CommentBeanData> CommentBeanDatas = CommentDao.queryInByCustom("type", "1");
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;
}
}
/**
* 点击评论
*
* @param instance
*/
private void commentClick(AblService instance) {
if (ChangLiang.phonetype.equals("0")) {
instance.clickPoint(659, 810, 300);//红米7a
} else if ("3".equals(ChangLiang.phonetype)) {
//红米9a
AblService.getInstance().clickPoint(996, 1469, 300);
} else {
instance.clickPoint(659, 1066, 300);//华为畅享20 3.评论 [619,1026][699,1106]
}
Log.e("TIAOSHI###", "点击评论按钮");
}
/**
* 寻找留下你的精彩评论
*/
private AccessibilityNodeInfo findcoment() {
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 (!"dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) {
// Log.e("TIAOSHI###ViewPager", "----2Node:" + child.getChildCount());
for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(y);
// Log.e("TIAOSHI###", "----2Node:" + child1.getClassName() + ":" + child1.getText());
// if ("android.widget.LinearLayout".equals(child1.getClassName())) {
for (int x = 0; x < child1.getChildCount(); x++) {
AccessibilityNodeInfo child6 = child1.getChild(x);
// Log.e("TIAOSHI###", "----3Node:" + child6.getClassName() + ":" + child6.getText());
if ("android.widget.EditText".equals(child6.getClassName())) {
infooos = child1.getChild(x);
// Log.e("TIAOSHI###", "----4Node:" + infooos.getClassName() + ":" + infooos.getText());
}
}
}
}
}
return infooos;
}
/**
* 寻找发送
*/
private AccessibilityNodeInfo findcomentt() {
AccessibilityNodeInfo child3 = null;
ArrayList<AccessibilityNodeInfo> objects = new ArrayList<>();
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 (!"dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) {
// Log.e("TIAOSHI###ViewPager", "----2Node:" + child.getChildCount());
for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child2 = child.getChild(y);
// Log.e("TIAOSHI###", "----2Node:" + child2.getClassName() + ":" + child2.getText());
for (int x = 0; x < child2.getChildCount(); x++) {
AccessibilityNodeInfo child1 = child2.getChild(x);
// Log.e("TIAOSHI###", "----3Node:" + child1.getClassName() + ":" + child1.getText());
if ("android.widget.ImageView".equals(child2.getChild(x).getClassName())) {
AccessibilityNodeInfo infooos = child2.getChild(x);
objects.add(infooos);
}
}
// Log.e("TIAOSHI###", "----4Node:" + objects.size());
if (objects.size() > 0) {
child3 = objects.get(objects.size() - 1);
}
}
}
}
return child3;
}
}

View File

@@ -231,6 +231,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
}
}
@Override
public boolean allowed() {
boolean ifOpen = false;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();

View File

@@ -434,6 +434,7 @@ public class TestAblStepBase extends BaseAblStep {
//点击右上角搜索
//[624,67][688,131]
@Override
public void DianSou() {
if (ChangLiang.phonetype.equals("0")) {

View File

@@ -28,17 +28,17 @@
android:layout_centerHorizontal="true"
android:background="@mipmap/icon_recfllow"
/>
<TextView
android:id="@+id/btn_01"
android:layout_width="40dp"
android:layout_height="14dp"
android:text="推荐加关"
android:textColor="#ffffffff"
android:layout_below="@+id/icon_pic"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_below="@+id/icon_pic"
android:textSize="10sp"
/>
android:text="推荐加关"
android:textColor="#ffffffff"
android:textSize="10sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_02"
@@ -309,19 +309,18 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:background="@mipmap/icon_keyword"
/>
android:background="@mipmap/icon_keyword" />
<TextView
android:id="@+id/btn_011"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:text="指定直播间加关"
android:textColor="#ffffffff"
android:layout_below="@+id/icon_pic11"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_below="@+id/icon_pic11"
android:textSize="10sp"
/>
android:text="指定直播间加关"
android:textColor="#ffffffff"
android:textSize="10sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_12"

View File

@@ -8,8 +8,6 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -11,7 +11,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -6,8 +6,6 @@ android {
defaultConfig {
minSdkVersion app_android.minSdkVersion
targetSdkVersion app_android.targetSdkVersion
versionCode 1
versionName "1.0"
consumerProguardFiles 'consumer-rules.pro'
}

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

View File

@@ -36,6 +36,9 @@ public class TestAblStep2 extends AblStepBase {
AblStepHandler.sendMsg(AblSteps.STEP_12);
break;
case AblSteps.STEP_12://点击浏览设置
if (AblViewUtil.isContainText("")){
}
AblViewUtil.clickScreen(18,1);
AblStepHandler.sendMsg(AblSteps.STEP_13);
break;
@@ -99,7 +102,7 @@ public class TestAblStep2 extends AblStepBase {
if (rootNode != null) {
//查找到聚焦的文本
AccessibilityNodeInfo accessibilityNodeInfo = rootNode.findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
boolean isFocuse = accessibilityNodeInfo.isFocused();
// boolean isFocuse = accessibilityNodeInfo.isFocused();
// System.out.println("isFocuse..............................." + isFocuse);
// System.out.println("accessibilityNodeInfo.getClassName()..............................." + accessibilityNodeInfo.getClassName());
// Bundle arguments = new Bundle();