Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
严琪
/
paysplug-in
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
e30b75bc
authored
Mar 07, 2018
by
jeffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
准备跑多金额任务
parent
5ea03f7d
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
206 additions
and
25 deletions
+206
-25
app/build.gradle
+3
-0
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
+11
-0
app/src/main/java/com/yuqirong/listenwechatnotification/MyApplication.java
+5
-1
app/src/main/java/com/yuqirong/listenwechatnotification/askhttp/ActivePullCashList.java
+37
-2
app/src/main/java/com/yuqirong/listenwechatnotification/bean/OneBatchResult.java
+27
-0
app/src/main/java/com/yuqirong/listenwechatnotification/function/AlipayFunction.java
+7
-0
app/src/main/java/com/yuqirong/listenwechatnotification/function/AlipaySimulation.java
+54
-7
app/src/main/java/com/yuqirong/listenwechatnotification/function/QRCodeFunction.java
+53
-13
app/src/main/java/com/yuqirong/listenwechatnotification/service/MyAccessibilityService.java
+7
-2
build.gradle
+2
-0
No files found.
app/build.gradle
View file @
e30b75bc
...
@@ -50,4 +50,7 @@ dependencies {
...
@@ -50,4 +50,7 @@ dependencies {
compile
'com.google.zxing:core:3.2.1'
compile
'com.google.zxing:core:3.2.1'
compile
'org.greenrobot:eventbus:3.0.0'
compile
'org.greenrobot:eventbus:3.0.0'
compile
"io.reactivex.rxjava2:rxjava:2.1.10"
compile
'io.reactivex.rxjava2:rxandroid:2.0.2'
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
View file @
e30b75bc
...
@@ -18,6 +18,7 @@ import android.widget.EditText;
...
@@ -18,6 +18,7 @@ import android.widget.EditText;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.yuqirong.listenwechatnotification.askhttp.ActivePullCashList
;
import
com.yuqirong.listenwechatnotification.askhttp.UpdateApk
;
import
com.yuqirong.listenwechatnotification.askhttp.UpdateApk
;
import
com.yuqirong.listenwechatnotification.bean.ImageBean
;
import
com.yuqirong.listenwechatnotification.bean.ImageBean
;
import
com.yuqirong.listenwechatnotification.broadcastReceiver.MyCashReceiver
;
import
com.yuqirong.listenwechatnotification.broadcastReceiver.MyCashReceiver
;
...
@@ -28,6 +29,8 @@ import com.yuqirong.listenwechatnotification.uitl.Utils;
...
@@ -28,6 +29,8 @@ import com.yuqirong.listenwechatnotification.uitl.Utils;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.util.ArrayList
;
public
class
MainActivity
extends
ParentActivity
{
public
class
MainActivity
extends
ParentActivity
{
...
@@ -118,6 +121,14 @@ public class MainActivity extends ParentActivity {
...
@@ -118,6 +121,14 @@ public class MainActivity extends ParentActivity {
my
=
new
MyCashReceiver
();
my
=
new
MyCashReceiver
();
registerReceiver
(
my
,
filter
);
registerReceiver
(
my
,
filter
);
// timingRequest();
// timingRequest();
// ArrayList<String> result = ActivePullCashList.generateMoneys();
// StringBuilder sb = new StringBuilder();
// for (String one : result){
// sb.append(one);
// sb.append(",");
// }
// Log.d(TAG,"money=" + sb.toString());
}
}
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/MyApplication.java
View file @
e30b75bc
...
@@ -10,10 +10,14 @@ import com.yuqirong.listenwechatnotification.uitl.Utils;
...
@@ -10,10 +10,14 @@ import com.yuqirong.listenwechatnotification.uitl.Utils;
*/
*/
public
class
MyApplication
extends
Application
{
public
class
MyApplication
extends
Application
{
private
static
MyApplication
app
;
public
static
MyApplication
get
(){
return
app
;
}
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
app
=
this
;
//默认先获取支付宝的数据
//默认先获取支付宝的数据
PayTypeSingleTon
.
newInstance
().
setPayType
(
Utils
.
payTypeZFB
);
PayTypeSingleTon
.
newInstance
().
setPayType
(
Utils
.
payTypeZFB
);
}
}
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/askhttp/ActivePullCashList.java
View file @
e30b75bc
...
@@ -8,6 +8,7 @@ import com.yuqirong.listenwechatnotification.uitl.Utils;
...
@@ -8,6 +8,7 @@ import com.yuqirong.listenwechatnotification.uitl.Utils;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
retrofit2.Call
;
import
retrofit2.Call
;
...
@@ -37,12 +38,46 @@ public class ActivePullCashList implements HttpPresent {
...
@@ -37,12 +38,46 @@ public class ActivePullCashList implements HttpPresent {
public
void
testPullList
(){
public
void
testPullList
(){
ArrayList
<
String
>
moneylist
=
new
ArrayList
<>();
ArrayList
<
String
>
moneylist
=
new
ArrayList
<>();
moneylist
.
add
(
"11.01"
);
// moneylist.add("11.01");
// moneylist.add("1.01");
// moneylist.add("111.01");
double
[]
result
=
generateMoneys
();
for
(
double
i
:
result
){
moneylist
.
add
(
String
.
valueOf
(
i
));
}
EventBus
.
getDefault
().
post
(
moneylist
);
EventBus
.
getDefault
().
post
(
moneylist
);
}
}
public
static
double
[]
generateMoneys
(){
// int[] baseMoney = {10,20,50,100,200,300,400,500,600,700,800,900,1000,1500,2000,2500,3000};
// ArrayList<String> result = new ArrayList<>();
// for (int oneMoney : baseMoney){
// //小于100 分,每个差价
// float step = 0.01f;
// float stepSize = 0.05f;
// int allStep = 10;
//
// //大于100分
// if (oneMoney >= 100){
// step = 0.01f;
// stepSize = 0.1f;
// allStep = 20;
// }
// BigDecimal bdStepSize = BigDecimal.valueOf(stepSize);
// for (int i = 0 ; i <=allStep;i++){
// BigDecimal bigDecimal = BigDecimal.valueOf(i*step);
//// float floatResult = oneMoney-stepSize+i*step;
// String strResult = BigDecimal.valueOf(oneMoney).subtract(bdStepSize).add(bigDecimal).setScale(2,BigDecimal.ROUND_DOWN).toString();
// result.add(strResult);
// }
// }
double
[]
result
=
{
9.95
,
9.96
,
9.97
,
9.98
,
9.99
,
10
,
10.01
,
10.02
,
10.03
,
10.04
,
10.05
,
19.95
,
19.96
,
19.97
,
19.98
,
19.99
,
20
,
20.01
,
20.02
,
20.03
,
20.04
,
20.05
,
49.95
,
49.96
,
49.97
,
49.98
,
49.99
,
50
,
50.01
,
50.02
,
50.03
,
50.04
,
50.05
,
99.9
,
99.91
,
99.92
,
99.93
,
99.94
,
99.95
,
99.96
,
99.97
,
99.98
,
99.99
,
100
,
100.01
,
100.02
,
100.03
,
100.04
,
100.05
,
100.06
,
100.07
,
100.08
,
100.09
,
100.1
,
199.9
,
199.91
,
199.92
,
199.93
,
199.94
,
199.95
,
199.96
,
199.97
,
199.98
,
199.99
,
200
,
200.01
,
200.02
,
200.03
,
200.04
,
200.05
,
200.06
,
200.07
,
200.08
,
200.09
,
200.1
,
299.9
,
299.91
,
299.92
,
299.93
,
299.94
,
299.95
,
299.96
,
299.97
,
299.98
,
299.99
,
300
,
300.01
,
300.02
,
300.03
,
300.04
,
300.05
,
300.06
,
300.07
,
300.08
,
300.09
,
300.1
,
399.9
,
399.91
,
399.92
,
399.93
,
399.94
,
399.95
,
399.96
,
399.97
,
399.98
,
399.99
,
400
,
400.01
,
400.02
,
400.03
,
400.04
,
400.05
,
400.06
,
400.07
,
400.08
,
400.09
,
400.1
,
499.9
,
499.91
,
499.92
,
499.93
,
499.94
,
499.95
,
499.96
,
499.97
,
499.98
,
499.99
,
500
,
500.01
,
500.02
,
500.03
,
500.04
,
500.05
,
500.06
,
500.07
,
500.08
,
500.09
,
500.1
,
599.9
,
599.91
,
599.92
,
599.93
,
599.94
,
599.95
,
599.96
,
599.97
,
599.98
,
599.99
,
600
,
600.01
,
600.02
,
600.03
,
600.04
,
600.05
,
600.06
,
600.07
,
600.08
,
600.09
,
600.1
,
699.9
,
699.91
,
699.92
,
699.93
,
699.94
,
699.95
,
699.96
,
699.97
,
699.98
,
699.99
,
700
,
700.01
,
700.02
,
700.03
,
700.04
,
700.05
,
700.06
,
700.07
,
700.08
,
700.09
,
700.1
,
799.9
,
799.91
,
799.92
,
799.93
,
799.94
,
799.95
,
799.96
,
799.97
,
799.98
,
799.99
,
800
,
800.01
,
800.02
,
800.03
,
800.04
,
800.05
,
800.06
,
800.07
,
800.08
,
800.09
,
800.1
,
899.9
,
899.91
,
899.92
,
899.93
,
899.94
,
899.95
,
899.96
,
899.97
,
899.98
,
899.99
,
900
,
900.01
,
900.02
,
900.03
,
900.04
,
900.05
,
900.06
,
900.07
,
900.08
,
900.09
,
900.1
,
999.9
,
999.91
,
999.92
,
999.93
,
999.94
,
999.95
,
999.96
,
999.97
,
999.98
,
999.99
,
1000
,
1000.01
,
1000.02
,
1000.03
,
1000.04
,
1000.05
,
1000.06
,
1000.07
,
1000.08
,
1000.09
,
1000.1
,
1499.9
,
1499.91
,
1499.92
,
1499.93
,
1499.94
,
1499.95
,
1499.96
,
1499.97
,
1499.98
,
1499.99
,
1500
,
1500.01
,
1500.02
,
1500.03
,
1500.04
,
1500.05
,
1500.06
,
1500.07
,
1500.08
,
1500.09
,
1500.1
,
1999.9
,
1999.91
,
1999.92
,
1999.93
,
1999.94
,
1999.95
,
1999.96
,
1999.97
,
1999.98
,
1999.99
,
2000
,
2000.01
,
2000.02
,
2000.03
,
2000.04
,
2000.05
,
2000.06
,
2000.07
,
2000.08
,
2000.09
,
2000.1
,
2499.9
,
2499.91
,
2499.92
,
2499.93
,
2499.94
,
2499.95
,
2499.96
,
2499.97
,
2499.98
,
2499.99
,
2500
,
2500.01
,
2500.02
,
2500.03
,
2500.04
,
2500.05
,
2500.06
,
2500.07
,
2500.08
,
2500.09
,
2500.1
,
2999.9
,
2999.91
,
2999.92
,
2999.93
,
2999.94
,
2999.95
,
2999.96
,
2999.97
,
2999.98
,
2999.99
,
3000
,
3000.01
,
3000.02
,
3000.03
,
3000.04
,
3000.05
,
3000.06
,
3000.07
,
3000.08
,
3000.09
,
3000.1
};
return
result
;
}
public
void
pullList
(
String
channel
,
String
username
){
public
void
pullList
(
String
channel
,
String
username
){
Retrofit
retrofit
=
new
Retrofit
.
Builder
().
baseUrl
(
HttpService
.
base_url
)
Retrofit
retrofit
=
new
Retrofit
.
Builder
().
baseUrl
(
HttpService
.
base_url
)
//添加返回字符串的支持--不知道返回的是什么,添加字符串支持
//添加返回字符串的支持--不知道返回的是什么,添加字符串支持
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/bean/OneBatchResult.java
0 → 100644
View file @
e30b75bc
package
com
.
yuqirong
.
listenwechatnotification
.
bean
;
import
java.util.ArrayList
;
/**
* 创建日期:2018/3/7 on 16:08
* 描述:
* 作者:Li
*/
public
class
OneBatchResult
{
private
ArrayList
<
ImageBean
>
list
;
public
OneBatchResult
(
ArrayList
<
ImageBean
>
list
)
{
this
.
list
=
list
;
}
public
ArrayList
<
ImageBean
>
getList
()
{
return
list
;
}
public
void
setList
(
ArrayList
<
ImageBean
>
list
)
{
this
.
list
=
list
;
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/function/AlipayFunction.java
View file @
e30b75bc
...
@@ -136,6 +136,11 @@ public class AlipayFunction {
...
@@ -136,6 +136,11 @@ public class AlipayFunction {
* 点击保存图片按钮
* 点击保存图片按钮
*/
*/
public
void
functionSavePicButton
(
List
<
AccessibilityNodeInfo
>
infos
){
public
void
functionSavePicButton
(
List
<
AccessibilityNodeInfo
>
infos
){
if
(
infos
==
null
||
infos
.
size
()
==
0
){
execShellCmd
(
"input tap "
+
462
+
" "
+
816
);
Log
.
d
(
TAG
,
"fei 没有找到节点 functionStartClick: "
+
SixthStep
);
zhiFuBaoStatus
.
setSixthStepStatus
(
true
);
}
else
{
for
(
int
i
=
0
;
i
<
infos
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
infos
.
size
();
i
++)
{
AccessibilityNodeInfo
node
=
infos
.
get
(
0
);
AccessibilityNodeInfo
node
=
infos
.
get
(
0
);
node
.
performAction
(
AccessibilityNodeInfo
.
ACTION_CLICK
);
node
.
performAction
(
AccessibilityNodeInfo
.
ACTION_CLICK
);
...
@@ -144,6 +149,8 @@ public class AlipayFunction {
...
@@ -144,6 +149,8 @@ public class AlipayFunction {
}
}
}
}
}
public
void
reNameImageFile
(
String
filename
){
public
void
reNameImageFile
(
String
filename
){
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
()))
{
.
getExternalStorageState
()))
{
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/function/AlipaySimulation.java
View file @
e30b75bc
...
@@ -7,6 +7,12 @@ import android.view.accessibility.AccessibilityNodeInfo;
...
@@ -7,6 +7,12 @@ import android.view.accessibility.AccessibilityNodeInfo;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.functions.Consumer
;
import
io.reactivex.functions.Function
;
/**
/**
* Created by yanqi on 2018/3/5 0005.
* Created by yanqi on 2018/3/5 0005.
...
@@ -50,27 +56,37 @@ public abstract class AlipaySimulation {
...
@@ -50,27 +56,37 @@ public abstract class AlipaySimulation {
* @param rootInActiveWindow 根树界面
* @param rootInActiveWindow 根树界面
* @param eventType 点击类型
* @param eventType 点击类型
*/
*/
public
void
aliPaySteps
(
String
className
,
int
indexCount
,
AccessibilityEvent
event
,
AccessibilityNodeInfo
rootInActiveWindow
,
int
eventType
){
public
boolean
aliPaySteps
(
String
className
,
int
indexCount
,
AccessibilityEvent
event
,
final
AccessibilityNodeInfo
rootInActiveWindow
,
int
eventType
){
if
(
className
.
equals
(
fristClassName
)
&&
eventType
==
AccessibilityNodeInfo
.
ACTION_LONG_CLICK
&&
!
function
.
getZhiFuBaoStatus
().
isFirstStepStatus
())
{
if
(
className
.
equals
(
fristClassName
)
&&
eventType
==
AccessibilityNodeInfo
.
ACTION_LONG_CLICK
&&
!
function
.
getZhiFuBaoStatus
().
isFirstStepStatus
())
{
List
<
AccessibilityNodeInfo
>
nodes
=
rootInActiveWindow
.
findAccessibilityNodeInfosByText
(
AlipayFunction
.
FristStep
);
Log
.
d
(
TAG
,
"fei 第一步"
);
final
List
<
AccessibilityNodeInfo
>
nodes
=
rootInActiveWindow
.
findAccessibilityNodeInfosByText
(
AlipayFunction
.
FristStep
);
delayDeal
(
2000
,
new
IDelayMethod
()
{
@Override
public
void
delayMethod
()
{
function
.
functionStartClick
(
nodes
);
function
.
functionStartClick
(
nodes
);
}
}
});
}
else
if
(
className
.
equals
(
secondClassName
)
&&
function
.
getZhiFuBaoStatus
().
isFirstStepStatus
()){
else
if
(
className
.
equals
(
secondClassName
)
&&
function
.
getZhiFuBaoStatus
().
isFirstStepStatus
()
&&
!
function
.
getZhiFuBaoStatus
().
isSecondStepStatus
()){
Log
.
d
(
TAG
,
"fei 第二步"
);
function
.
functionMoneyClick
();
function
.
functionMoneyClick
();
}
}
else
if
(
className
.
equals
(
thirdClassName
)){
else
if
(
className
.
equals
(
thirdClassName
)&&!
function
.
getZhiFuBaoStatus
().
isThirdStepStatus
()){
Log
.
d
(
TAG
,
"fei 第三步"
);
List
<
AccessibilityNodeInfo
>
nodes
=
rootInActiveWindow
.
findAccessibilityNodeInfosByText
(
AlipayFunction
.
ThirdStep
);
List
<
AccessibilityNodeInfo
>
nodes
=
rootInActiveWindow
.
findAccessibilityNodeInfosByText
(
AlipayFunction
.
ThirdStep
);
function
.
functionSetMoneyText
(
nodes
);
function
.
functionSetMoneyText
(
nodes
);
}
}
//这边多加一个判断,防止任务结束之后出现问题,第四步一定在第三步成功前提下运行
//这边多加一个判断,防止任务结束之后出现问题,第四步一定在第三步成功前提下运行
else
if
(
className
.
equals
(
fourthClassName
)
&&
function
.
getZhiFuBaoStatus
().
isThirdStepStatus
()){
else
if
(
className
.
equals
(
fourthClassName
)
&&
function
.
getZhiFuBaoStatus
().
isThirdStepStatus
()&&!
function
.
getZhiFuBaoStatus
().
isFourthStepStatus
()){
Log
.
d
(
TAG
,
"fei 第四步"
);
function
.
functionSetMoneyInputView
();
function
.
functionSetMoneyInputView
();
}
}
else
if
(
className
.
equals
(
fourthDesClassName
)&&
eventType
==
AccessibilityNodeInfo
.
ACTION_FOCUS
&&
!
function
.
getZhiFuBaoStatus
().
isFifthtepStatus
()){
else
if
(
className
.
equals
(
fourthDesClassName
)&&
eventType
==
AccessibilityNodeInfo
.
ACTION_FOCUS
&&
!
function
.
getZhiFuBaoStatus
().
isFifthtepStatus
()){
Log
.
d
(
TAG
,
"fei 第五步"
);
AccessibilityNodeInfo
nodes
=
event
.
getSource
();
AccessibilityNodeInfo
nodes
=
event
.
getSource
();
Log
.
d
(
TAG
,
"onAccessibilityEvent: "
+
indexCount
);
Log
.
d
(
TAG
,
"onAccessibilityEvent: "
+
indexCount
);
function
.
functionSetMoneyValue
(
nodes
,
mContext
,
moneylist
.
get
(
indexCount
));
function
.
functionSetMoneyValue
(
nodes
,
mContext
,
moneylist
.
get
(
indexCount
));
...
@@ -79,18 +95,49 @@ public abstract class AlipaySimulation {
...
@@ -79,18 +95,49 @@ public abstract class AlipaySimulation {
function
.
functionMoneyClickButton
(
nodess
);
function
.
functionMoneyClickButton
(
nodess
);
}
}
else
if
(
className
.
equals
(
fifthClassName
)){
else
if
(
className
.
equals
(
fifthClassName
)&&!
function
.
getZhiFuBaoStatus
().
isSixthStepStatus
()){
List
<
AccessibilityNodeInfo
>
nodes
=
rootInActiveWindow
.
findAccessibilityNodeInfosByText
(
AlipayFunction
.
SixthStep
);;
Log
.
d
(
TAG
,
"fei 第六步 进入"
);
delayDeal
(
2000
,
new
IDelayMethod
()
{
@Override
public
void
delayMethod
()
{
List
<
AccessibilityNodeInfo
>
nodes
=
null
;
if
(
rootInActiveWindow
!=
null
){
nodes
=
rootInActiveWindow
.
findAccessibilityNodeInfosByText
(
AlipayFunction
.
SixthStep
);
}
Log
.
d
(
TAG
,
"fei 第六步 nodes size ="
+
(
nodes
==
null
?
0
:
nodes
.
size
()));
function
.
functionSavePicButton
(
nodes
);
function
.
functionSavePicButton
(
nodes
);
}
}
});
}
else
if
(
className
.
equals
(
sixthClassName
)&&
eventType
==
AccessibilityNodeInfo
.
ACTION_FOCUS
&&
function
.
getZhiFuBaoStatus
().
isSixthStepStatus
()){
else
if
(
className
.
equals
(
sixthClassName
)&&
eventType
==
AccessibilityNodeInfo
.
ACTION_FOCUS
&&
function
.
getZhiFuBaoStatus
().
isSixthStepStatus
()){
Log
.
d
(
TAG
,
"fei 第7步"
);
function
.
reNameImageFile
(
moneylist
.
get
(
indexCount
)+
""
);
function
.
reNameImageFile
(
moneylist
.
get
(
indexCount
)+
""
);
indexCount
++;
indexCount
++;
jump2Menu
(
function
);
jump2Menu
(
function
);
return
true
;
}
}
return
false
;
}
}
public
abstract
void
jump2Menu
(
AlipayFunction
function
);
public
abstract
void
jump2Menu
(
AlipayFunction
function
);
interface
IDelayMethod
{
void
delayMethod
();
}
private
void
delayDeal
(
long
time
,
final
IDelayMethod
iDelayMethord
)
{
Observable
.
timer
(
time
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
new
Consumer
<
Object
>()
{
@Override
public
void
accept
(
Object
o
)
throws
Exception
{
iDelayMethord
.
delayMethod
();
}
});
}
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/function/QRCodeFunction.java
View file @
e30b75bc
package
com
.
yuqirong
.
listenwechatnotification
.
function
;
package
com
.
yuqirong
.
listenwechatnotification
.
function
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory
;
import
android.media.MediaScannerConnection
;
import
android.media.MediaScannerConnection
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.nfc.Tag
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.util.Log
;
import
android.util.Log
;
import
com.google.gson.Gson
;
import
com.google.zxing.Binarizer
;
import
com.google.zxing.Binarizer
;
import
com.google.zxing.BinaryBitmap
;
import
com.google.zxing.BinaryBitmap
;
import
com.google.zxing.ChecksumException
;
import
com.google.zxing.ChecksumException
;
...
@@ -19,9 +23,14 @@ import com.google.zxing.RGBLuminanceSource;
...
@@ -19,9 +23,14 @@ import com.google.zxing.RGBLuminanceSource;
import
com.google.zxing.Result
;
import
com.google.zxing.Result
;
import
com.google.zxing.common.HybridBinarizer
;
import
com.google.zxing.common.HybridBinarizer
;
import
com.google.zxing.qrcode.QRCodeReader
;
import
com.google.zxing.qrcode.QRCodeReader
;
import
com.yuqirong.listenwechatnotification.MyApplication
;
import
com.yuqirong.listenwechatnotification.askhttp.ActivePullCashList
;
import
com.yuqirong.listenwechatnotification.askhttp.ActivePullCashList
;
import
com.yuqirong.listenwechatnotification.askhttp.ActivePushCashList
;
import
com.yuqirong.listenwechatnotification.askhttp.ActivePushCashList
;
import
com.yuqirong.listenwechatnotification.bean.ImageBean
;
import
com.yuqirong.listenwechatnotification.bean.ImageBean
;
import
com.yuqirong.listenwechatnotification.bean.OneBatchResult
;
import
com.yuqirong.listenwechatnotification.uitl.FileUtils
;
import
com.yuqirong.listenwechatnotification.uitl.PayTypeSingleTon
;
import
com.yuqirong.listenwechatnotification.uitl.Utils
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
...
@@ -29,6 +38,7 @@ import org.greenrobot.eventbus.Subscribe;
...
@@ -29,6 +38,7 @@ import org.greenrobot.eventbus.Subscribe;
import
org.greenrobot.eventbus.ThreadMode
;
import
org.greenrobot.eventbus.ThreadMode
;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -54,13 +64,33 @@ public class QRCodeFunction extends Thread{
...
@@ -54,13 +64,33 @@ public class QRCodeFunction extends Thread{
public
void
run
()
{
public
void
run
()
{
super
.
run
();
super
.
run
();
functionUrls
=
new
BuildUrlsFunction
();
functionUrls
=
new
BuildUrlsFunction
();
functionFoundImageFile
(
this
.
filePath
);
ArrayList
<
ImageBean
>
imageInfos
=
functionFoundImageFile
(
this
.
filePath
);
OneBatchResult
result
=
new
OneBatchResult
(
imageInfos
);
String
stringResult
=
new
Gson
().
toJson
(
result
);
SharedPreferences
sp
=
MyApplication
.
get
().
getSharedPreferences
(
"result"
,
Context
.
MODE_PRIVATE
);
sp
.
edit
().
putString
(
"result"
,
stringResult
).
apply
();
Log
.
d
(
TAG
,
"fei result start-----------------------------"
);
Log
.
d
(
TAG
,
stringResult
);
Log
.
d
(
TAG
,
"fei result end-----------------------------"
);
//数据发送成功的话,这边修改下次请求参数类型
//还需要删除当前类型文件夹下所有图片
if
(
PayTypeSingleTon
.
newInstance
().
getPayType
().
equals
(
Utils
.
payTypeZFB
)){
PayTypeSingleTon
.
newInstance
().
setPayType
(
Utils
.
payTypeWeiXin
);
FileUtils
.
deleteFiles
(
Utils
.
ZFBImgPath
);
}
else
{
PayTypeSingleTon
.
newInstance
().
setPayType
(
Utils
.
payTypeZFB
);
FileUtils
.
deleteFiles
(
Utils
.
WeiXinImgPath
);
}
}
}
/**
/**
* 支付宝保存的图片只存在于 DCIM/CAMERA 华为手机
* 支付宝保存的图片只存在于 DCIM/CAMERA 华为手机
*/
*/
private
void
functionFoundImageFile
(
String
filePath
){
private
ArrayList
<
ImageBean
>
functionFoundImageFile
(
String
filePath
){
//有sd卡
//有sd卡
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
()))
{
.
getExternalStorageState
()))
{
...
@@ -73,7 +103,7 @@ public class QRCodeFunction extends Thread{
...
@@ -73,7 +103,7 @@ public class QRCodeFunction extends Thread{
Log
.
d
(
TAG
,
"文件夹存在"
);
Log
.
d
(
TAG
,
"文件夹存在"
);
File
[]
files
=
path1
.
listFiles
();
File
[]
files
=
path1
.
listFiles
();
if
(
files
.
length
>
0
)
{
if
(
files
.
length
>
0
)
{
functionQRCode
(
files
);
return
functionQRCode
(
files
);
}
else
{
}
else
{
Log
.
d
(
TAG
,
"没有图片文件"
);
Log
.
d
(
TAG
,
"没有图片文件"
);
}
}
...
@@ -83,16 +113,21 @@ public class QRCodeFunction extends Thread{
...
@@ -83,16 +113,21 @@ public class QRCodeFunction extends Thread{
}
else
{
}
else
{
}
}
return
null
;
}
}
public
void
functionQRCode
(
File
[]
files
){
public
ArrayList
<
ImageBean
>
functionQRCode
(
File
[]
files
){
for
(
File
f:
files
)
{
for
(
File
f:
files
)
{
parseCode
(
f
);
parseCode
(
f
);
}
}
ActivePushCashList
activePushCashList
=
new
ActivePushCashList
();
activePushCashList
.
pushCashList
(
this
.
functionUrls
.
getBeans
());
interrupt
();
interrupt
();
return
functionUrls
.
getBeans
();
// ActivePushCashList activePushCashList = new ActivePushCashList();
//
//
// activePushCashList.pushCashList(this.functionUrls.getBeans());
}
}
public
void
parseCode
(
File
file
)
{
public
void
parseCode
(
File
file
)
{
...
@@ -107,21 +142,26 @@ public class QRCodeFunction extends Thread{
...
@@ -107,21 +142,26 @@ public class QRCodeFunction extends Thread{
Result
re
=
null
;
Result
re
=
null
;
try
{
try
{
re
=
reader
.
decode
(
bitmap1
);
re
=
reader
.
decode
(
bitmap1
);
ImageBean
bean
=
new
ImageBean
();
bean
.
setUrl
(
re
.
getText
());
bean
.
setDescription
(
file
.
getName
());
this
.
functionUrls
.
getBeans
().
add
(
bean
);
Log
.
d
(
TAG
,
"parseCode: "
+
bean
.
getUrl
());
}
catch
(
NotFoundException
e
)
{
}
catch
(
NotFoundException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
Log
.
d
(
TAG
,
"fei error: "
+
e
.
getMessage
()
+
" file name "
+
file
.
getName
());
}
catch
(
ChecksumException
e
)
{
}
catch
(
ChecksumException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
Log
.
d
(
TAG
,
"fei error: "
+
e
.
getMessage
()
+
" file name "
+
file
.
getName
());
}
catch
(
FormatException
e
)
{
}
catch
(
FormatException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
Log
.
d
(
TAG
,
"fei error: "
+
e
.
getMessage
()
+
" file name "
+
file
.
getName
());
}
}
ImageBean
bean
=
new
ImageBean
();
bean
.
setUrl
(
re
.
getText
());
bean
.
setDescription
(
file
.
getName
());
this
.
functionUrls
.
getBeans
().
add
(
bean
);
Log
.
d
(
TAG
,
"parseCode: "
+
bean
.
getUrl
());
}
}
@Override
@Override
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/service/MyAccessibilityService.java
View file @
e30b75bc
...
@@ -96,7 +96,12 @@ public class MyAccessibilityService extends AccessibilityService {
...
@@ -96,7 +96,12 @@ public class MyAccessibilityService extends AccessibilityService {
//支付宝方法
//支付宝方法
if
(
packageName
.
equals
(
ALIPAYPACKAGENAME
)){
if
(
packageName
.
equals
(
ALIPAYPACKAGENAME
)){
alipaySimulation
.
aliPaySteps
(
className
,
indexCount
,
event
,
getRootInActiveWindow
(),
eventType
);
boolean
isLastStep
=
alipaySimulation
.
aliPaySteps
(
className
,
indexCount
,
event
,
getRootInActiveWindow
(),
eventType
);
if
(
isLastStep
){
indexCount
++;
Log
.
d
(
TAG
,
"fei 完成一个 "
+
indexCount
);
}
}
}
//微信方法
//微信方法
...
@@ -120,8 +125,8 @@ public class MyAccessibilityService extends AccessibilityService {
...
@@ -120,8 +125,8 @@ public class MyAccessibilityService extends AccessibilityService {
alipaySimulation
=
new
AlipaySimulation
(
moneylist
,
getApplicationContext
())
{
alipaySimulation
=
new
AlipaySimulation
(
moneylist
,
getApplicationContext
())
{
@Override
@Override
public
void
jump2Menu
(
AlipayFunction
function
)
{
public
void
jump2Menu
(
AlipayFunction
function
)
{
performGlobalAction
(
AccessibilityService
.
GLOBAL_ACTION_BACK
);
function
.
resetStatus
();
function
.
resetStatus
();
performGlobalAction
(
AccessibilityService
.
GLOBAL_ACTION_BACK
);
}
}
};
};
...
...
build.gradle
View file @
e30b75bc
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
buildscript
{
buildscript
{
repositories
{
repositories
{
jcenter
()
jcenter
()
google
()
}
}
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:3.0.1'
classpath
'com.android.tools.build:gradle:3.0.1'
...
@@ -15,6 +16,7 @@ buildscript {
...
@@ -15,6 +16,7 @@ buildscript {
allprojects
{
allprojects
{
repositories
{
repositories
{
jcenter
()
jcenter
()
google
()
}
}
}
}
...
...
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