atom
This commit is contained in:
@@ -345,20 +345,20 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
|
||||
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);
|
||||
// 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###", "----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);
|
||||
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);
|
||||
// for (int r = 0; r < child3.getChildCount(); r++) {
|
||||
// AccessibilityNodeInfo child4 = child3.getChild(r);
|
||||
// Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription());
|
||||
@@ -382,8 +382,8 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
62
app/src/main/java/com/fisherbone/fuzhu/entity/LiwuBean.java
Normal file
62
app/src/main/java/com/fisherbone/fuzhu/entity/LiwuBean.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.fisherbone.fuzhu.entity;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Time: 2020/8/28
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class LiwuBean {
|
||||
|
||||
private String liwuName = "" ;//礼物名称
|
||||
|
||||
public String getLiwuName() {
|
||||
return liwuName;
|
||||
}
|
||||
|
||||
public void setLiwuName(String liwuName) {
|
||||
this.liwuName = liwuName;
|
||||
}
|
||||
|
||||
public String getLiwuNum() {
|
||||
return liwuNum;
|
||||
}
|
||||
|
||||
public void setLiwuNum(String liwuNum) {
|
||||
this.liwuNum = liwuNum;
|
||||
}
|
||||
|
||||
public String getLiwuDanjia() {
|
||||
return liwuDanjia;
|
||||
}
|
||||
|
||||
public void setLiwuDanjia(String liwuDanjia) {
|
||||
this.liwuDanjia = liwuDanjia;
|
||||
}
|
||||
|
||||
private String liwuNum = "" ;//礼物数量
|
||||
private String liwuDanjia = "" ;//礼物单价
|
||||
|
||||
public String getLiwuTime() {
|
||||
return liwuTime;
|
||||
}
|
||||
|
||||
public void setLiwuTime(String liwuTime) {
|
||||
this.liwuTime = liwuTime;
|
||||
}
|
||||
|
||||
private String liwuTime = "" ;//礼物过期时间
|
||||
|
||||
public String getLiwuDoubi() {
|
||||
return liwuDoubi;
|
||||
}
|
||||
|
||||
public void setLiwuDoubi(String liwuDoubi) {
|
||||
this.liwuDoubi = liwuDoubi;
|
||||
}
|
||||
|
||||
private String liwuDoubi = "" ;//礼物的抖币
|
||||
|
||||
|
||||
}
|
||||
@@ -138,15 +138,17 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
|
||||
for (int y = 0; y < child.getChildCount(); y++) {
|
||||
AccessibilityNodeInfo child1 = child.getChild(y);
|
||||
// Log.e("TIAOSHI###", "one----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
|
||||
for (int j = 0; j < child1.getChildCount(); j++) {
|
||||
AccessibilityNodeInfo child2 = child1.getChild(j);
|
||||
if(child1!=null) {
|
||||
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!=null) {
|
||||
if ("android.widget.TextView".equals(child2.getClassName())) {
|
||||
if (child2.getText() != null) {
|
||||
if ("说点什么...".equals(child2.getText().toString())) {
|
||||
nodeinfo = child2;
|
||||
if (child2 != null) {
|
||||
if ("android.widget.TextView".equals(child2.getClassName())) {
|
||||
if (child2.getText() != null) {
|
||||
if ("说点什么...".equals(child2.getText().toString())) {
|
||||
nodeinfo = child2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ 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;
|
||||
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;
|
||||
@@ -26,11 +29,12 @@ public class TestAblStep0 extends BaseAblStep {
|
||||
public String SHEBEITIPE_VILUEONE = "0";
|
||||
public String SHEBEITIPE_VILUETHREE = "3";
|
||||
private ArrayList<AccessibilityNodeInfo> accessibilityNodeInfos;
|
||||
private String direction ="0";//0代表向上滑动,1代表向下
|
||||
public String IFCONTIAN="x";
|
||||
private String direction = "0";//0代表向上滑动,1代表向下
|
||||
public String IFCONTIAN = "x";
|
||||
private int liwusubstring;
|
||||
private boolean noqinmidu=true;
|
||||
private boolean noqinmidu = true;
|
||||
private int num3;
|
||||
|
||||
@Override
|
||||
public void onStep(int step, Message msg) {
|
||||
switch (step) {
|
||||
@@ -42,121 +46,177 @@ public class TestAblStep0 extends BaseAblStep {
|
||||
break;
|
||||
case AblSteps.STEP_2:
|
||||
AblViewUtil.mySleep(2);
|
||||
//getNodeInfoh();
|
||||
// (138,148),(278,193)
|
||||
// String nodeName = getNodeName();
|
||||
// Log.e("TIAOSHI###", nodeName);
|
||||
|
||||
// moveLive("九九美食");
|
||||
// boolean enterfensituan = enterfensituan();
|
||||
// Log.e("TIAOSHI###", "最终=="+enterfensituan);
|
||||
|
||||
if (ifControlView()) {
|
||||
openFudai();
|
||||
}
|
||||
// getNodeInfoh();
|
||||
clickmenu("5");
|
||||
geliwu("");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
public boolean ifControlView() {
|
||||
boolean ifcontain = false;
|
||||
//监听一次有没有控件
|
||||
int jiedianhuoqutwo = jiedianhuoqutwo();
|
||||
Log.e("TIAOSHI###", "获得的控件个数==" + jiedianhuoqutwo);
|
||||
if (jiedianhuoqutwo > 0) {
|
||||
ifcontain = true;
|
||||
}
|
||||
return ifcontain;
|
||||
}
|
||||
|
||||
private void openFudai(){
|
||||
for (int j = 0; j < accessibilityNodeInfos.size(); j++) {
|
||||
AccessibilityNodeInfo child2 = accessibilityNodeInfos.get(j);
|
||||
if (child2 != null) {
|
||||
clickNodeInfo(child2, "");
|
||||
Log.e("TIAOSHI###", "点击控件" + j);
|
||||
Rect rect = new Rect();
|
||||
child2.getBoundsInScreen(rect);
|
||||
Log.e("TIAOSHI###", "----显示控件点击的控件坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")");
|
||||
}
|
||||
AblViewUtil.mySleep(2);
|
||||
int pagetype = pagetype();
|
||||
if (pagetype == 1) {
|
||||
Log.e("TIAOSHI###","福袋测试1");
|
||||
AblViewUtil.mySleep(1);
|
||||
AblService.getInstance().clickPoint(540, 1663, 300);
|
||||
AblViewUtil.mySleep(1);
|
||||
int pagetype1 = pagetype();
|
||||
if (pagetype1 == 1) {
|
||||
Log.e("TIAOSHI###", "第一次点击没有关掉");
|
||||
AblViewUtil.mySleep(1);
|
||||
Log.e("TIAOSHI###", "再次点击关闭按钮");
|
||||
AblViewUtil.back();
|
||||
AblViewUtil.mySleep(1);
|
||||
} else {
|
||||
Log.e("TIAOSHI###", "优惠卷弹框关闭了");
|
||||
}
|
||||
} else if (pagetype == 2) {
|
||||
|
||||
break;
|
||||
} else if (pagetype == 21) {
|
||||
AblViewUtil.mySleep(1);
|
||||
AblService.getInstance().clickPoint(100, 100, 300);
|
||||
AblViewUtil.mySleep(1);
|
||||
} else if (pagetype == 4) {
|
||||
AblViewUtil.mySleep(2);
|
||||
AblService.getInstance().clickPoint(100, 100, 300);
|
||||
AblViewUtil.mySleep(1);
|
||||
} else {
|
||||
AblViewUtil.mySleep(1);
|
||||
AblService.getInstance().clickPoint(100, 100, 300);
|
||||
AblViewUtil.mySleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
public int pagetype() {
|
||||
int childCount = 0;
|
||||
/**
|
||||
* 点击礼物下面的菜单
|
||||
* 1.礼物
|
||||
* 2.表情
|
||||
* 3.粉丝团
|
||||
* 4.等级
|
||||
* 5.背包
|
||||
*/
|
||||
public void clickmenu(String type) {
|
||||
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
|
||||
if (root != null) {
|
||||
childCount = root.getChildCount();
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
AccessibilityNodeInfo child = root.getChild(i);
|
||||
// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
|
||||
if ("androidx.viewpager.widget.ViewPager".equals(child.getClassName())) {
|
||||
childCount = 4;
|
||||
}
|
||||
if("android.widget.Button".equals(child.getClassName())){
|
||||
childCount =21;
|
||||
}
|
||||
}
|
||||
}
|
||||
return childCount;
|
||||
}
|
||||
public int jiedianhuoqutwo() {
|
||||
accessibilityNodeInfos = new ArrayList<>();
|
||||
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
|
||||
if (root != null) {
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
AccessibilityNodeInfo child = root.getChild(i);
|
||||
// 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());
|
||||
Rect rect = new Rect();
|
||||
child1.getBoundsInScreen(rect);
|
||||
if(child1!=null) {
|
||||
if (rect.top >= 319 && rect.bottom <= 418 && rect.right < 706) {
|
||||
if ("android.widget.FrameLayout".equals(child1.getClassName())) {
|
||||
accessibilityNodeInfos.add(child1);
|
||||
}
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
AccessibilityNodeInfo child = root.getChild(i);
|
||||
for (int y = 0; y < child.getChildCount(); y++) {
|
||||
AccessibilityNodeInfo child1 = child.getChild(y);
|
||||
for (int j = 0; j < child1.getChildCount(); j++) {
|
||||
AccessibilityNodeInfo child2 = child1.getChild(j);
|
||||
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
|
||||
for (int x = 0; x < child2.getChildCount(); x++) {
|
||||
AccessibilityNodeInfo child3 = child2.getChild(x);
|
||||
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription());
|
||||
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(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("表情")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "3"://粉丝团
|
||||
if ("android.widget.TextView".equals(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("粉丝团")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "4"://等级
|
||||
if ("android.widget.TextView".equals(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("等级")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
case "5"://背包
|
||||
if ("android.widget.TextView".equals(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("背包")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return accessibilityNodeInfos.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得背包中第一排位置的了礼物
|
||||
*/
|
||||
private void geliwu(String text) {
|
||||
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<>();
|
||||
|
||||
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);
|
||||
|
||||
Rect rect = new Rect();
|
||||
child3.getBoundsInScreen(rect);
|
||||
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 40 && 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":""}]
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
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+"");
|
||||
liwuBeans.add(liwuBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.fisherbone.fuzhu.abllib.AblSteps;
|
||||
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
|
||||
import com.fisherbone.fuzhu.db.RedenvBeanData;
|
||||
import com.fisherbone.fuzhu.db.dao.RedenvDao;
|
||||
import com.fisherbone.fuzhu.entity.LiwuBean;
|
||||
import com.fisherbone.fuzhu.entity.RedEnvBean;
|
||||
import com.fisherbone.fuzhu.hongbao.CursorRed;
|
||||
import com.fisherbone.fuzhu.hongbao.RedEnv;
|
||||
@@ -21,6 +22,7 @@ import com.fisherbone.fuzhu.okgonet.HttpConstants;
|
||||
import com.fisherbone.fuzhu.okgonet.NetApi;
|
||||
import com.fisherbone.fuzhu.utils.DateUtils;
|
||||
import com.fisherbone.fuzhu.utils.ProfileSpUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.jeremyliao.liveeventbus.LiveEventBus;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
@@ -45,6 +47,8 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
//true 为向下滑动状态
|
||||
private boolean slidingDir = true;
|
||||
private boolean ifend;
|
||||
public String IFCONTIAN = "x";
|
||||
private int liwusubstring;
|
||||
|
||||
public TestAblStep34(Context mcontext) {
|
||||
this.mcontext = mcontext;
|
||||
@@ -164,7 +168,11 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
Log.e("TIAOSHI###", "打开礼物");
|
||||
AblViewUtil.mySleep(1);
|
||||
int doubinum = dangqianDoubi();
|
||||
redEnvBean.setLivedoubinumfir(doubinum + "");
|
||||
clickmenu("5");
|
||||
AblViewUtil.mySleep(1);
|
||||
int geliwu = geliwu("");
|
||||
Log.e("背包里的抖币数",geliwu+"");
|
||||
redEnvBean.setLivedoubinumfir(doubinum + geliwu + "");
|
||||
Log.e("TIAOSHI###", "初始抖币数" + redEnvBean.getLivedoubinumfir());
|
||||
taskDbTj("0" + "", redEnvBean.getLivedoubinumfir());
|
||||
AblViewUtil.back();
|
||||
@@ -172,13 +180,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_254);
|
||||
break;
|
||||
case AblSteps.STEP_254:
|
||||
// boolean b2 = liveOver();
|
||||
// if(b2){
|
||||
// Log.e("TIAOSHI###", "当前直播间已退播");
|
||||
// AblViewUtil.mySleep(20);
|
||||
// }else {
|
||||
// Log.e("TIAOSHI###", "当前直播间未退播");
|
||||
// }
|
||||
|
||||
AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
if (nodeInfoS != null) {
|
||||
Log.e("TIAOSHI###", "页面在直播页面");
|
||||
@@ -930,6 +932,183 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 点击礼物下面的菜单
|
||||
* 1.礼物
|
||||
* 2.表情
|
||||
* 3.粉丝团
|
||||
* 4.等级
|
||||
* 5.背包
|
||||
*/
|
||||
public void clickmenu(String type) {
|
||||
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
AccessibilityNodeInfo child = root.getChild(i);
|
||||
for (int y = 0; y < child.getChildCount(); y++) {
|
||||
AccessibilityNodeInfo child1 = child.getChild(y);
|
||||
for (int j = 0; j < child1.getChildCount(); j++) {
|
||||
AccessibilityNodeInfo child2 = child1.getChild(j);
|
||||
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
|
||||
for (int x = 0; x < child2.getChildCount(); x++) {
|
||||
AccessibilityNodeInfo child3 = child2.getChild(x);
|
||||
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription());
|
||||
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(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("表情")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "3"://粉丝团
|
||||
if ("android.widget.TextView".equals(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("粉丝团")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "4"://等级
|
||||
if ("android.widget.TextView".equals(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("等级")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
case "5"://背包
|
||||
if ("android.widget.TextView".equals(child3.getClassName())) {
|
||||
if (child3.getText().toString().equals("背包")) {
|
||||
AblService.getInstance().clickcommontwo(child3, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得背包中第一排位置的了礼物
|
||||
*/
|
||||
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<>();
|
||||
|
||||
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);
|
||||
|
||||
Rect rect = new Rect();
|
||||
child3.getBoundsInScreen(rect);
|
||||
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 40 && 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;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ ext {
|
||||
applicationId : "com.fisherbone.fuzhu",
|
||||
minSdkVersion : 24,
|
||||
targetSdkVersion : 29,
|
||||
versionCode : 164,
|
||||
versionName : "1.6.4",
|
||||
versionCode : 165,
|
||||
versionName : "1.6.5",
|
||||
testInstrumentationRunner: "androidx.test.runner.AndroidJUnitRunner"
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user