diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java b/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java index ea123c7..6496c96 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/HongbaoBase.java @@ -208,7 +208,7 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF Rect rect = new Rect(); if (child2 != null) { child2.getBoundsInScreen(rect); - if (rect.top >= 2092 && rect.bottom <= 2151 && rect.left >= 800) { + if (rect.top >= 1403 && rect.bottom <= 1462 && rect.left >= 800) { // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); if ("android.widget.TextView".equals(child2.getClassName())) { if (child2.getText() != null) { diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java b/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java index aa4c47f..68019ee 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/NoticeBase.java @@ -17,7 +17,9 @@ import com.fisherbone.fuzhu.abllib.BaseAblStep; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; import com.fisherbone.fuzhu.db.CommentBeanData; import com.fisherbone.fuzhu.entity.FensiBean; +import com.fisherbone.fuzhu.entity.LiwuBean; import com.fisherbone.fuzhu.utils.ProfileSpUtils; +import com.google.gson.Gson; import java.util.ArrayList; import java.util.List; @@ -35,6 +37,7 @@ class NoticeBase extends BaseAblStep { public String IFCONTIAN="x"; private static final String TAG = "Conmon"; private String conment; + private int liwusubstring; @Override public void onStep(int step, Message msg) { @@ -634,28 +637,120 @@ class NoticeBase extends BaseAblStep { /** * 获得背包中第一个位置的了礼物 */ - public List geliwu() { - List liwus = new ArrayList<>(); + public ArrayList geliwu() { + int doubiNum = 0; + ArrayList liwuBeans = new ArrayList<>(); + ArrayList oneInfos = new ArrayList<>(); + ArrayList twoInfos = new ArrayList<>(); + ArrayList threeInfos = new ArrayList<>(); + ArrayList 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); - if ("android.view.ViewGroup".equals(child2.getClassName())) { - Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); - liwus.add(child2); -// for (int x = 0; x < child2.getChildCount(); x++) { -// AccessibilityNodeInfo child3 = child2.getChild(x); -// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription()); -// } + 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 r = 0; r < child3.getChildCount(); r++) { + AccessibilityNodeInfo child4 = child3.getChild(r); + Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + + Rect rect = new Rect(); + child4.getBoundsInScreen(rect); + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 30 && rect.right <= 248) { + + Log.e("TIAOSHI###", "----fourNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + oneInfos.add(child4); + + + } + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 248 && rect.right <= 540) { + + Log.e("TIAOSHI###", "----fourNodetwo:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + twoInfos.add(child4); + + } + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 540 && rect.right <= 810) { + + Log.e("TIAOSHI###", "----fourNodehree:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + threeInfos.add(child4); + + } + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 810 && rect.right <= 1080) { + + Log.e("TIAOSHI###", "----fourNodefour:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + fourInfos.add(child4); + } + } } } } } - return liwus; + 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, ArrayList 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("0"); + } + 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); + } + } + /** * 点击加关注 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 1c96f1d..2778f42 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -33,6 +33,7 @@ public class TestAblStep0 extends BaseAblStep { public String IFCONTIAN = "x"; private int liwusubstring; private RedEnvBean redEnvBean; + @Override public void onStep(int step, Message msg) { switch (step) { @@ -47,24 +48,74 @@ public class TestAblStep0 extends BaseAblStep { //点开礼物 - clickmoreli(); - Log.e("TIAOSHI###", "打开礼物"); - AblViewUtil.mySleep(1); - int doubinum = dangqianDoubi(); - Log.e("TIAOSHI###当前抖币数",doubinum+""); - AblViewUtil.mySleep(2); - clickmenu("5"); - AblViewUtil.mySleep(2); - int geliwu = geliwu(""); - Log.e("TIAOSHI###背包里的抖币数",geliwu+""); - redEnvBean.setLivedoubinumfir(doubinum + geliwu + ""); - Log.e("TIAOSHI###", "初始抖币数" + redEnvBean.getLivedoubinumfir()); - AblViewUtil.mySleep(1); - AblViewUtil.back(); +// clickmoreli(); +// Log.e("TIAOSHI###", "打开礼物"); +// AblViewUtil.mySleep(1); +// int doubinum = dangqianDoubi(); +// Log.e("TIAOSHI###当前抖币数",doubinum+""); +// AblViewUtil.mySleep(2); +// clickmenu("5"); +// AblViewUtil.mySleep(2); +// int geliwu = geliwu(""); +// Log.e("TIAOSHI###背包里的抖币数",geliwu+""); +// redEnvBean.setLivedoubinumfir(doubinum + geliwu + ""); +// Log.e("TIAOSHI###", "初始抖币数" + redEnvBean.getLivedoubinumfir()); +// AblViewUtil.mySleep(1); +// AblViewUtil.back(); + + + AccessibilityNodeInfo hognbaonode = geliwu("小心心").get(0); + clickcommonthree(hognbaonode, ""); default: } } + @RequiresApi(api = Build.VERSION_CODES.N) + public void clickcommonthree(AccessibilityNodeInfo accessibilityNodeInfo, String s) { + if (accessibilityNodeInfo != null) { + Rect rect = new Rect(); + accessibilityNodeInfo.getBoundsInScreen(rect); + AblService.getInstance().clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300); + Log.e("TIAOSHI###", "点击" + s + "按钮"); + Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")"); + } else { + Log.e("TIAOSHI###", "没有找到" + s + "按钮"); + } + } + + /** + * 获得背包中第一个位置的了礼物 + */ + private List geliwu(String text) { + List liwus = new ArrayList<>(); + 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()); + 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); + if (child4.getText() != null) { + if (text.equals(child4.getText().toString())) { + liwus.add(child4); + } + } + } + } + } + } + } + return liwus; + } + /** * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) * 1.说点什么 @@ -78,8 +129,8 @@ public class TestAblStep0 extends BaseAblStep { // 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()); - // nodeZuobiao(child1); + // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); + // nodeZuobiao(child1); if ("android.widget.RelativeLayout".equals(child1.getClassName())) { if (child1.getContentDescription() != null) { if (child1.getContentDescription().equals("礼物")) { @@ -91,6 +142,7 @@ public class TestAblStep0 extends BaseAblStep { } } } + public int dangqianDoubi() { int doubinumr = 0; String getdoubinum = getdoubinum(); @@ -104,25 +156,28 @@ public class TestAblStep0 extends BaseAblStep { } return doubinumr; } + public String getdoubinum() { String doubinum = ""; 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()); - //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); +// 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); Rect rect = new Rect(); if (child2 != null) { child2.getBoundsInScreen(rect); - if (rect.top >= 2092 && rect.bottom <= 2151 && rect.left >= 800) { - // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); + if (rect.top >= 1403 && rect.bottom <= 1462 && rect.left >= 800) { + Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); if ("android.widget.TextView".equals(child2.getClassName())) { if (child2.getText() != null) { String s = child2.getText().toString(); @@ -139,6 +194,7 @@ public class TestAblStep0 extends BaseAblStep { return "0"; } + /** * 点击礼物下面的菜单 * 1.礼物 @@ -155,10 +211,10 @@ public class TestAblStep0 extends BaseAblStep { 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()); + // 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()); + // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription()); switch (type) { case "1"://礼物 if ("android.widget.TextView".equals(child3.getClassName())) { @@ -203,85 +259,91 @@ public class TestAblStep0 extends BaseAblStep { } } } + /** * 获得背包中第一排位置的了礼物 */ - private int geliwu(String text) { - int doubiNum = 0; - ArrayList liwuBeans = new ArrayList<>(); - ArrayList oneInfos = new ArrayList<>(); - ArrayList twoInfos = new ArrayList<>(); - ArrayList threeInfos = new ArrayList<>(); - ArrayList 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); +// private int geliwu(String text) { +// int doubiNum = 0; +// ArrayList liwuBeans = new ArrayList<>(); +// ArrayList oneInfos = new ArrayList<>(); +// ArrayList twoInfos = new ArrayList<>(); +// ArrayList threeInfos = new ArrayList<>(); +// ArrayList 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 >= 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= 1526 && rect.bottom <= 1781 && rect.left >= 30 && rect.right <= 248) { +// +// Log.e("TIAOSHI###", "----fourNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); +// nodeZuobiao(child4); +// oneInfos.add(child4); +// +// +// } +// if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 248 && rect.right <= 540) { +// +// Log.e("TIAOSHI###", "----fourNodetwo:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); +// nodeZuobiao(child4); +// twoInfos.add(child4); +// +// } +// if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 540 && rect.right <= 810) { +// +// Log.e("TIAOSHI###", "----fourNodehree:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); +// nodeZuobiao(child4); +// threeInfos.add(child4); +// +// } +// if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 810 && rect.right <= 1080) { +// +// Log.e("TIAOSHI###", "----fourNodefour:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); +// nodeZuobiao(child4); +// fourInfos.add(child4); +// } +// } +// } +// } +// } +// } +// 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, ArrayList oneInfos) { LiwuBean liwuBean = new LiwuBean(); if (oneInfos.size() > 0) { @@ -290,15 +352,15 @@ public class TestAblStep0 extends BaseAblStep { String s1 = oneInfos.get(1).getText().toString(); liwuBean.setLiwuName(s1); // String s2 = oneInfos.get(2).getText().toString(); - if(s1.equals("大啤酒")) { + if (s1.equals("大啤酒")) { liwuBean.setLiwuDanjia("2"); - }else if(s1.equals("小心心")){ + } else if (s1.equals("小心心")) { liwuBean.setLiwuDanjia("1"); - }else if(s1.equals("棒棒糖")){ + } else if (s1.equals("棒棒糖")) { liwuBean.setLiwuDanjia("9"); - }else if(s1.equals("玫瑰")){ + } else if (s1.equals("玫瑰")) { liwuBean.setLiwuDanjia("1"); - }else { + } else { liwuBean.setLiwuDanjia("0"); } String s3 = oneInfos.get(3).getText().toString(); @@ -307,13 +369,36 @@ public class TestAblStep0 extends BaseAblStep { liwusubstring = Integer.valueOf(substring); Log.e("TIAOSHI###", "----礼物个数=:" + substring); } - liwuBean.setLiwuNum(liwusubstring+""); + liwuBean.setLiwuNum(liwusubstring + ""); String liwuDanjia = liwuBean.getLiwuDanjia(); int danjia = Integer.valueOf(liwuDanjia); - liwuBean.setLiwuDoubi(liwusubstring*danjia+""); + liwuBean.setLiwuDoubi(liwusubstring * danjia + ""); liwuBeans.add(liwuBean); } } + + + /** + * 获得背包中第一个位置的了礼物 + */ + public List geliwu() { + List liwus = new ArrayList<>(); + 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); + if ("android.view.ViewGroup".equals(child2.getClassName())) { + Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); + liwus.add(child2); + } + } + } + } + return liwus; + } } 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 97030b2..396a033 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep30.java @@ -15,6 +15,7 @@ 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.LiveBean; +import com.fisherbone.fuzhu.entity.LiwuBean; import com.fisherbone.fuzhu.utils.ProfileSpUtils; import com.fisherbone.fuzhu.utils.StringUtils; import com.jeremyliao.liveeventbus.LiveEventBus; @@ -134,8 +135,6 @@ public class TestAblStep30 extends NoticeBase { AblViewUtil.mySleep(randumInt10); } AblStepHandler.sendMsg(AblSteps.STEP_216); - //AblStepHandler.sendMsg(AblSteps.STEP_217); - // AblStepHandler.sendMsg(AblSteps.STEP_213); break; case AblSteps.STEP_216: if(liveBean.getSwitchfive()) { @@ -146,24 +145,18 @@ public class TestAblStep30 extends NoticeBase { AblViewUtil.mySleep(2); clickmenu("5"); AblViewUtil.mySleep(2); - List geliwu = geliwu(); + ArrayList geliwu = geliwu(); if (geliwu.size() > 0) { //获得礼物数 - AccessibilityNodeInfo nodeinfo = geliwu.get(0); - AccessibilityNodeInfo child9 = nodeinfo.getChild(nodeinfo.getChildCount() - 1); - if (child9.getText() != null) { - String str1 = child9.getText().toString(); - if (str1.contains(IFCONTIAN)) { - String substring = str1.substring(1); - liwusubstring = Integer.valueOf(substring); - Log.e("TIAOSHI###", "----礼物个数=:" + substring); - } - } - clickcommonthree(nodeinfo, ""); + LiwuBean liwuBean = geliwu.get(0); + String liwuNum = liwuBean.getLiwuNum(); + liwusubstring = Integer.parseInt(liwuNum); + Log.e("TIAOSHI###", "----礼物个数=:" + liwusubstring); + AblService.getInstance().clickPoint(120, 1653, 300); AblViewUtil.mySleep(1); for (int i = 0; i < liwusubstring; i++) { AblViewUtil.mySleep(1); - clickcommonthree(nodeinfo, ""); + AblService.getInstance().clickPoint(120, 1653, 300); AblViewUtil.mySleep(4); } AblViewUtil.mySleep(1); @@ -186,7 +179,7 @@ public class TestAblStep30 extends NoticeBase { LiveBean liveBean1 = ProfileSpUtils.getInstance().getLiveBean(); String liwunum = liveBean1.getLiwucishu(); int fastnum = Integer.valueOf(liwunum); - faliwu("大啤酒", 2, fastnum); + faliwu("小心心", 1, fastnum); AblViewUtil.back(); } int randumInt12 = RandumInt.getRandumInt10(); @@ -194,42 +187,6 @@ public class TestAblStep30 extends NoticeBase { AblStepHandler.sendMsg(AblSteps.STEP_214); break; case AblSteps.STEP_218: - -// //直播间刷红包 -// AblViewUtil.mySleep(2); -// //点击发红包 -// int getdoubi = getdoubi(); -// //获得刷礼物的次数 -// LiveBean liveBean1 = ProfileSpUtils.getInstance().getLiveBean(); -// String hongbaonum = liveBean1.getHongbaonum(); -// int fastnum = Integer.valueOf(hongbaonum); -// int fastdoubi = fastnum * 20; -// if (getdoubi >= fastdoubi) { -// } else { -// fastdoubi = getdoubi; -// } -// double num = fastdoubi / 20; -// int intnum = new Double(num).intValue(); -// if (intnum > 0) { -// for (int i = 0; i < intnum; i++) { -// AblViewUtil.mySleep(1); -// //点开礼物 -// clickmoreli(); -// //触发容器元素的滚动事件 -// ArrayList getrecyy = getrecyy(); -// getrecyy.get(0).performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); -// AblViewUtil.mySleep(3); -// List geliwwu = geliwu("红包"); -// AccessibilityNodeInfo hognbaonode = geliwwu.get(0); -// clickcommonthree(hognbaonode, ""); -// String hongbaotime = ProfileSpUtils.getInstance().getLiveBean().getHongbaotime(); -// int jiangetime = Integer.valueOf(hongbaotime); -// AblViewUtil.mySleep(jiangetime); -// } -// } else { -// Log.e("TIAOSHI###", "发红包的抖币不够了"); -// } - AblStepHandler.sendMsg(AblSteps.STEP_219); break; case AblSteps.STEP_219: @@ -252,7 +209,7 @@ public class TestAblStep30 extends NoticeBase { private void faliwu(String str,int danjia,int fastnum) { AblViewUtil.mySleep(2); int getdoubi = getdoubi(); - + Log.e("TIAOSHI###", "当前抖币数"+getdoubi); int fastdoubi = fastnum * danjia; if (getdoubi >= fastdoubi) { } else { @@ -727,18 +684,22 @@ public class TestAblStep30 extends NoticeBase { 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()); - if (child3.getText() != null) { - if (text.equals(child3.getText().toString())) { - liwus.add(child2); + 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()); + 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); + if (child4.getText() != null) { + if (text.equals(child4.getText().toString())) { + liwus.add(child4); } } } } - + } } } return liwus; @@ -752,24 +713,28 @@ public class TestAblStep30 extends NoticeBase { private int getdoubi() { int doubinum = 0; 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()); - for (int y = 0; y < child.getChildCount(); y++) { - AccessibilityNodeInfo child1 = child.getChild(y); - // 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()); - Rect rect = new Rect(); - child2.getBoundsInScreen(rect); - if (rect.top >= 2092 && rect.bottom <= 2151) { - if ("android.widget.TextView".equals(child2.getClassName())) { - if (child2.getText() != null) { - String doubi = child2.getText().toString(); - Log.e("TIAOSHI###", "----抖币数:" + doubi); - doubinum = Integer.valueOf(doubi); - + 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()); + //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); + Rect rect = new Rect(); + if (child2 != null) { + child2.getBoundsInScreen(rect); + if (rect.top >= 1403 && rect.bottom <= 1462 && rect.left >= 800) { + // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); + if ("android.widget.TextView".equals(child2.getClassName())) { + if (child2.getText() != null) { + String s = child2.getText().toString(); + doubinum = Integer.valueOf(s); + } + } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java index 71a54bb..a348d5e 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java @@ -1005,38 +1005,44 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red // 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); + 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 >= 30 && rect.right <= 248) { + 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); - Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - nodeZuobiao(child3); - oneInfos.add(child3); + Rect rect = new Rect(); + child4.getBoundsInScreen(rect); + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 30 && rect.right <= 248) { + + Log.e("TIAOSHI###", "----fourNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + oneInfos.add(child4); - } - if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 248 && rect.right <= 540) { + } + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 248 && rect.right <= 540) { - Log.e("TIAOSHI###", "----fourNodetwo:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - nodeZuobiao(child3); - twoInfos.add(child3); + Log.e("TIAOSHI###", "----fourNodetwo:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + twoInfos.add(child4); - } - if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 540 && rect.right <= 810) { + } + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 540 && rect.right <= 810) { - Log.e("TIAOSHI###", "----fourNodehree:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - nodeZuobiao(child3); - threeInfos.add(child3); + Log.e("TIAOSHI###", "----fourNodehree:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + threeInfos.add(child4); - } - if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 810 && rect.right <= 1080) { + } + if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 810 && rect.right <= 1080) { - Log.e("TIAOSHI###", "----fourNodefour:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - nodeZuobiao(child3); - fourInfos.add(child3); + Log.e("TIAOSHI###", "----fourNodefour:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + nodeZuobiao(child4); + fourInfos.add(child4); + } } } } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java index eda0983..103376a 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStepXin5.java @@ -229,6 +229,11 @@ public class TestAblStepXin5 extends BaseAblStep { if (ChangLiang.guanzhunum < maxnumber) { //满足条件执行点赞关注评论 if (ChangLiang.condition.equals("0")) { + if (userProfie.getRandomattention()) { + //点击加关注 + clickGuanzhu(); + } + AblViewUtil.mySleep(2); AblViewUtil.back(); Log.e("TIAOSHI###", "满足点赞关注评论条件" + ChangLiang.condition); operation(); @@ -260,6 +265,32 @@ public class TestAblStepXin5 extends BaseAblStep { } } + /** + * 详情页面点击关注 + */ + 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); + + Rect rect = new Rect(); + child.getBoundsInScreen(rect); + if (rect.top >= 800 && rect.bottom <= 1473) { + if ("android.widget.TextView".equals(child.getClassName())) { + if(child.getText()!=null) { + if ("关注".equals(child.getText().toString())) { + clickcommontwo(child, "关注"); + break; + } + } + } + } + + } + } + private boolean getCondition() { boolean flag = false; @@ -360,10 +391,10 @@ public class TestAblStepXin5 extends BaseAblStep { Log.e("TIAOSHI###", "点赞参数" + userProfie.getRandomlikes()); homeDianzan(); } - AblViewUtil.mySleep(2); - if (userProfie.getRandomattention()) { - addguanzhu(); - } +// AblViewUtil.mySleep(2); +// if (userProfie.getRandomattention()) { +// addguanzhu(); +// } AblViewUtil.mySleep(2); //评论 if (userProfie.getRandomreview()) {