├── res
├── values
│ ├── styles.xml
│ ├── strings.xml
│ └── dimens.xml
├── drawable-hdpi
│ ├── bg.jpg
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── values-w820dp
│ └── dimens.xml
├── xml
│ └── qianghongbao_service_config.xml
└── layout
│ └── activity_main.xml
├── README.md
├── bin
├── classes.dex
├── resources.ap_
├── MainActivity.apk
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ └── crunch
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ │ └── drawable-xxhdpi
│ │ └── ic_launcher.png
├── classes
│ └── com
│ │ └── codeboy
│ │ └── qianghongbao
│ │ ├── R.class
│ │ ├── R$id.class
│ │ ├── R$attr.class
│ │ ├── R$xml.class
│ │ ├── R$dimen.class
│ │ ├── R$layout.class
│ │ ├── R$string.class
│ │ ├── BuildConfig.class
│ │ ├── R$drawable.class
│ │ ├── MainActivity$1.class
│ │ ├── MainActivity.class
│ │ └── QiangHongBaoService.class
└── AndroidManifest.xml
├── .settings
├── org.eclipse.jdt.core.prefs
└── org.eclipse.core.resources.prefs
├── gen
└── com
│ └── codeboy
│ └── qianghongbao
│ ├── BuildConfig.java
│ └── R.java
├── .classpath
├── project.properties
├── .project
├── src
└── com
│ └── codeboy
│ └── qianghongbao
│ ├── MainActivity.java
│ └── QiangHongBaoService.java
└── AndroidManifest.xml
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/README.md
--------------------------------------------------------------------------------
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes.dex
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/resources.ap_
--------------------------------------------------------------------------------
/bin/MainActivity.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/MainActivity.apk
--------------------------------------------------------------------------------
/res/drawable-hdpi/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/res/drawable-hdpi/bg.jpg
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R.class
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$id.class
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/crunch/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$attr.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$xml.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$xml.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$dimen.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$layout.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$string.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/BuildConfig.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/R$drawable.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/MainActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/MainActivity$1.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/MainActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/codeboy/qianghongbao/QiangHongBaoService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WooyunDota/QiangHongBao/HEAD/bin/classes/com/codeboy/qianghongbao/QiangHongBaoService.class
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 抢红包外挂
5 | 启动抢红包服务(使用QQ,微信)
6 |
7 |
--------------------------------------------------------------------------------
/gen/com/codeboy/qianghongbao/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.codeboy.qianghongbao;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/com/codeboy/qianghongbao/MainActivity.java=UTF-8
3 | encoding//src/com/codeboy/qianghongbao/QiangHongBaoService.java=UTF-8
4 | encoding/=UTF-8
5 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-20
15 |
--------------------------------------------------------------------------------
/res/xml/qianghongbao_service_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainActivity
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/com/codeboy/qianghongbao/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.codeboy.qianghongbao;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Toast;
8 |
9 | public class MainActivity extends Activity
10 | {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState)
14 | {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_main);
17 |
18 | findViewById(R.id.start_button).setOnClickListener(new View.OnClickListener()
19 | {
20 | @Override
21 | public void onClick(View v)
22 | {
23 | open();
24 | }
25 | });
26 | }
27 |
28 | private void open()
29 | {
30 | try
31 | {
32 | Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
33 | startActivity(intent);
34 | Toast.makeText(this, "找到“抢红包外挂”,然后开启服务即可", Toast.LENGTH_LONG).show();
35 | } catch (Exception e)
36 | {
37 | e.printStackTrace();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
17 |
18 |
25 |
26 |
34 |
35 |
--------------------------------------------------------------------------------
/gen/com/codeboy/qianghongbao/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.codeboy.qianghongbao;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class dimen {
14 | /** Default screen margins, per the Android Design guidelines.
15 | Example customization of dimensions originally defined in res/values/dimens.xml
16 | (such as screen margins) for screens with more than 820dp of available width. This
17 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
18 | */
19 | public static final int activity_horizontal_margin=0x7f050000;
20 | public static final int activity_vertical_margin=0x7f050001;
21 | }
22 | public static final class drawable {
23 | public static final int bg=0x7f020000;
24 | public static final int ic_launcher=0x7f020001;
25 | }
26 | public static final class id {
27 | public static final int start_button=0x7f070000;
28 | }
29 | public static final class layout {
30 | public static final int activity_main=0x7f030000;
31 | }
32 | public static final class string {
33 | public static final int accessibility_description=0x7f060001;
34 | public static final int app_name=0x7f060000;
35 | }
36 | public static final class xml {
37 | public static final int qianghongbao_service_config=0x7f040000;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
30 |
31 |
32 |
33 |
34 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
30 |
31 |
32 |
33 |
34 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/com/codeboy/qianghongbao/QiangHongBaoService.java:
--------------------------------------------------------------------------------
1 | package com.codeboy.qianghongbao;
2 |
3 | import java.util.List;
4 | import android.accessibilityservice.AccessibilityService;
5 | import android.annotation.SuppressLint;
6 | import android.annotation.TargetApi;
7 | import android.app.KeyguardManager;
8 | import android.app.Notification;
9 | import android.app.PendingIntent;
10 | import android.content.Context;
11 | import android.os.Build;
12 | import android.os.Handler;
13 | import android.os.PowerManager;
14 | import android.util.Log;
15 | import android.view.accessibility.AccessibilityEvent;
16 | import android.view.accessibility.AccessibilityNodeInfo;
17 | import android.widget.Toast;
18 |
19 | @SuppressLint("NewApi")
20 | public class QiangHongBaoService extends AccessibilityService
21 | {
22 |
23 | static final String TAG = "QiangHongBao";
24 |
25 | /** 微信的包名 */
26 | static final String WECHAT_PACKAGENAME = "com.tencent.mm";
27 | /** 红包消息的关键字 */
28 | static final String WX_HONGBAO_TEXT_KEY = "[微信红包]";
29 | static final String QQ_HONGBAO_TEXT_KEY = "[QQ红包]";
30 | private boolean caihongbao = false;
31 |
32 | Handler handler = new Handler();
33 |
34 | @Override
35 | public void onAccessibilityEvent(AccessibilityEvent event)
36 | {
37 | final int eventType = event.getEventType(); // ClassName:
38 | // com.tencent.mm.ui.LauncherUI
39 |
40 | // 通知栏事件
41 | if (eventType == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
42 | {
43 | List texts = event.getText();
44 | if (!texts.isEmpty())
45 | {
46 | for (CharSequence t : texts)
47 | {
48 | String text = String.valueOf(t);
49 | if (text.contains(WX_HONGBAO_TEXT_KEY) || text.contains(QQ_HONGBAO_TEXT_KEY))
50 | {
51 | openNotify(event);
52 | break;
53 | }
54 | }
55 | }
56 | } else if (eventType == AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE)
57 | {
58 | // 从微信主界面进入聊天界面
59 | openHongBao(event);
60 | } else if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
61 | {
62 | // 处理微信聊天界面
63 | openHongBao(event);
64 | }
65 | }
66 |
67 | @Override
68 | public void onInterrupt()
69 | {
70 | Toast.makeText(this, "中断抢红包服务", Toast.LENGTH_SHORT).show();
71 | }
72 |
73 | @Override
74 | protected void onServiceConnected()
75 | {
76 | super.onServiceConnected();
77 | Toast.makeText(this, "连接抢红包服务", Toast.LENGTH_SHORT).show();
78 | }
79 |
80 | /** 打开通知栏消息 */
81 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
82 | private void openNotify(AccessibilityEvent event)
83 | {
84 | if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification))
85 | {
86 | return;
87 | }
88 | // 将微信的通知栏消息打开
89 | Notification notification = (Notification) event.getParcelableData();
90 | PendingIntent pendingIntent = notification.contentIntent;
91 | try
92 | {
93 | pendingIntent.send();
94 | } catch (PendingIntent.CanceledException e)
95 | {
96 | e.printStackTrace();
97 | }
98 | }
99 |
100 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
101 | private void openHongBao(AccessibilityEvent event)
102 | {
103 | CharSequence className = event.getClassName();
104 |
105 | checkScreen(getApplicationContext());
106 |
107 | if ("com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyReceiveUI".equals(className))
108 | {
109 | // 点中了红包,下一步就是去拆红包
110 | checkKey1();
111 | } else if ("com.tencent.mm.ui.LauncherUI".equals(className) || "com.tencent.mobileqq.activity.ChatActivity".equals(className))
112 | {
113 | // 在聊天界面,去点中红包
114 | checkKey2();
115 | } else
116 | {
117 | // 在聊天界面,去点中红包
118 | checkKey2();
119 | }
120 | }
121 |
122 | /**
123 | *
124 | * @description: 检查屏幕是否亮着并且唤醒屏幕
125 | * @date: 2016-1-29 下午2:08:25
126 | * @author: yems
127 | */
128 | private void checkScreen(Context context)
129 | {
130 | // TODO Auto-generated method stub
131 | PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
132 | if (!pm.isScreenOn())
133 | {
134 | wakeUpAndUnlock(context);
135 | }
136 |
137 | }
138 |
139 | private void wakeUpAndUnlock(Context context)
140 | {
141 | KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
142 | KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");
143 | // 解锁
144 | kl.disableKeyguard();
145 | // 获取电源管理器对象
146 | PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
147 | // 获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是LogCat里用的Tag
148 | PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "bright");
149 | // 点亮屏幕
150 | wl.acquire();
151 | // 释放
152 | wl.release();
153 | }
154 |
155 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
156 | private void checkKey1()
157 | {
158 | AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
159 | if (nodeInfo == null)
160 | return;
161 |
162 | List list = nodeInfo.findAccessibilityNodeInfosByText("拆红包");
163 |
164 | if (list == null || list.size() == 0)
165 | {
166 | list = nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/b2c");
167 | }
168 |
169 | for (AccessibilityNodeInfo n : list)
170 | {
171 | n.performAction(AccessibilityNodeInfo.ACTION_CLICK);
172 | }
173 | }
174 |
175 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
176 | private void checkKey2()
177 | {
178 | AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
179 | if (nodeInfo == null)
180 | {
181 | Log.w(TAG, "rootWindow为空");
182 | return;
183 | }
184 | List wxList = nodeInfo.findAccessibilityNodeInfosByText("领取红包");
185 | List qqList = nodeInfo.findAccessibilityNodeInfosByText("QQ红包");
186 |
187 | if (!qqList.isEmpty())
188 | {
189 | qqList = nodeInfo.findAccessibilityNodeInfosByText("QQ红包");
190 | for (AccessibilityNodeInfo n : qqList)
191 | {
192 | n.performAction(AccessibilityNodeInfo.ACTION_CLICK);
193 | break;
194 | }
195 | }
196 |
197 | if (!wxList.isEmpty())
198 | {
199 | // 界面上的红包总个数
200 | int totalCount = wxList.size();
201 | // 领取最近发的红包
202 | for (int i = totalCount - 1; i >= 0; i--)
203 | {
204 | // 如果为领取过该红包,则执行点击、
205 | AccessibilityNodeInfo parent = wxList.get(i).getParent();
206 | if (parent != null)
207 | {
208 | parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
209 | break;
210 | }
211 | }
212 | } else if (!qqList.isEmpty())
213 | {
214 |
215 | // 界面上的红包总个数
216 | int totalCount = qqList.size();
217 | // 领取最近发的红包
218 | for (int i = totalCount - 1; i >= 0; i--)
219 | {
220 | // 如果为领取过该红包,则执行点击、
221 | AccessibilityNodeInfo parent = qqList.get(i).getParent();
222 | Log.i(TAG, "-->领取红包:" + parent);
223 | if (parent != null)
224 | {
225 | parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
226 | break;
227 | }
228 | }
229 |
230 | }
231 |
232 | }
233 |
234 | }
235 |
--------------------------------------------------------------------------------