diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java index 90cbfbe..ebc114b 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java +++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java @@ -471,13 +471,13 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { AccessibilityNodeInfo child4 = child3.getChild(r); Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription()); nodeZuobiao(child4); - for (int m = 0; m < child4.getChildCount(); m++) { - AccessibilityNodeInfo child5 = child4.getChild(m); - Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); - nodeZuobiao(child5); - for (int p = 0; p < child5.getChildCount();p++) { - AccessibilityNodeInfo child6 = child5.getChild(p); - Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription()); +// for (int m = 0; m < child4.getChildCount(); m++) { +// AccessibilityNodeInfo child5 = child4.getChild(m); +// Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); +// nodeZuobiao(child5); +// for (int p = 0; p < child5.getChildCount();p++) { +// AccessibilityNodeInfo child6 = child5.getChild(p); +// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription()); // for (int t = 0; t < child6.getChildCount();t++) { // AccessibilityNodeInfo child7 = child6.getChild(t); // Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription()); @@ -487,8 +487,8 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener { // // } // } - } - } +// } + // } } } } 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 f451ee7..3fc0311 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -1,33 +1,15 @@ package com.fisherbone.fuzhu.step; -import android.accessibilityservice.AccessibilityService; -import android.accessibilityservice.GestureDescription; -import android.annotation.TargetApi; -import android.graphics.Path; import android.graphics.Rect; -import android.os.Build; import android.os.Message; import android.util.Log; import android.view.accessibility.AccessibilityNodeInfo; -import androidx.annotation.Nullable; - -import com.blankj.utilcode.util.ScreenUtils; -import com.fisherbone.fuzhu.ChangLiang; 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; -import com.fisherbone.fuzhu.utils.ProfileSpUtils; -import com.google.gson.Gson; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; /** * 获得作品时间 @@ -47,167 +29,21 @@ public class TestAblStep0 extends BaseAblStep { break; case AblSteps.STEP_2: AblViewUtil.mySleep(5); - // getNodeInfoh(); - // cancelGuanzhu(AblService.getInstance()); + // getNodeInfoh(); + // getNodeInfoy(); + getNodeInfohg(); + //(0,562),(1080,774) + // isContainText("关注"); + - boolean nodeInfoh = ifGaunzhu(); - if(nodeInfoh){ - Log.e("TIAOSHI###", "此视频没有关注过"); - }else { - Log.e("TIAOSHI###", "此视频已关注"); - return; - } - 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 - */ - public AccessibilityNodeInfo geouyintdd() { - 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 ("android.widget.ImageView".equals(child.getClassName())) { - if(child.getContentDescription()!=null) { - if (child.getContentDescription().toString().equals("发送")) { - nodeinfo = child; - } - } - } - } - return nodeinfo; - } - /** - * 输入框 - * @return - */ - public AccessibilityNodeInfo getedittext() { - 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 ("android.widget.EditText".equals(child.getClassName())) { - nodeinfo=child; - } - } - return nodeinfo; - } - /** - * 判断当前页面是否包含某文本 - */ - public AccessibilityNodeInfo isContainText(String str) { - - AccessibilityNodeInfo nodeInfo = null; - List nodeInfos = AblViewUtil.findByText(str); - for (int i=0;i0&&rect.top>2000&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) { - Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); - nodeZuobiao(child); - nodeInfo = child; - } - } - return nodeInfo; - } /** - * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) - * 1.说点什么 - * 2.更多 - * 3.礼物 + * 寻找控件 */ - public void clickmoreli(String type) { - 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()); - 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()); - switch (type) { - case "1"://说点什么 - if ("android.widget.TextView".equals(child4.getClassName())) { - if (child4.getText() != null) { - if (child4.getText().toString().equals("说点什么...")) { - AblService.getInstance().clickcommontwo(child4, ""); - } - } - } - break; - case "2"://更多 - if ("android.widget.Button".equals(child4.getClassName())) { - if (child4.getContentDescription().equals("更多")) { - AblService.getInstance().clickcommontwo(child4, "点击了更多"); - } - } - break; - case "3"://礼物 - if ("android.widget.Button".equals(child4.getClassName())) { - if (child4.getContentDescription().equals("礼物")) { - AblService.getInstance().clickcommontwo(child4, ""); - } - } - break; - default: - } - } - } - } - } - } - } - - - - - - private void cancelGuanzhu(AblService instance) { + public void getNodeInfohg() { AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); @@ -217,115 +53,47 @@ public class TestAblStep0 extends BaseAblStep { 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); -// yiguanzhu(child5); + if ("androidx.recyclerview.widget.RecyclerView".equals(child2.getClassName())) { + // if (j == child1.getChildCount() - 1) { + Rect rect = new Rect(); + child2.getBoundsInScreen(rect); + if (rect.right > 0) { +// 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.FrameLayout".equals(child3.getClassName())) { + if (x == 0) { + 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); + + + for (int m = 0; m < child4.getChildCount(); m++) { + AccessibilityNodeInfo child5 = child4.getChild(m); + + if ("com.lynx.tasm.behavior.ui.view.UIView".equals(child5.getClassName())) { + if ("关注".equals(child5.getContentDescription())) { + Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription()); + nodeZuobiao(child5); + clickcommontwo(child5, ""); + } + + } + } + } } } } - } - } - } - } - } - } - - // 3.遍历info中的子节点 (优化方法,正在测试) - public void yiguanzhu(AccessibilityNodeInfo child2) { - boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed(); - boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor(); - if (cancelclosed&&!cancelcrosscor) { - Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ"); - 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("已关注")) { - continue; - } - } - - try { - Thread.sleep(300); - } catch (InterruptedException e) { - e.printStackTrace(); - } - if (child.getText() != null) { - if (child.getText().toString().equals("已关注")) { - clickcommontwo(child, "已关注"); - } - } - } - } - } - - if (cancelcrosscor&&!cancelclosed) { - Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV"); - if (child2.getChildCount() != 0) { - for (int w = 0; w < child2.getChildCount(); w++) { - AccessibilityNodeInfo childw = child2.getChild(w); - if (childw != null) { - if (childw.getText() != null) { - if (!childw.getText().toString().equals("互相关注")) { - continue; - } - } - - AblViewUtil.mySleep(1); - if (childw.getText() != null) { - if (childw.getText().toString().equals("互相关注")) { - clickcommontwo(childw, "互相关注"); - AblViewUtil.mySleep(2); - AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); - clickcommontwo(quxiao, "取消关注"); - - } - } - } - } - } - } - - 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); } } @@ -335,36 +103,53 @@ public class TestAblStep0 extends BaseAblStep { } /** - * 是否关注过 (判断的准确率在百分之90之上) + * 寻找控件 */ - public boolean ifGaunzhu() { - boolean flag = false; + public void getNodeInfoy() { AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); for (int i = 0; i < root.getChildCount(); i++) { AccessibilityNodeInfo child = root.getChild(i); - - if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { -// 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###", "----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); +// AccessibilityNodeInfo child2 = child1.getChild(child1.getChildCount()); +// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); + if (y == child.getChildCount() - 1) { + // Log.e("TIAOSHI###", "----threeNode:" + 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(); - child2.getBoundsInScreen(rect); - if (rect.left > 0 && rect.left <= 1080 && rect.top > 0 && rect.top <= 2210 && rect.bottom > 0 && rect.bottom <= 2210 && rect.right <= 1080) { - - Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); - nodeZuobiao(child2); - if ("android.widget.Button".equals(child2.getClassName())) { - if (child2.getContentDescription() != null) { - - if ("关注".equals(child2.getContentDescription().toString())) { - flag = true; + Log.e("TIAOSHI###", "----fourNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); + if ("android.widget.FrameLayout".equals(child2.getClassName())) { + if (j == 0) { + for (int x = 0; x < child2.getChildCount(); x++) { + AccessibilityNodeInfo child3 = child2.getChild(x); + Log.e("TIAOSHI###", "----fiveNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); + for (int h = 0; h < child3.getChildCount(); h++) { + AccessibilityNodeInfo child4 = child3.getChild(h); + Log.e("TIAOSHI###", "----sixNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); + int childCount = child4.getChildCount(); + Log.e("TIAOSHI###", "----sixNode数量:" + childCount); + nodeZuobiao(child4); + for (int m = 0; m < child4.getChildCount(); m++) { + AccessibilityNodeInfo child5 = child4.getChild(m); + Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription()); + nodeZuobiao(child5); + for (int p = 0; p < child5.getChildCount(); p++) { + if (p == 0) { + continue; + } + AccessibilityNodeInfo child6 = child5.getChild(p); + Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription()); + nodeZuobiao(child6); + if ("关注".equals(child6.getContentDescription())) { + clickcommontwo(child6, ""); + } + } + } } } } @@ -373,9 +158,10 @@ public class TestAblStep0 extends BaseAblStep { } } } - return flag; + } + } diff --git a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep32.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep32.java index 7818ec9..678062d 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep32.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep32.java @@ -1,5 +1,6 @@ package com.fisherbone.fuzhu.step; +import android.graphics.Rect; import android.os.Message; import android.util.Log; import android.view.accessibility.AccessibilityNodeInfo; @@ -31,12 +32,12 @@ public class TestAblStep32 extends NoticeBase { AblViewUtil.mySleep(5); AppoBean appoBean = ProfileSpUtils.getInstance().getAppoBean(); this.objects = appoBean.getData(); - Log.e("TIAOSHI###", "1234" ); + Log.e("TIAOSHI###", "1234"); AblStepHandler.sendMsg(AblSteps.STEP_232); break; case AblSteps.STEP_232: AblViewUtil.mySleep(3); - Log.e("TIAOSHI###", "56778" ); + Log.e("TIAOSHI###", "56778"); if (this.objects.size() == 0) { AblViewUtil.potgegin("停止"); return; @@ -94,74 +95,60 @@ public class TestAblStep32 extends NoticeBase { 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); -// AccessibilityNodeInfo child2 = child1.getChild(child1.getChildCount()); -// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); - if (y == child.getChildCount() - 1) { - // Log.e("TIAOSHI###", "----threeNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); - nodeZuobiao(child1); - for (int j = 0; j < child1.getChildCount(); j++) { - AccessibilityNodeInfo child2 = child1.getChild(j); - Log.e("TIAOSHI###", "----fourNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); - if ("android.widget.FrameLayout".equals(child2.getClassName())) { - if (j == 0) { - for (int x = 0; x < child2.getChildCount(); x++) { - AccessibilityNodeInfo child3 = child2.getChild(x); - Log.e("TIAOSHI###", "----fiveNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); - for (int h = 0; h < child3.getChildCount(); h++) { - AccessibilityNodeInfo child4 = child3.getChild(h); - Log.e("TIAOSHI###", "----sixNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); - int childCount = child4.getChildCount(); - Log.e("TIAOSHI###", "----sixNode数量:" + childCount); - nodeZuobiao(child4); - for (int m = 0; m < child4.getChildCount(); m++) { - AccessibilityNodeInfo child5 = child4.getChild(m); - Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription()); - nodeZuobiao(child5); - for (int p = 0; p < child5.getChildCount(); p++) { - if(p==0){ - continue; - } - AccessibilityNodeInfo child6 = child5.getChild(p); - Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription()); - nodeZuobiao(child6); - if("关注".equals(child6.getContentDescription())) { - clickcommontwo(child6, ""); +// 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 ("androidx.recyclerview.widget.RecyclerView".equals(child2.getClassName())) { + // if (j == child1.getChildCount() - 1) { + Rect rect = new Rect(); + child2.getBoundsInScreen(rect); + if (rect.right > 0) { +// 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.FrameLayout".equals(child3.getClassName())) { + if (x == 0) { + 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); + + + for (int m = 0; m < child4.getChildCount(); m++) { + AccessibilityNodeInfo child5 = child4.getChild(m); + + if ("com.lynx.tasm.behavior.ui.view.UIView".equals(child5.getClassName())) { + if ("关注".equals(child5.getContentDescription())) { + Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription()); + nodeZuobiao(child5); + clickcommontwo(child5, "关注"); + } + } } + } } } } + } } } } } } - - /** - * 获得顶部导航控件 - * - * @return - */ - public AccessibilityNodeInfo getdaohang() { - AccessibilityNodeInfo childw = null; - AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); - for (int i = 0; i < root.getChildCount(); i++) { - AccessibilityNodeInfo child = root.getChild(i); - if ("android.widget.HorizontalScrollView".equals(child.getClassName())) { - childw = child; - } - } - return childw; - } - } 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 4613e91..9c24ead 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep34.java @@ -1062,7 +1062,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red liwuBean.setLiwuTime(s0); String s1 = oneInfos.get(1).getText().toString(); liwuBean.setLiwuName(s1); - String s2 = oneInfos.get(2).getText().toString(); + // String s2 = oneInfos.get(2).getText().toString(); if(s1.equals("大啤酒")) { liwuBean.setLiwuDanjia("2"); }else if(s1.equals("小心心")){ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index b1018ac..a396faf 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -394,7 +394,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" + android:visibility="invisible" > + @@ -402,7 +410,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" + android:visibility="invisible" > + @@ -410,7 +425,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" + android:visibility="invisible" > +