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
fe95833b
authored
Mar 02, 2018
by
严琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化支付宝打开功能和界面优化
parent
01adbb59
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
23 deletions
+64
-23
app/src/main/AndroidManifest.xml
+3
-1
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
+17
-8
app/src/main/java/com/yuqirong/listenwechatnotification/ParentActivity.java
+2
-0
app/src/main/java/com/yuqirong/listenwechatnotification/broadcastReceiver/MyAwakenReceiver.java
+11
-9
app/src/main/java/com/yuqirong/listenwechatnotification/uitl/Utils.java
+14
-0
app/src/main/res/layout/activity_main.xml
+17
-5
No files found.
app/src/main/AndroidManifest.xml
View file @
fe95833b
...
@@ -74,8 +74,10 @@
...
@@ -74,8 +74,10 @@
<!--android:resource="@xml/accessibility_service_config" />-->
<!--android:resource="@xml/accessibility_service_config" />-->
<!--</service>-->
<!--</service>-->
<receiver
android:name=
".broadcastReceiver.MyAwakenReceiver"
>
<receiver
android:name=
".broadcastReceiver.MyAwakenReceiver"
>
<intent-filter>
<intent-filter>
<action
android:name=
"APliayAwaken"
/>
<action
android:name=
"APliayAwaken"
/>
</intent-filter>
</intent-filter>
</receiver>
</receiver>
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
View file @
fe95833b
...
@@ -18,9 +18,7 @@ import android.widget.Toast;
...
@@ -18,9 +18,7 @@ import android.widget.Toast;
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.function.BuildNotification
;
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
;
...
@@ -47,6 +45,8 @@ public class MainActivity extends ParentActivity {
...
@@ -47,6 +45,8 @@ public class MainActivity extends ParentActivity {
private
BuildUrlsFunction
functionUrls
;
private
BuildUrlsFunction
functionUrls
;
private
Save2SharedPreferences
save2SharedPreferences
;
private
Save2SharedPreferences
save2SharedPreferences
;
private
AlarmManager
am
;
private
PendingIntent
pi
;
@Override
@Override
public
void
setOnContentLayoutId
(
int
id
)
{
public
void
setOnContentLayoutId
(
int
id
)
{
...
@@ -92,10 +92,10 @@ public class MainActivity extends ParentActivity {
...
@@ -92,10 +92,10 @@ public class MainActivity extends ParentActivity {
}
}
});
});
EventBus
.
getDefault
().
register
(
this
);
EventBus
.
getDefault
().
register
(
this
);
String
code
=
"当前版本号:"
+
Utils
.
getLocalVersion
(
this
)+
""
;
String
code
=
"当前版本号:"
+
Utils
.
getLocalVersion
Name
(
this
)+
""
;
versionCode
.
setText
(
code
);
versionCode
.
setText
(
code
);
checkNotificationPermission
();
checkNotificationPermission
();
//
awakenUpFucntion();
awakenUpFucntion
();
}
}
...
@@ -159,21 +159,24 @@ private void checkNotificationPermission() {
...
@@ -159,21 +159,24 @@ private void checkNotificationPermission() {
* 呼叫支付宝
* 呼叫支付宝
*/
*/
private
void
awakenUpFucntion
(){
private
void
awakenUpFucntion
(){
//创建Intent对象,action为APliayAwaken,附加信息为字符串“支付宝起来吧”
//创建Intent对象,action为APliayAwaken,附加信息为字符串“支付宝起来吧”
Intent
intent
=
new
Intent
(
"APliayAwaken"
);
Intent
intent
=
new
Intent
(
"APliayAwaken"
);
intent
.
putExtra
(
"msg"
,
"你该打酱油了"
);
intent
.
putExtra
(
"msg"
,
"你该打酱油了"
);
// ComponentName cn = new ComponentName(getPackageName(), MyAwakenReceiver.class.get());
// intent.setComponent(cn);
//定义一个PendingIntent对象,PendingIntent.getBroadcast包含了sendBroadcast的动作。
//定义一个PendingIntent对象,PendingIntent.getBroadcast包含了sendBroadcast的动作。
//也就是发送了action 为"ELITOR_CLOCK"的intent
//也就是发送了action 为"ELITOR_CLOCK"的intent
PendingIntent
pi
=
PendingIntent
.
getBroadcast
(
this
,
0
,
intent
,
0
);
pi
=
PendingIntent
.
getBroadcast
(
this
,
0
,
intent
,
0
);
//AlarmManager对象,注意这里并不是new一个对象,Alarmmanager为系统级服务
//AlarmManager对象,注意这里并不是new一个对象,Alarmmanager为系统级服务
AlarmManager
am
=
(
AlarmManager
)
getSystemService
(
ALARM_SERVICE
);
am
=
(
AlarmManager
)
getSystemService
(
ALARM_SERVICE
);
//设置闹钟从当前时间开始,每隔5s执行一次PendingIntent对象pi,注意第一个参数与第二个参数的关系
//设置闹钟从当前时间开始,每隔5s执行一次PendingIntent对象pi,注意第一个参数与第二个参数的关系
// 5秒后通过PendingIntent pi对象发送广播
// 5秒后通过PendingIntent pi对象发送广播
am
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
System
.
currentTimeMillis
(),
1
000
*
60
*
60
,
pi
);
am
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
System
.
currentTimeMillis
(),
5
000
*
60
*
60
,
pi
);
}
}
@Override
@Override
...
@@ -199,4 +202,10 @@ private void checkNotificationPermission() {
...
@@ -199,4 +202,10 @@ private void checkNotificationPermission() {
Log
.
d
(
TAG
,
"Event: "
+
bean
.
getUrl
());
Log
.
d
(
TAG
,
"Event: "
+
bean
.
getUrl
());
}
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
am
.
cancel
(
pi
);
}
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/ParentActivity.java
View file @
fe95833b
...
@@ -30,6 +30,8 @@ public class ParentActivity extends AppCompatActivity {
...
@@ -30,6 +30,8 @@ public class ParentActivity extends AppCompatActivity {
setContentView
(
id
);
setContentView
(
id
);
}
}
public
void
initView
(){
public
void
initView
(){
}
}
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/broadcastReceiver/MyAwakenReceiver.java
View file @
fe95833b
...
@@ -26,14 +26,15 @@ public class MyAwakenReceiver extends BroadcastReceiver {
...
@@ -26,14 +26,15 @@ public class MyAwakenReceiver extends BroadcastReceiver {
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
JobAwaken
jobAwaken
=
new
JobAwaken
();
jobAwaken
.
awakenAPliay
(
context
);
if
(!
isServiceExisted
(
context
,
"com.alipay.pushsdk.push.NotificationService"
))
{
// if (!isServiceExisted(context,"com.eg.android.AlipayGphone")) {
JobAwaken
jobAwaken
=
new
JobAwaken
();
// JobAwaken jobAwaken = new JobAwaken();
jobAwaken
.
awakenAPliay
(
context
);
// jobAwaken.awakenAPliay(context);
}
else
{
// }else{
Log
.
d
(
TAG
,
"不需要开启 "
);
// Log.d(TAG, "onReceive:进程存在 ");
}
// }
abortBroadcast
();
}
}
public
static
boolean
isServiceExisted
(
Context
context
,
String
className
)
{
public
static
boolean
isServiceExisted
(
Context
context
,
String
className
)
{
...
@@ -45,7 +46,8 @@ public class MyAwakenReceiver extends BroadcastReceiver {
...
@@ -45,7 +46,8 @@ public class MyAwakenReceiver extends BroadcastReceiver {
for
(
int
i
=
0
;
i
<
serviceList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
serviceList
.
size
();
i
++)
{
ActivityManager
.
RunningServiceInfo
serviceInfo
=
serviceList
.
get
(
i
);
ActivityManager
.
RunningServiceInfo
serviceInfo
=
serviceList
.
get
(
i
);
ComponentName
serviceName
=
serviceInfo
.
service
;
ComponentName
serviceName
=
serviceInfo
.
service
;
if
(
serviceName
.
getClassName
().
equals
(
className
))
{
if
(
serviceName
.
getClassName
().
toString
().
contains
(
className
))
{
Log
.
d
(
TAG
,
"onReceive:进程存在 "
);
return
true
;
return
true
;
}
}
}
}
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/uitl/Utils.java
View file @
fe95833b
...
@@ -24,4 +24,18 @@ public class Utils {
...
@@ -24,4 +24,18 @@ public class Utils {
}
}
return
localVersion
;
return
localVersion
;
}
}
public
static
String
getLocalVersionName
(
Context
ctx
)
{
String
localVersion
=
""
;
try
{
PackageInfo
packageInfo
=
ctx
.
getApplicationContext
()
.
getPackageManager
()
.
getPackageInfo
(
ctx
.
getPackageName
(),
0
);
localVersion
=
packageInfo
.
versionName
;
Log
.
d
(
"TAG"
,
"本软件的版本名。。"
+
localVersion
);
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
e
.
printStackTrace
();
}
return
localVersion
;
}
}
}
app/src/main/res/layout/activity_main.xml
View file @
fe95833b
...
@@ -12,13 +12,18 @@
...
@@ -12,13 +12,18 @@
android:orientation=
"vertical"
android:orientation=
"vertical"
>
>
<ScrollView
<android.support.v4.widget.NestedScrollView
android:overScrollMode=
"never"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<LinearLayout
<LinearLayout
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -31,6 +36,8 @@
...
@@ -31,6 +36,8 @@
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
<EditText
<EditText
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:layout_below=
"@id/text1"
android:layout_below=
"@id/text1"
android:id=
"@+id/et_text1"
android:id=
"@+id/et_text1"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -51,6 +58,8 @@
...
@@ -51,6 +58,8 @@
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
<EditText
<EditText
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:layout_below=
"@id/text3"
android:layout_below=
"@id/text3"
android:id=
"@+id/et_text3"
android:id=
"@+id/et_text3"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -71,6 +80,8 @@
...
@@ -71,6 +80,8 @@
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
<EditText
<EditText
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:layout_below=
"@id/text2"
android:layout_below=
"@id/text2"
android:id=
"@+id/et_text2"
android:id=
"@+id/et_text2"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -103,6 +114,7 @@
...
@@ -103,6 +114,7 @@
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:text=
"11111"
/>
android:text=
"11111"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</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