From 2da67c2878ff04b10de0499d8de1890bca1118da Mon Sep 17 00:00:00 2001 From: jianbo <263303411@qq.com> Date: Tue, 16 Nov 2021 11:22:26 +0800 Subject: [PATCH] atom --- .idea/gradle.xml | 3 +- .../fuzhu/activity/SettingActivity.java | 48 +-- .../fisherbone/fuzhu/step/TestAblStep0.java | 350 +----------------- .../fisherbone/fuzhu/step/TestAblStep1.java | 80 +++- app/src/main/res/layout/activity_setting.xml | 30 +- 5 files changed, 109 insertions(+), 402 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 22956b0..dbf0c76 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,7 +4,7 @@ diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/SettingActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/SettingActivity.java index 497a49e..c314f7e 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/activity/SettingActivity.java +++ b/app/src/main/java/com/fisherbone/fuzhu/activity/SettingActivity.java @@ -210,6 +210,15 @@ public class SettingActivity extends BaseActivity { } }); + binding.rlCeshi.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Gson gson = new Gson(); + ArrayList douyinBeans1 = douyinDao.queryAll(); + String s1 = gson.toJson(douyinBeans1); + Log.e("TIAOSHI###提交的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}] + } + }); } private void infoTv() { @@ -263,41 +272,6 @@ public class SettingActivity extends BaseActivity { public void click(View view) { switch (view.getId()) { case R.id.rl_env: - //设备是否注册 -// final HttpParams paramsPost = new HttpParams(); -// new NetApi().getPostData(paramsPost, HttpConstants.URi_device_Appoperate_checkDevice).subscribe(new com.fisherbone.fuzhu.okgonet.Observer() { -// @Override -// public void onNext(Response response) { -// String body = (String) response.body(); -// try { -// JSONObject jsonObject = new JSONObject(body); -// String msg = jsonObject.getString("msg"); -// String success = jsonObject.getString("success"); -// if (VALUE_ZERO.equals(success)) { -// com.fisherbone.fuzhu.utils.ToastUtils.showToast(SettingActivity.this, "已激活无需再次获取"); -// } else { -// ArrayList douyinBeans = douyinDao.queryAll(); -// douyinDao.delete(douyinBeans); -// if (AblUtil.isAccessibilityServiceOpen(SettingActivity.this)) { -// AblStepHandler.getInstance().setStop(false); -// AblStepHandler.sendMsg(AblSteps.STEP_50); -// } else { -// ToastUtils.showShort("请先开启辅助服务)))))))"); -// } -// } -// -// } catch (JSONException e) { -// e.printStackTrace(); -// } -// } -// -// @Override -// public void onError(Exception e) { -// e.printStackTrace(); -// } -// }); - - ArrayList douyinBeans = douyinDao.queryAll(); douyinDao.delete(douyinBeans); if (AblUtil.isAccessibilityServiceOpen(SettingActivity.this)) { @@ -308,7 +282,6 @@ public class SettingActivity extends BaseActivity { } break; - default: } } @@ -698,8 +671,7 @@ public class SettingActivity extends BaseActivity { private void zhuxiao(String device_id) { final HttpParams paramsPost = new HttpParams(); - // paramsPost.put("device_id", device_id);//扫码(设备)id - paramsPost.put("device_id", "13616318615152");//扫码(设备)id + paramsPost.put("device_id", device_id);//扫码(设备)id new NetApi().getPostData(paramsPost, HttpConstants.URi_Device_Appscanlogin_cancellationDevice).subscribe(new Observer() { @Override public void onNext(Response response) { 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 2778f42..b1036e7 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep0.java @@ -44,361 +44,37 @@ public class TestAblStep0 extends BaseAblStep { break; case AblSteps.STEP_2: AblViewUtil.mySleep(5); -// getNodeInfoh(); + // getNodeInfoh(); + int useerNum = getUseerNum(); + Log.e("TIAOSHI###", "用户数量"+useerNum); - //点开礼物 -// 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<>(); + public int getUseerNum() { + int userNum = 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()); + nodeZuobiao(child); 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); - } - } - } - } + Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); + nodeZuobiao(child1); + if("android.view.ViewGroup".equals(child1.getClassName())){ + userNum = ++userNum ; } } } - return liwus; - } - - /** - * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) - * 1.说点什么 - * 2.更多 - * 3.礼物 - */ - public void clickmoreli() { - 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()); - // nodeZuobiao(child1); - if ("android.widget.RelativeLayout".equals(child1.getClassName())) { - if (child1.getContentDescription() != null) { - if (child1.getContentDescription().equals("礼物")) { - AblService.getInstance().clickcommontwo(child1, ""); - } - } - } - - } - } - } - - public int dangqianDoubi() { - int doubinumr = 0; - String getdoubinum = getdoubinum(); - if (getdoubinum.equals("")) { - getdoubinum = "0"; - } - if ("充值".equals(getdoubinum)) { - doubinumr = 0; - } else { - doubinumr = Integer.valueOf(getdoubinum); - } - 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); - 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); - 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 = s; - } - } - } - } - } - } - } - return doubinum; - } - return "0"; + return userNum; } - /** - * 点击礼物下面的菜单 - * 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 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); -// -// 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); -// } -// } -// } -// } -// } -// } -// 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); - } - } - - - /** - * 获得背包中第一个位置的了礼物 - */ - 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/TestAblStep1.java b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep1.java index 4f72629..971e3c8 100644 --- a/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep1.java +++ b/app/src/main/java/com/fisherbone/fuzhu/step/TestAblStep1.java @@ -22,6 +22,7 @@ import java.util.List; public class TestAblStep1 extends BaseAblStep { private DouyinDao douyinDao; private AblService instance; + private int useerNum; @Override public void onStep(int step, Message msg) { @@ -32,7 +33,6 @@ public class TestAblStep1 extends BaseAblStep { AblViewUtil.mySleep(2); allowed(); douyinDao = new DouyinDao(FuzhuApplication.getContext()); - closedtjDialog(AblService.getInstance()); AblViewUtil.mySleep(1); //1.关闭检测到更新的弹框 @@ -43,8 +43,6 @@ public class TestAblStep1 extends BaseAblStep { AblViewUtil.mySleep(1); closedBDialog(AblService.getInstance()); AblViewUtil.mySleep(1); - - AblStepHandler.sendMsg(AblSteps.STEP_51); break; case AblSteps.STEP_51: @@ -62,9 +60,24 @@ public class TestAblStep1 extends BaseAblStep { break; case AblSteps.STEP_54: qiehuanz(instance); - //第二个帐号的点击 - instance.clickPoint(540, 616, 300); - AblStepHandler.sendMsg(AblSteps.STEP_55); + useerNum = getUseerNum(); + Log.e("TIAOSHI###", "用户数量"+ useerNum); + if(useerNum !=1) { + //第二个帐号的点击 + instance.clickPoint(540, 616, 300); + AblStepHandler.sendMsg(AblSteps.STEP_55); + }else { + AblViewUtil.mySleep(1); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + AblViewUtil.back(); + //让服务暂停 + AblStepHandler.getInstance().setStop(true); + } break; case AblSteps.STEP_55: clickmy(); @@ -81,10 +94,22 @@ public class TestAblStep1 extends BaseAblStep { break; case AblSteps.STEP_58: qiehuanz(instance); - //第三个帐号的点击 - instance.clickPoint(360, 858, 300); - AblStepHandler.sendMsg(AblSteps.STEP_59); - + if(useerNum ==3) { + //第三个帐号的点击 + instance.clickPoint(360, 858, 300); + AblStepHandler.sendMsg(AblSteps.STEP_59); + }else { + AblViewUtil.mySleep(1); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + AblViewUtil.back(); + AblViewUtil.mySleep(1); + AblViewUtil.back(); + //让服务暂停 + AblStepHandler.getInstance().setStop(true); + } break; case AblSteps.STEP_59: clickmy(); @@ -107,15 +132,12 @@ public class TestAblStep1 extends BaseAblStep { AblViewUtil.mySleep(2); //(945,126),(1033,214) - instance.clickPoint(989, 170, 300); Log.e("TIAOSHI###", "点击了更多按钮"); - AblViewUtil.mySleep(2); //(546,1764),(622,1816) instance.clickPoint(584, 1790, 300); Log.e("TIAOSHI###", "点击了设置按钮"); - //等待2秒向上滑动 AblViewUtil.mySleep(2); instance.randomSwipe(); @@ -125,18 +147,15 @@ public class TestAblStep1 extends BaseAblStep { if (zhaohao == null) { Log.e("TIAOSHI###", "没有找到切换帐号"); } else { - Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗"); clickNodeInfo(zhaohao, "切换帐号"); } AblViewUtil.mySleep(2); } private void getdouyinid() { - AblViewUtil.mySleep(2); //获取抖音号 getdouyin(); - DouyinBean douyinBean = new DouyinBean(); douyinBean.setLogin_status("1"); douyinBean.setShort_id(ChangLiang.short_id); @@ -146,7 +165,6 @@ public class TestAblStep1 extends BaseAblStep { } else { douyinDao.addInsert(douyinBean); } - AblViewUtil.mySleep(2); AblViewUtil.back(); AblViewUtil.mySleep(1); @@ -158,8 +176,8 @@ public class TestAblStep1 extends BaseAblStep { 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); Rect rect = new Rect(); child.getBoundsInScreen(rect); if (rect.top >= 564 && rect.bottom <= 761) { @@ -177,13 +195,35 @@ public class TestAblStep1 extends BaseAblStep { // Log.e("TIAOSHI###", "获得的抖音号==" + all[0]); Log.e("TIAOSHI###", "获得的抖音号==" + all[1]); ChangLiang.short_id = all[1]; - AccessibilityNodeInfo accessibilityNodeInfo = accessibilityNodeInfos.get(0); String s = accessibilityNodeInfo.getText().toString(); String s1 = EmojiFilter.filterEmoji(s);//去除字符串中包含的表情符号 Log.e("TIAOSHI###", "获得的抖音号昵称==" + s1); ChangLiang.short_name = s1; } + + + /** + * 获得当前登录的抖音账号个数 + */ + public int getUseerNum() { + int userNum = 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()); + 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); + if("android.view.ViewGroup".equals(child1.getClassName())){ + userNum = ++userNum ; + } + } + } + return userNum; + } } diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml index 84fc6b4..2c7c624 100644 --- a/app/src/main/res/layout/activity_setting.xml +++ b/app/src/main/res/layout/activity_setting.xml @@ -362,13 +362,31 @@ android:background="#F5F5F5" /> - + android:layout_height="60dp" + android:background="@color/white"> + + + + + + + +