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
f8355c48
authored
Mar 07, 2018
by
jeffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解析任务调整,明天加入多线程解析
parent
1317c475
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
18 deletions
+88
-18
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
+42
-6
app/src/main/java/com/yuqirong/listenwechatnotification/function/JobAwaken.java
+2
-0
app/src/main/java/com/yuqirong/listenwechatnotification/function/QRCodeFunction.java
+32
-12
app/src/main/java/com/yuqirong/listenwechatnotification/service/MyAccessibilityService.java
+12
-0
No files found.
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
View file @
f8355c48
...
@@ -5,9 +5,11 @@ import android.app.AlarmManager;
...
@@ -5,9 +5,11 @@ import android.app.AlarmManager;
import
android.app.PendingIntent
;
import
android.app.PendingIntent
;
import
android.content.ActivityNotFoundException
;
import
android.content.ActivityNotFoundException
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.os.Environment
;
import
android.provider.Settings
;
import
android.provider.Settings
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.content.LocalBroadcastManager
;
import
android.support.v4.content.LocalBroadcastManager
;
...
@@ -23,12 +25,17 @@ import com.yuqirong.listenwechatnotification.askhttp.UpdateApk;
...
@@ -23,12 +25,17 @@ 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
;
import
com.yuqirong.listenwechatnotification.function.BuildUrlsFunction
;
import
com.yuqirong.listenwechatnotification.function.BuildUrlsFunction
;
import
com.yuqirong.listenwechatnotification.function.QRCodeFunction
;
import
com.yuqirong.listenwechatnotification.service.WeChatNotificationListenerService
;
import
com.yuqirong.listenwechatnotification.service.WeChatNotificationListenerService
;
import
com.yuqirong.listenwechatnotification.uitl.Save2SharedPreferences
;
import
com.yuqirong.listenwechatnotification.uitl.Save2SharedPreferences
;
import
com.yuqirong.listenwechatnotification.uitl.Utils
;
import
com.yuqirong.listenwechatnotification.uitl.Utils
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
static
com
.
yuqirong
.
listenwechatnotification
.
function
.
QRCodeFunction
.
listAllZfbFileNames
;
import
static
com
.
yuqirong
.
listenwechatnotification
.
function
.
QRCodeFunction
.
listAllZfbFileNames
;
...
@@ -127,12 +134,29 @@ public class MainActivity extends ParentActivity {
...
@@ -127,12 +134,29 @@ public class MainActivity extends ParentActivity {
// timingRequest();
// timingRequest();
// ArrayList<String> result = ActivePullCashList.generateMoneys();
// ArrayList<String> result = ActivePullCashList.generateMoneys();
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
one
:
result
){
// new Runnable() {
sb
.
append
(
one
);
// @Override
sb
.
append
(
","
);
// public void run() {
}
// QRCodeFunction qrThread = new QRCodeFunction("QRCodeFunction---ZFB", Utils.ZFBImgPath);
Log
.
d
(
TAG
,
"done ="
+
sb
.
toString
());
// qrThread.run();
// }
// }.run();
// String strResult = MyApplication.get().getSharedPreferences("result", Context.MODE_PRIVATE).getString("result","");
// try {
// writeString2File(strResult);
// } catch (IOException e) {
// e.printStackTrace();
// }
// StringBuilder sb = new StringBuilder();
// for (String one : result){
// sb.append(one);
// sb.append(",");
// }
// Log.d(TAG,"done =" + sb.toString());
}
}
...
@@ -239,6 +263,18 @@ private void checkNotificationPermission() {
...
@@ -239,6 +263,18 @@ private void checkNotificationPermission() {
am
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
System
.
currentTimeMillis
(),
10000
,
pi
);
am
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
System
.
currentTimeMillis
(),
10000
,
pi
);
}
}
public
static
void
writeString2File
(
String
str
)
throws
IOException
{
File
moneyFile
=
new
File
(
Environment
.
getExternalStorageDirectory
().
getPath
(),
"money.txt"
);
if
(!
moneyFile
.
exists
()){
moneyFile
.
createNewFile
();
}
BufferedWriter
bfw
=
new
BufferedWriter
(
new
FileWriter
(
moneyFile
,
false
));
bfw
.
write
(
str
);
bfw
.
flush
();
bfw
.
close
();
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/function/JobAwaken.java
View file @
f8355c48
...
@@ -32,7 +32,9 @@ public class JobAwaken {
...
@@ -32,7 +32,9 @@ public class JobAwaken {
Toast
.
makeText
(
context
,
"未安装微信"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
context
,
"未安装微信"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
}
else
{
intent
.
setComponent
(
cn
);
intent
.
setComponent
(
cn
);
if
(
context
.
getPackageManager
().
resolveActivity
(
intent
,
0
)
!=
null
){
context
.
startActivity
(
intent
);
context
.
startActivity
(
intent
);
}
}
}
}
}
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/function/QRCodeFunction.java
View file @
f8355c48
...
@@ -23,6 +23,7 @@ import com.google.zxing.RGBLuminanceSource;
...
@@ -23,6 +23,7 @@ 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.MainActivity
;
import
com.yuqirong.listenwechatnotification.MyApplication
;
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
;
...
@@ -38,8 +39,11 @@ import org.greenrobot.eventbus.Subscribe;
...
@@ -38,8 +39,11 @@ 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.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
android
.
graphics
.
BitmapFactory
.
decodeFile
;
import
static
android
.
graphics
.
BitmapFactory
.
decodeFile
;
...
@@ -50,22 +54,26 @@ import static android.graphics.BitmapFactory.decodeFile;
...
@@ -50,22 +54,26 @@ import static android.graphics.BitmapFactory.decodeFile;
*/
*/
public
class
QRCodeFunction
extends
Thread
{
public
class
QRCodeFunction
extends
Thread
{
ArrayList
<
ImageBean
>
beans
;
private
static
String
TAG
=
"QRCodeFunction"
;
private
static
String
TAG
=
"QRCodeFunction"
;
private
BuildUrlsFunction
functionUrls
;
//
private BuildUrlsFunction functionUrls;
private
String
filePath
;
private
String
filePath
;
public
QRCodeFunction
(
String
name
,
String
filePath
)
{
public
QRCodeFunction
(
String
name
,
String
filePath
)
{
super
(
name
);
super
(
name
);
this
.
filePath
=
filePath
;
this
.
filePath
=
filePath
;
this
.
beans
=
new
ArrayList
<>();
}
}
@Override
@Override
public
void
run
()
{
public
void
run
()
{
super
.
run
();
super
.
run
();
functionUrls
=
new
BuildUrlsFunction
();
List
<
File
>
imageFiles
=
functionFoundImageFile
(
this
.
filePath
);
ArrayList
<
ImageBean
>
imageInfos
=
functionFoundImageFile
(
this
.
filePath
);
List
<
ImageBean
>
imageBeanList
=
functionQRCode
((
File
[])
imageFiles
.
toArray
());
OneBatchResult
result
=
new
OneBatchResult
(
imageInfos
);
OneBatchResult
result
=
new
OneBatchResult
(
new
ArrayList
<
ImageBean
>(
imageBeanList
));
String
stringResult
=
new
Gson
().
toJson
(
result
);
String
stringResult
=
new
Gson
().
toJson
(
result
);
SharedPreferences
sp
=
MyApplication
.
get
().
getSharedPreferences
(
"result"
,
Context
.
MODE_PRIVATE
);
SharedPreferences
sp
=
MyApplication
.
get
().
getSharedPreferences
(
"result"
,
Context
.
MODE_PRIVATE
);
...
@@ -75,6 +83,14 @@ public class QRCodeFunction extends Thread{
...
@@ -75,6 +83,14 @@ public class QRCodeFunction extends Thread{
Log
.
d
(
TAG
,
stringResult
);
Log
.
d
(
TAG
,
stringResult
);
Log
.
d
(
TAG
,
"fei result end-----------------------------"
);
Log
.
d
(
TAG
,
"fei result end-----------------------------"
);
String
strResult
=
MyApplication
.
get
().
getSharedPreferences
(
"result"
,
Context
.
MODE_PRIVATE
).
getString
(
"result"
,
""
);
Log
.
d
(
TAG
,
"done ="
+
strResult
);
try
{
MainActivity
.
writeString2File
(
strResult
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
// //数据发送成功的话,这边修改下次请求参数类型
// //数据发送成功的话,这边修改下次请求参数类型
// //还需要删除当前类型文件夹下所有图片
// //还需要删除当前类型文件夹下所有图片
// if (PayTypeSingleTon.newInstance().getPayType().equals(Utils.payTypeZFB)){
// if (PayTypeSingleTon.newInstance().getPayType().equals(Utils.payTypeZFB)){
...
@@ -90,7 +106,7 @@ public class QRCodeFunction extends Thread{
...
@@ -90,7 +106,7 @@ public class QRCodeFunction extends Thread{
/**
/**
* 支付宝保存的图片只存在于 DCIM/CAMERA 华为手机
* 支付宝保存的图片只存在于 DCIM/CAMERA 华为手机
*/
*/
private
ArrayList
<
ImageBean
>
functionFoundImageFile
(
String
filePath
){
private
List
<
File
>
functionFoundImageFile
(
String
filePath
){
//有sd卡
//有sd卡
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
()))
{
.
getExternalStorageState
()))
{
...
@@ -103,7 +119,7 @@ public class QRCodeFunction extends Thread{
...
@@ -103,7 +119,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
)
{
return
functionQRCode
(
files
);
return
Arrays
.
asList
(
files
);
}
else
{
}
else
{
Log
.
d
(
TAG
,
"没有图片文件"
);
Log
.
d
(
TAG
,
"没有图片文件"
);
}
}
...
@@ -134,12 +150,15 @@ public class QRCodeFunction extends Thread{
...
@@ -134,12 +150,15 @@ public class QRCodeFunction extends Thread{
}
}
public
ArrayList
<
ImageBean
>
functionQRCode
(
File
[]
files
){
public
ArrayList
<
ImageBean
>
functionQRCode
(
File
[]
files
){
ArrayList
<
ImageBean
>
list
=
new
ArrayList
<>();
for
(
File
f:
files
)
{
for
(
File
f:
files
)
{
parseCode
(
f
);
ImageBean
imageBean
=
parseCode
(
f
);
if
(
imageBean
!=
null
){
list
.
add
(
imageBean
);
}
}
}
interrupt
();
return
functionUrls
.
getBeans
()
;
return
list
;
// ActivePushCashList activePushCashList = new ActivePushCashList();
// ActivePushCashList activePushCashList = new ActivePushCashList();
//
//
...
@@ -147,7 +166,7 @@ public class QRCodeFunction extends Thread{
...
@@ -147,7 +166,7 @@ public class QRCodeFunction extends Thread{
// activePushCashList.pushCashList(this.functionUrls.getBeans());
// activePushCashList.pushCashList(this.functionUrls.getBeans());
}
}
public
void
parseCode
(
File
file
)
{
public
ImageBean
parseCode
(
File
file
)
{
Bitmap
obmp
=
decodeFile
(
file
.
getPath
());
Bitmap
obmp
=
decodeFile
(
file
.
getPath
());
int
width
=
obmp
.
getWidth
();
int
width
=
obmp
.
getWidth
();
int
height
=
obmp
.
getHeight
();
int
height
=
obmp
.
getHeight
();
...
@@ -162,10 +181,10 @@ public class QRCodeFunction extends Thread{
...
@@ -162,10 +181,10 @@ public class QRCodeFunction extends Thread{
ImageBean
bean
=
new
ImageBean
();
ImageBean
bean
=
new
ImageBean
();
bean
.
setUrl
(
re
.
getText
());
bean
.
setUrl
(
re
.
getText
());
bean
.
setDescription
(
file
.
getName
());
bean
.
setDescription
(
file
.
getName
());
Log
.
d
(
TAG
,
"parseCode: "
+
bean
.
getUrl
());
this
.
functionUrls
.
getBeans
().
add
(
bean
)
;
return
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
());
Log
.
d
(
TAG
,
"fei error: "
+
e
.
getMessage
()
+
" file name "
+
file
.
getName
());
...
@@ -178,6 +197,7 @@ public class QRCodeFunction extends Thread{
...
@@ -178,6 +197,7 @@ public class QRCodeFunction extends Thread{
Log
.
d
(
TAG
,
"fei error: "
+
e
.
getMessage
()
+
" file name "
+
file
.
getName
());
Log
.
d
(
TAG
,
"fei error: "
+
e
.
getMessage
()
+
" file name "
+
file
.
getName
());
}
}
return
null
;
}
}
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/service/MyAccessibilityService.java
View file @
f8355c48
...
@@ -83,12 +83,24 @@ public class MyAccessibilityService extends AccessibilityService {
...
@@ -83,12 +83,24 @@ public class MyAccessibilityService extends AccessibilityService {
Log
.
d
(
TAG
,
"这次任务已经完成!"
);
Log
.
d
(
TAG
,
"这次任务已经完成!"
);
if
(
PayTypeSingleTon
.
newInstance
().
getPayType
().
equals
(
Utils
.
payTypeZFB
)){
if
(
PayTypeSingleTon
.
newInstance
().
getPayType
().
equals
(
Utils
.
payTypeZFB
)){
new
Runnable
()
{
@Override
public
void
run
()
{
QRCodeFunction
qrThread
=
new
QRCodeFunction
(
"QRCodeFunction---ZFB"
,
Utils
.
ZFBImgPath
);
QRCodeFunction
qrThread
=
new
QRCodeFunction
(
"QRCodeFunction---ZFB"
,
Utils
.
ZFBImgPath
);
qrThread
.
run
();
qrThread
.
run
();
}
}.
run
();
}
else
{
}
else
{
new
Runnable
()
{
@Override
public
void
run
()
{
QRCodeFunction
qrThread
=
new
QRCodeFunction
(
"QRCodeFunction---WEIXIN"
,
Utils
.
WeiXinImgPath
);
QRCodeFunction
qrThread
=
new
QRCodeFunction
(
"QRCodeFunction---WEIXIN"
,
Utils
.
WeiXinImgPath
);
qrThread
.
run
();
qrThread
.
run
();
}
}
}.
run
();
}
moneylist
.
clear
();
moneylist
.
clear
();
return
;
return
;
...
...
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