Skip to content

Commit 6eeed55

Browse files
committed
fix:修复一些小问题
1 parent 9847d3f commit 6eeed55

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/src/main/java/net/ankio/vpay/ui/MainActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ class MainActivity : BaseActivity() {
107107

108108

109109
override fun onDestroy() {
110-
super.onDestroy()
111110
Logger.d(tag, "--------- ending of session", this)
111+
super.onDestroy()
112+
112113
}
113114

114115
private fun isNotificationListenersEnabled(): Boolean {

app/src/main/java/net/ankio/vpay/ui/fragment/HomeFragment.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class HomeFragment : Fragment() {
9898
}
9999
binding.url.setText(SpUtils.getString("host"))
100100
binding.key.setText(SpUtils.getString("key"))
101-
restartNotification()
101+
//restartNotification()
102102
refreshStatus()
103103
}
104104

@@ -147,7 +147,8 @@ class HomeFragment : Fragment() {
147147
private fun refreshStatus(){
148148
val time = SpUtils.getLong("time_heart",0)
149149
val reason = SpUtils.getString("reason","尚未配置数据")
150-
if(SpUtils.getInt("heart",0)==0 && isMyNotificationListenerServiceRunning(requireContext()) ){
150+
if(!isMyNotificationListenerServiceRunning(requireContext())) restartNotification()
151+
if(SpUtils.getInt("heart",0)==0 || !isMyNotificationListenerServiceRunning(requireContext()) ){
151152
setActive2(getString(R.string.heart_not_work,reason,PushUtils.convertTimestampToDateTime(time)),com.google.android.material.R.attr.colorErrorContainer,com.google.android.material.R.attr.colorOnErrorContainer, R.drawable.ic_error)
152153
}else{
153154
setActive2(getString(R.string.heart_work,PushUtils.convertTimestampToDateTime(time)),com.google.android.material.R.attr.colorPrimary,com.google.android.material.R.attr.colorOnPrimary,R.drawable.ic_success)

0 commit comments

Comments
 (0)