Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhengli
/
wechat_click
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b4a6fdf9
authored
Mar 29, 2018
by
jeffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.3差不多了
parent
471e53ed
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
307 additions
and
15 deletions
+307
-15
app/src/main/AndroidManifest.xml
+2
-2
app/src/main/java/com/xf/weixinclick/MainActivity.java
+74
-0
app/src/main/java/com/xf/weixinclick/NewService.java
+28
-9
app/src/main/java/com/xf/weixinclick/bean/EnableResult.java
+154
-0
app/src/main/java/com/xf/weixinclick/http/ClientApi.java
+2
-0
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
+16
-0
app/src/main/res/layout/activity_main.xml
+31
-4
No files found.
app/src/main/AndroidManifest.xml
View file @
b4a6fdf9
...
...
@@ -43,7 +43,8 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".MainActivity"
/>
<activity
android:name=
".MainActivity"
android:windowSoftInputMode=
"adjustPan"
/>
<!-- 消息接收监听器 (用户可自主扩展) -->
<receiver
...
...
@@ -65,7 +66,6 @@
android:name=
".NewService"
android:enabled=
"true"
android:exported=
"true"
android:process=
":remote"
android:label=
"@string/app_name"
android:permission=
"android.permission.BIND_ACCESSIBILITY_SERVICE"
>
<intent-filter>
...
...
app/src/main/java/com/xf/weixinclick/MainActivity.java
View file @
b4a6fdf9
...
...
@@ -19,9 +19,14 @@ import android.view.View;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
com.alibaba.sdk.android.push.CloudPushService
;
import
com.alibaba.sdk.android.push.noonesdk.PushServiceFactory
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
com.xf.weixinclick.bean.DelayBean
;
import
com.xf.weixinclick.bean.EnableResult
;
import
com.xf.weixinclick.bean.LoginBean
;
import
com.xf.weixinclick.bean.ResponseBase
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.http.HttpClientApi
;
import
com.xf.weixinclick.http.HttpSubscriber
;
...
...
@@ -32,6 +37,7 @@ import com.xf.weixinclick.view.WaveView;
import
org.greenrobot.eventbus.EventBus
;
import
java.lang.reflect.Type
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Locale
;
...
...
@@ -59,6 +65,9 @@ public class MainActivity extends BaseActivity {
@BindView
(
R
.
id
.
tv_version_name
)
TextView
tv_version_name
;
@BindView
(
R
.
id
.
tv_enable_listener
)
TextView
tv_enable_listener
;
@BindView
(
R
.
id
.
waveView
)
WaveView
mWaveView
;
WaveHelper
mWaveHelper
;
...
...
@@ -163,6 +172,71 @@ public class MainActivity extends BaseActivity {
}
});
tv_enable_listener
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
// String device = (String) SP.getParam("divice", "");
// if (TextUtils.isEmpty(device)){
// NewService.showToast(MainActivity.this,"要先点击绑定设置id");
// return ;
// }
CloudPushService
pushService
=
PushServiceFactory
.
getCloudPushService
();
String
deviceId
=
pushService
.
getDeviceId
();
if
(
TextUtils
.
isEmpty
(
deviceId
)){
NewService
.
showToast
(
MainActivity
.
this
,
"推送注册失败 请重新打开App再试"
);
return
;
}
String
enable
=
(
String
)
SP
.
getParam
(
"enable"
,
"1"
);
int
enableCode
=
1
;
if
(
enable
.
equals
(
"1"
)){
enableCode
=
0
;
}
else
{
enableCode
=
1
;
}
showProgress
(
"请求中"
);
HttpClientApi
.
enableListener
(
deviceId
,
enableCode
,
new
HttpSubscriber
<
String
>()
{
@Override
public
void
onCompleted
()
{
dismissProgress
();
System
.
out
.
println
(
"res onCompleted"
);
}
@Override
public
void
onError
(
Throwable
e
)
{
super
.
onError
(
e
);
NewService
.
showToast
(
MainActivity
.
this
,
"请求失败 "
+
e
.
getMessage
());
}
@Override
public
void
onNext
(
String
responseBase
)
{
// SP.setParam("divice", d_name);
Log
.
d
(
"fei"
,
responseBase
);
Type
type
=
new
TypeToken
<
ResponseBase
<
EnableResult
>>(){}.
getType
();
ResponseBase
<
EnableResult
>
result
=
new
Gson
().
fromJson
(
responseBase
,
type
);
if
(
result
==
null
){
NewService
.
showToast
(
MainActivity
.
this
,
"失败:解析失败"
);
}
else
{
SP
.
setParam
(
"enable"
,
result
.
getData
().
getEnable
());
ensureListenerStatus
();
}
}
});
}
});
ensureListenerStatus
();
}
private
void
ensureListenerStatus
(){
String
enable
=
(
String
)
SP
.
getParam
(
"enable"
,
"1"
);
if
(
enable
.
equals
(
"1"
)){
tv_enable_listener
.
setText
(
"接收消息中\n 点击暂停"
);
}
else
{
tv_enable_listener
.
setText
(
"不收消息中\n 点击开启"
);
}
}
...
...
app/src/main/java/com/xf/weixinclick/NewService.java
View file @
b4a6fdf9
...
...
@@ -75,14 +75,14 @@ public class NewService extends AccessibilityService {
boolean
clickDone
=
false
;
long
lastShowToastTime
=
0
;
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
Log
.
d
(
"fei"
,
"onStartCommand start"
);
NotificationUtils
.
foreground
(
getApplicationContext
(),
this
);
//
NotificationUtils.foreground(getApplicationContext(),this);
//todo 当多任务过来的时候,没处理
if
(
intent
!=
null
&&
intent
.
getSerializableExtra
(
PARAMS_MSG
)
!=
null
){
...
...
@@ -94,6 +94,10 @@ public class NewService extends AccessibilityService {
step
=
0
;
awakeWechat
(
getApplicationContext
());
}
else
{
if
(
BuildConfig
.
DEBUG
){
showToast
(
getApplicationContext
(),
"后台服务启动了,但是没有具体消息内容"
);
}
}
//当service因为低内存被杀掉后,等内存足够时可以重启
...
...
@@ -146,6 +150,14 @@ public class NewService extends AccessibilityService {
@Override
public
void
onAccessibilityEvent
(
AccessibilityEvent
event
)
{
Log
.
d
(
"fei"
,
"NewService onAccessibilityEvent"
);
// if (BuildConfig.DEBUG){
if
(
System
.
currentTimeMillis
()
-
lastShowToastTime
>
10
*
1000
){
showToast
(
getApplicationContext
(),
"收到了无障碍的通知,无障碍服务正常"
);
lastShowToastTime
=
System
.
currentTimeMillis
();
}
// }
int
eventType
=
event
.
getEventType
();
String
className
=
event
.
getClassName
().
toString
();
Log
.
d
(
TAG
,
"get event = "
+
eventType
+
" class "
+
className
+
" step "
+
step
);
...
...
@@ -173,20 +185,27 @@ public class NewService extends AccessibilityService {
}
if
(
step
==
0
&&
findNodeByTexts
(
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
step
++;
//点击文件传输助手的位置
//最好还是找到文字然后点击位置
//没办法 首页打印出来的是通讯录的布局,所以坐标是错误的
delayDeal
(
delayBean
.
getAfter_open_weixin_index_delay
(),
new
IDelayMethord
()
{
@Override
public
void
delayMethord
()
{
execShellCmd
(
"input tap 220 200"
);
// clickHomeWJCSZS();
step
++;
}
});
if
(
step
==
1
){
printAllNode
();
}
// if (step == 1 ){
// printAllNode();
// }
// && findNodeByTexts(this,"文件传输助手")
if
(
step
==
1
){
if
(
step
==
2
){
step
++;
Log
.
d
(
TAG
,
"文件传输详情页面_填充_准备"
);
delayDeal
(
5000
,
new
IDelayMethord
()
{
...
...
@@ -228,7 +247,7 @@ public class NewService extends AccessibilityService {
// step++;
// }
if
(
step
==
3
&&
className
.
equals
(
WeChatWebView
)){
if
(
step
==
4
&&
className
.
equals
(
WeChatWebView
)){
step
++;
// 二维码长点击
delayDeal
(
delayBean
.
getAfter_click_message_delay
(),
new
IDelayMethord
()
{
...
...
@@ -240,7 +259,7 @@ public class NewService extends AccessibilityService {
});
}
if
(
step
==
5
&&
className
.
equals
(
WeChatAlert
)){
if
(
step
==
6
&&
className
.
equals
(
WeChatAlert
)){
Log
.
d
(
TAG
,
"开始点击确认二维码"
);
step
++;
delayDeal
(
delayBean
.
getLong_press_qrcode_delay
(),
new
IDelayMethord
()
{
...
...
@@ -252,7 +271,7 @@ public class NewService extends AccessibilityService {
});
}
if
(
step
==
7
&&
className
.
equals
(
WeChatWebView
)){
if
(
step
==
8
&&
className
.
equals
(
WeChatWebView
)){
step
++;
Log
.
d
(
TAG
,
"开始点击确认登录"
);
pressSure
();
...
...
app/src/main/java/com/xf/weixinclick/bean/EnableResult.java
0 → 100644
View file @
b4a6fdf9
package
com
.
xf
.
weixinclick
.
bean
;
/**
* 创建日期:2018/3/29 on 10:26
* 描述:
* 作者:Li
*/
public
class
EnableResult
{
/**
* id : 3
* name : a030
* code : a3eb1a52cdf6421fbd15ca8f647e70f4
* x : 0
* y : 0
* status : 1
* enable : 0
* battery : 100
* synced_at : 2018-03-29 10:22:42
* created_at : 2018-03-21 09:36:00
* updated_at : 2018-03-29 10:22:42
* deleted_at : null
* statusText : 正常
* batteryText : 100%
*/
private
int
id
;
private
String
name
;
private
String
code
;
private
int
x
;
private
int
y
;
private
int
status
;
private
String
enable
;
private
int
battery
;
private
String
synced_at
;
private
String
created_at
;
private
String
updated_at
;
private
Object
deleted_at
;
private
String
statusText
;
private
String
batteryText
;
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
int
getX
()
{
return
x
;
}
public
void
setX
(
int
x
)
{
this
.
x
=
x
;
}
public
int
getY
()
{
return
y
;
}
public
void
setY
(
int
y
)
{
this
.
y
=
y
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
String
getEnable
()
{
return
enable
;
}
public
void
setEnable
(
String
enable
)
{
this
.
enable
=
enable
;
}
public
int
getBattery
()
{
return
battery
;
}
public
void
setBattery
(
int
battery
)
{
this
.
battery
=
battery
;
}
public
String
getSynced_at
()
{
return
synced_at
;
}
public
void
setSynced_at
(
String
synced_at
)
{
this
.
synced_at
=
synced_at
;
}
public
String
getCreated_at
()
{
return
created_at
;
}
public
void
setCreated_at
(
String
created_at
)
{
this
.
created_at
=
created_at
;
}
public
String
getUpdated_at
()
{
return
updated_at
;
}
public
void
setUpdated_at
(
String
updated_at
)
{
this
.
updated_at
=
updated_at
;
}
public
Object
getDeleted_at
()
{
return
deleted_at
;
}
public
void
setDeleted_at
(
Object
deleted_at
)
{
this
.
deleted_at
=
deleted_at
;
}
public
String
getStatusText
()
{
return
statusText
;
}
public
void
setStatusText
(
String
statusText
)
{
this
.
statusText
=
statusText
;
}
public
String
getBatteryText
()
{
return
batteryText
;
}
public
void
setBatteryText
(
String
batteryText
)
{
this
.
batteryText
=
batteryText
;
}
}
app/src/main/java/com/xf/weixinclick/http/ClientApi.java
View file @
b4a6fdf9
...
...
@@ -19,4 +19,6 @@ public interface ClientApi{
Observable
<
String
>
devices
(
@Body
Map
<
String
,
String
>
params
);
@POST
(
"devices/scan"
)
Observable
<
String
>
devicesScan
(
@Body
Map
<
String
,
String
>
params
);
@POST
(
"devices/enable"
)
Observable
<
String
>
devicesEnable
(
@Body
Map
<
String
,
String
>
params
);
}
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
View file @
b4a6fdf9
...
...
@@ -158,6 +158,22 @@ public class HttpClientApi {
});
}
/**
*
* @param device_code
* @param isEnable 0表示关闭设备,不接收请求 1表示接收任务
* @param subscriber
*/
public
static
void
enableListener
(
String
device_code
,
int
isEnable
,
Subscriber
subscriber
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
device_code
);
map
.
put
(
"status"
,
isEnable
+
""
);
getInstance
().
devicesEnable
(
map
)
.
subscribeOn
(
io
)
.
observeOn
(
main
)
.
subscribe
(
subscriber
);
}
public
static
void
devicesScan
(
String
device_code
,
int
is_success
,
String
message_id
,
Subscriber
subscriber
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"device_code"
,
device_code
);
...
...
app/src/main/res/layout/activity_main.xml
View file @
b4a6fdf9
...
...
@@ -67,6 +67,13 @@
android:layout_marginLeft=
"15dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:layout_marginTop=
"15dp"
android:layout_marginLeft=
"15dp"
...
...
@@ -77,9 +84,9 @@
<TextView
android:id=
"@+id/chat_view"
android:text=
"开启监听
"
android:text=
"开启系统辅助
"
android:gravity=
"center"
android:textSize=
"14
sp"
android:textSize=
"11
sp"
android:textColor=
"#fd7f5f"
android:layout_centerInParent=
"true"
android:layout_width=
"wrap_content"
...
...
@@ -97,7 +104,7 @@
android:layout_height=
"100dp"
>
<TextView
android:id=
"@+id/chat_view_show"
android:text=
"设置事件
"
android:text=
"测试
"
android:gravity=
"center"
android:textSize=
"14sp"
android:textColor=
"#fd7f5f"
...
...
@@ -108,7 +115,24 @@
</RelativeLayout>
<RelativeLayout
android:layout_marginTop=
"15dp"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:background=
"@drawable/bg_work_action"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
>
<TextView
android:id=
"@+id/tv_enable_listener"
android:text=
"接收消息中\n 点击暂停"
android:gravity=
"center"
android:textSize=
"12sp"
android:textColor=
"#fd7f5f"
android:layout_centerInParent=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_btn_wok_action"
/>
</RelativeLayout>
<RelativeLayout
...
...
@@ -125,6 +149,9 @@
android:layout_height=
"wrap_content"
tools:text=
"版本号"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment