Browse Source

1.修改MainActivity中定时提醒方法。

20241218TB223FC(测试jar包)
wangwanlei 11 months ago
parent
commit
c758c3b4a7

+ 5
- 4
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

359
     }
359
     }
360
 
360
 
361
     private fun startTimeTask(bean: SchoolDeviceSetBean) {
361
     private fun startTimeTask(bean: SchoolDeviceSetBean) {
362
-        if (bean.remindDuration==1){
362
+        if (bean.remindDuration==1&&bean.duration>0){
363
             //如果设置的有时间则执行任务
363
             //如果设置的有时间则执行任务
364
-            if (timer==null){
365
-                timer= Timer()
366
-            }else{
364
+            try {
367
                 timer?.cancel()
365
                 timer?.cancel()
366
+                timer= Timer()
367
+            }catch (e:Exception){
368
+
368
             }
369
             }
369
             timer?.let {
370
             timer?.let {
370
                 timer?.schedule( object : TimerTask() {
371
                 timer?.schedule( object : TimerTask() {

Loading…
Cancel
Save