Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李雅为
/
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
54d85d57
authored
Mar 02, 2018
by
jeffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交下 继续修改
parent
3ff28541
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
19 deletions
+105
-19
app/src/main/java/com/xf/weixinclick/LoginActivity.java
+7
-2
app/src/main/java/com/xf/weixinclick/MainActivity.java
+11
-0
app/src/main/java/com/xf/weixinclick/NewService.java
+46
-13
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
+1
-1
app/src/main/java/com/xf/weixinclick/receiver/MyMessageReceiver.java
+40
-3
No files found.
app/src/main/java/com/xf/weixinclick/LoginActivity.java
View file @
54d85d57
...
@@ -75,8 +75,13 @@ public class LoginActivity extends BaseActivity {
...
@@ -75,8 +75,13 @@ public class LoginActivity extends BaseActivity {
tvSure
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
tvSure
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
SP
.
setParam
(
"ip"
,
tvAddress
.
getText
().
toString
());
if
(
tvAddress
.
getText
().
toString
().
endsWith
(
"api/"
)){
Toast
.
makeText
(
LoginActivity
.
this
,
"设置成功,请重启"
,
1
).
show
();
SP
.
setParam
(
"ip"
,
tvAddress
.
getText
().
toString
());
Toast
.
makeText
(
LoginActivity
.
this
,
"设置成功,请重启"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
Toast
.
makeText
(
LoginActivity
.
this
,
"格式不正确 需要以api/结尾"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
});
});
}
}
...
...
app/src/main/java/com/xf/weixinclick/MainActivity.java
View file @
54d85d57
package
com
.
xf
.
weixinclick
;
package
com
.
xf
.
weixinclick
;
import
android.app.Notification
;
import
android.app.NotificationManager
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.support.v7.app.NotificationCompat
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.EditText
;
...
@@ -14,6 +18,9 @@ import com.xf.weixinclick.utils.SP;
...
@@ -14,6 +18,9 @@ import com.xf.weixinclick.utils.SP;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Locale
;
import
java.util.logging.Handler
;
import
java.util.logging.Handler
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -39,6 +46,10 @@ public class MainActivity extends BaseActivity {
...
@@ -39,6 +46,10 @@ public class MainActivity extends BaseActivity {
@Override
@Override
void
initAction
()
{
void
initAction
()
{
cet_bind_user
.
setText
(
SP
.
getParam
(
"divice"
,
""
).
toString
());
cet_bind_user
.
setText
(
SP
.
getParam
(
"divice"
,
""
).
toString
());
chat_view
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
chat_view
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
...
app/src/main/java/com/xf/weixinclick/NewService.java
View file @
54d85d57
...
@@ -122,7 +122,7 @@ public class NewService extends AccessibilityService {
...
@@ -122,7 +122,7 @@ public class NewService extends AccessibilityService {
break
;
break
;
case
WeChatAlert:
case
WeChatAlert:
if
(
WeChatStatus
.
status
[
2
])
{
if
(
WeChatStatus
.
status
[
2
])
{
delayDeal
(
4
000
,
new
IDelayMethord
()
{
delayDeal
(
5
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
pressImg
();
pressImg
();
...
@@ -152,13 +152,13 @@ public class NewService extends AccessibilityService {
...
@@ -152,13 +152,13 @@ public class NewService extends AccessibilityService {
@Subscribe
@Subscribe
public
void
receiverMsg
(
final
ReceiverMsg
msg
)
{
public
void
receiverMsg
(
final
ReceiverMsg
msg
)
{
Log
.
d
(
"fei "
,
"receiverMsg"
);
Log
.
d
(
"fei "
,
"receiverMsg"
);
delayDeal
(
5
00
,
new
IDelayMethord
()
{
delayDeal
(
1
00
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
execShellCmd
(
"input tap 150 200"
);
execShellCmd
(
"input tap 150 200"
);
}
}
});
});
delayDeal
(
2
000
,
new
IDelayMethord
()
{
delayDeal
(
3
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
WeChatStatus
.
receiverMsg
();
WeChatStatus
.
receiverMsg
();
...
@@ -219,6 +219,8 @@ public class NewService extends AccessibilityService {
...
@@ -219,6 +219,8 @@ public class NewService extends AccessibilityService {
Rect
rect
=
new
Rect
();
Rect
rect
=
new
Rect
();
temp
.
getBoundsInScreen
(
rect
);
temp
.
getBoundsInScreen
(
rect
);
final
float
x
=
rect
.
left
+
dip2px
(
5
),
y
=
rect
.
top
+
dip2px
(
5
);
final
float
x
=
rect
.
left
+
dip2px
(
5
),
y
=
rect
.
top
+
dip2px
(
5
);
Log
.
d
(
"fei "
,
String
.
format
(
"click %f %f "
,
x
,
y
));
execShellCmd
(
"input tap "
+
x
+
" "
+
y
);
execShellCmd
(
"input tap "
+
x
+
" "
+
y
);
}
}
}
}
...
@@ -246,30 +248,41 @@ public class NewService extends AccessibilityService {
...
@@ -246,30 +248,41 @@ public class NewService extends AccessibilityService {
}
}
if
(
findNode
==
null
){
if
(
findNode
==
null
){
execShellCmd
(
"input tap "
+
dip2px
(
40
)
+
" "
+
dip2px
(
315
));
Log
.
d
(
"fei "
,
String
.
format
(
"没有根据文字找到确认"
));
delayDeal
(
3000
,
new
IDelayMethord
()
{
delayDeal
(
4000
,
new
IDelayMethord
()
{
@Override
public
void
delayMethord
()
{
execShellCmd
(
"input tap "
+
dip2px
(
40
)
+
" "
+
dip2px
(
315
));
}
});
delayDeal
(
5000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
execShellCmd
(
"input tap "
+
dip2px
(
40
)
+
" "
+
dip2px
(
375
));
execShellCmd
(
"input tap "
+
dip2px
(
40
)
+
" "
+
dip2px
(
375
));
}
}
});
});
delayDeal
(
4
000
,
new
IDelayMethord
()
{
delayDeal
(
6
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
execShellCmd
(
"input tap "
+
dip2px
(
40
)
+
" "
+
dip2px
(
430
));
execShellCmd
(
"input tap "
+
dip2px
(
40
)
+
" "
+
dip2px
(
430
));
}
}
});
});
delayDeal
(
5
000
,
new
IDelayMethord
()
{
delayDeal
(
7
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
isPassTime
();
isPassTime
();
}
}
});
});
}
else
{
}
else
{
Log
.
d
(
"fei "
,
String
.
format
(
"根据文字找到确认了"
));
final
AccessibilityNodeInfo
finalFindNode
=
findNode
;
final
AccessibilityNodeInfo
finalFindNode
=
findNode
;
delayDeal
(
3
000
,
new
IDelayMethord
()
{
delayDeal
(
5
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
Rect
rect
=
new
Rect
();
Rect
rect
=
new
Rect
();
...
@@ -279,6 +292,14 @@ public class NewService extends AccessibilityService {
...
@@ -279,6 +292,14 @@ public class NewService extends AccessibilityService {
}
}
});
});
delayDeal
(
7000
,
new
IDelayMethord
()
{
@Override
public
void
delayMethord
()
{
isPassTime
();
}
});
}
}
}
}
...
@@ -384,17 +405,29 @@ public class NewService extends AccessibilityService {
...
@@ -384,17 +405,29 @@ public class NewService extends AccessibilityService {
if
(
rootNode
==
null
)
{
if
(
rootNode
==
null
)
{
return
;
return
;
}
}
// List<AccessibilityNodeInfo> ac
= rootNode.findAccessibilityNodeInfosByText(Url);
List
<
AccessibilityNodeInfo
>
ac2
=
rootNode
.
findAccessibilityNodeInfosByText
(
Url
);
// List<AccessibilityNodeInfo> ac = rootNode.findAccessibilityNodeInfosByViewId("@id/ji");
// List<AccessibilityNodeInfo> ac = rootNode.findAccessibilityNodeInfosByViewId("@id/ji");
List
<
AccessibilityNodeInfo
>
ac
=
rootNode
.
findAccessibilityNodeInfosByViewId
(
"com.tencent.mm:id/ji"
);
List
<
AccessibilityNodeInfo
>
ac
=
rootNode
.
findAccessibilityNodeInfosByViewId
(
"com.tencent.mm:id/ji"
);
AccessibilityNodeInfo
n
=
null
;
if
(
ac
.
size
()
>
0
){
n
=
ac
.
get
(
ac
.
size
()
-
1
);
}
if
(
ac2
.
size
()
>
0
){
n
=
ac2
.
get
(
ac2
.
size
()
-
1
);
}
if
(
ac
.
size
()
>
0
)
{
if
(
n
!=
null
)
{
final
AccessibilityNodeInfo
n
=
ac
.
get
(
ac
.
size
()
-
1
);
//
final AccessibilityNodeInfo n = ac.get(ac.size() - 1);
Rect
rect
=
new
Rect
();
Rect
rect
=
new
Rect
();
n
.
getBoundsInScreen
(
rect
);
n
.
getBoundsInScreen
(
rect
);
final
float
x
=
rect
.
left
+
tempX
,
y
=
rect
.
top
+
tempY
;
final
float
x
=
rect
.
left
+
dip2px
(
40
),
y
=
rect
.
top
+
dip2px
(
20
);
Log
.
d
(
"fei "
,
String
.
format
(
"click %f %f "
,
x
,
y
));
execShellCmd
(
"input tap "
+
x
+
" "
+
y
);
execShellCmd
(
"input tap "
+
x
+
" "
+
y
);
}
else
{
Log
.
d
(
"fei "
,
"找不到消息"
);
}
}
}
}
...
...
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
View file @
54d85d57
...
@@ -38,7 +38,7 @@ public class HttpClientApi {
...
@@ -38,7 +38,7 @@ public class HttpClientApi {
final
static
Scheduler
main
=
AndroidSchedulers
.
mainThread
();
final
static
Scheduler
main
=
AndroidSchedulers
.
mainThread
();
static
String
TEST_URL
=
"http://test.mp-watch.checheng.net/api/"
;
//"http://118.178.135.158:8080/api/";
static
String
TEST_URL
=
"http://test.mp-watch.checheng.net/api/"
;
//"http://118.178.135.158:8080/api/";
static
String
REAL_URL
=
"http://
test.
mp-watch.checheng.net/api/"
;
static
String
REAL_URL
=
"http://mp-watch.checheng.net/api/"
;
static
String
BASE_URL
;
static
String
BASE_URL
;
public
static
String
getUrl
()
{
public
static
String
getUrl
()
{
...
...
app/src/main/java/com/xf/weixinclick/receiver/MyMessageReceiver.java
View file @
54d85d57
package
com
.
xf
.
weixinclick
.
receiver
;
package
com
.
xf
.
weixinclick
.
receiver
;
import
android.app.Notification
;
import
android.app.NotificationManager
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.support.v7.app.NotificationCompat
;
import
android.util.Log
;
import
android.util.Log
;
import
com.alibaba.sdk.android.push.MessageReceiver
;
import
com.alibaba.sdk.android.push.MessageReceiver
;
import
com.alibaba.sdk.android.push.notification.CPushMessage
;
import
com.alibaba.sdk.android.push.notification.CPushMessage
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.xf.weixinclick.R
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.myApplication
;
import
com.xf.weixinclick.myApplication
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -33,7 +40,7 @@ public class MyMessageReceiver extends MessageReceiver {
...
@@ -33,7 +40,7 @@ public class MyMessageReceiver extends MessageReceiver {
}
}
@Override
@Override
public
void
onMessage
(
Context
context
,
CPushMessage
cPushMessage
)
{
public
void
onMessage
(
Context
context
,
final
CPushMessage
cPushMessage
)
{
Log
.
e
(
"MyMessageReceiver"
,
"onMessageaaa "
+
cPushMessage
.
getAppId
());
Log
.
e
(
"MyMessageReceiver"
,
"onMessageaaa "
+
cPushMessage
.
getAppId
());
Log
.
e
(
"MyMessageReceiver"
,
"onMessageaaa "
+
cPushMessage
.
getTraceInfo
().
toString
());
Log
.
e
(
"MyMessageReceiver"
,
"onMessageaaa "
+
cPushMessage
.
getTraceInfo
().
toString
());
Log
.
e
(
"MyMessageReceiver"
,
"onMessage, messageId: "
+
cPushMessage
.
getMessageId
()
Log
.
e
(
"MyMessageReceiver"
,
"onMessage, messageId: "
+
cPushMessage
.
getMessageId
()
...
@@ -46,8 +53,23 @@ public class MyMessageReceiver extends MessageReceiver {
...
@@ -46,8 +53,23 @@ public class MyMessageReceiver extends MessageReceiver {
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
setComponent
(
cmp
);
intent
.
setComponent
(
cmp
);
myApplication
.
getInstence
().
startActivity
(
intent
);
myApplication
.
getInstence
().
startActivity
(
intent
);
ReceiverMsg
msg
=
new
Gson
().
fromJson
(
cPushMessage
.
getContent
(),
ReceiverMsg
.
class
);
new
Thread
(
new
Runnable
()
{
EventBus
.
getDefault
().
post
(
msg
);
@Override
public
void
run
()
{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
ReceiverMsg
msg
=
new
Gson
().
fromJson
(
cPushMessage
.
getContent
(),
ReceiverMsg
.
class
);
EventBus
.
getDefault
().
post
(
msg
);
}
}).
start
();
showNotify
(
context
);
}
}
@Override
@Override
...
@@ -70,4 +92,19 @@ public class MyMessageReceiver extends MessageReceiver {
...
@@ -70,4 +92,19 @@ public class MyMessageReceiver extends MessageReceiver {
protected
void
onNotificationRemoved
(
Context
context
,
String
messageId
)
{
protected
void
onNotificationRemoved
(
Context
context
,
String
messageId
)
{
Log
.
e
(
"MyMessageReceiver"
,
"onNotificationRemoved"
);
Log
.
e
(
"MyMessageReceiver"
,
"onNotificationRemoved"
);
}
}
private
void
showNotify
(
Context
context
){
Calendar
calendar
=
Calendar
.
getInstance
();
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
,
Locale
.
getDefault
());
String
strTime
=
df
.
format
(
calendar
.
getTime
());
Notification
notification
=
new
NotificationCompat
.
Builder
(
context
)
.
setSmallIcon
(
R
.
mipmap
.
ic_launcher
)
.
setContentTitle
(
"微信click 有新消息"
)
.
setContentText
(
"时间 "
+
strTime
)
.
build
();
NotificationManager
notifyManager
=
(
NotificationManager
)
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
notifyManager
.
notify
(
1
,
notification
);
}
}
}
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