Browse Source

1.注销按钮回调只执行一次。

2.电源键点击添加延迟为50s
0423x6e6f
wangwanlei 3 weeks ago
parent
commit
820964a495

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

182
     private var netAutoAppFlag=false
182
     private var netAutoAppFlag=false
183
     //表示请求了策略更新
183
     //表示请求了策略更新
184
     private var netStrategyDataFlag=false
184
     private var netStrategyDataFlag=false
185
+    //表示请求了退出
186
+    private var quitFlag=false
187
+    //处理连续点击电源键的操作
188
+    private var lastClickPowerTime=0L
185
 
189
 
186
     override fun getBinding() = ActivityMainBinding.inflate(layoutInflater)
190
     override fun getBinding() = ActivityMainBinding.inflate(layoutInflater)
187
 
191
 
513
                     mBinding.rv.visibility = View.VISIBLE
517
                     mBinding.rv.visibility = View.VISIBLE
514
                     updateAppRv()
518
                     updateAppRv()
515
                     if (it.fromNetWorkType == 1) {
519
                     if (it.fromNetWorkType == 1) {
516
-                        quitAccount(it)
520
+                        if (quitFlag){
521
+                            quitFlag=false
522
+                            quitAccount(it)
523
+                        }
517
                     } else if (it.fromNetWorkType == 2) {
524
                     } else if (it.fromNetWorkType == 2) {
518
                         changeCode(it)
525
                         changeCode(it)
519
                     }
526
                     }
785
         }
792
         }
786
         mBinding.loginoutLlayout.setOnClickListener {
793
         mBinding.loginoutLlayout.setOnClickListener {
787
             userBean?.let {
794
             userBean?.let {
795
+                quitFlag=true
788
                 viewModel.getSchoolSetData(it.schoolid)
796
                 viewModel.getSchoolSetData(it.schoolid)
789
             }
797
             }
790
         }
798
         }
1641
                     startTimeTask(it, true)
1649
                     startTimeTask(it, true)
1642
                 }
1650
                 }
1643
                 screenFlag = true
1651
                 screenFlag = true
1644
-                Const.backNum++
1645
-                updateResumeStrategy()
1652
+                if (System.currentTimeMillis()-lastClickPowerTime>50000){
1653
+                    lastClickPowerTime=System.currentTimeMillis()
1654
+                    Const.backNum++
1655
+                    updateResumeStrategy()
1656
+                }
1646
             }
1657
             }
1647
 
1658
 
1648
             Const.ACTION_SCREEN_OFF -> {
1659
             Const.ACTION_SCREEN_OFF -> {

Loading…
Cancel
Save