From 297bf966605d68a5531c0203d1beaae00a668636 Mon Sep 17 00:00:00 2001 From: jianbo <263303411@qq.com> Date: Wed, 27 Oct 2021 15:02:19 +0800 Subject: [PATCH] atom --- .../fisherbone/fuzhu/step/TestAblStep34.java | 2 + .../fisherbone/fuzhu/step/TestAblStep6.java | 194 +++--------------- 2 files changed, 27 insertions(+), 169 deletions(-) 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 d3d87fc..4613e91 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java @@ -1071,6 +1071,8 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red 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)) { 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 c5ecdea..7bc0e9d 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep6.java @@ -114,11 +114,11 @@ public class TestAblStep6 extends BaseAblStep { case AblSteps.STEP_14: //获取一屏幕数据:快照 AccessibilityNodeInfo roott = AblService.getInstance().getRootInActiveWindow(); - List idsj = roott.findAccessibilityNodeInfosByText("查找好友并关注"); + List idsj = roott.findAccessibilityNodeInfosByText("查找朋友并关注"); if (idsj.size() > 0) { AccessibilityNodeInfo accessibilityNodeInfo = idsj.get(0); CharSequence text1 = accessibilityNodeInfo.getText(); - if (text1.equals("查找好友并关注")) { + if (text1.equals("查找朋友并关注")) { ChangLiang.ishuodong = "F"; AblViewUtil.back(); } @@ -229,132 +229,6 @@ 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(); @@ -420,12 +294,6 @@ public class TestAblStep6 extends BaseAblStep { } } } - - -// AblViewUtil.mySleep(2); -// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); -// clickcommontwo(quxiao, "取消关注"); - } } } @@ -445,16 +313,33 @@ public class TestAblStep6 extends BaseAblStep { } catch (InterruptedException e) { e.printStackTrace(); } - clickcommontwo(child, "已关注"); +// clickcommontwo(child, "已关注"); + + + Rect rect = new Rect(); + if (child != null) { + child.getBoundsInScreen(rect); + if (rect.top <= 2100) { + 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); + // clickcommontwo(child, "互相关注"); + Rect rect = new Rect(); + child.getBoundsInScreen(rect); + if (rect.top <= 2100) { + clickcommontwo(child, "互相关注"); + } + AblViewUtil.mySleep(2); + List liats = AblViewUtil.findByText("取消关注"); + if(liats.size()>0) { + AblService.getInstance().clickPoint(720, 1948, 300); + AblViewUtil.mySleep(1); + } + AblViewUtil.mySleep(1); } } } @@ -540,34 +425,5 @@ public class TestAblStep6 extends BaseAblStep { } } } - - /** - * 获得取消关注 - */ - private AccessibilityNodeInfo getquxiaoguanzhu() { - AccessibilityNodeInfo nodeinfo = null; - 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()); - // if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { - if ("android.widget.HorizontalScrollView".equals(child.getClassName())) { - // Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount()); - for (int y = 0; y < child.getChildCount(); y++) { - AccessibilityNodeInfo child1 = child.getChild(y); - // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); - if ("android.widget.TextView".equals(child1.getClassName())) { - CharSequence text = child1.getText(); - if (text != null) { - if (text.toString().contains("# 互相关注")) { - nodeinfo = child1; - } - } - } - } - } - } - return nodeinfo; - } }