Browse Source

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

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

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

@@ -182,6 +182,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
182 182
     private var netAutoAppFlag=false
183 183
     //表示请求了策略更新
184 184
     private var netStrategyDataFlag=false
185
+    //表示请求了退出
186
+    private var quitFlag=false
187
+    //处理连续点击电源键的操作
188
+    private var lastClickPowerTime=0L
185 189
 
186 190
     override fun getBinding() = ActivityMainBinding.inflate(layoutInflater)
187 191
 
@@ -513,7 +517,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
513 517
                     mBinding.rv.visibility = View.VISIBLE
514 518
                     updateAppRv()
515 519
                     if (it.fromNetWorkType == 1) {
516
-                        quitAccount(it)
520
+                        if (quitFlag){
521
+                            quitFlag=false
522
+                            quitAccount(it)
523
+                        }
517 524
                     } else if (it.fromNetWorkType == 2) {
518 525
                         changeCode(it)
519 526
                     }
@@ -785,6 +792,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
785 792
         }
786 793
         mBinding.loginoutLlayout.setOnClickListener {
787 794
             userBean?.let {
795
+                quitFlag=true
788 796
                 viewModel.getSchoolSetData(it.schoolid)
789 797
             }
790 798
         }
@@ -1641,8 +1649,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
1641 1649
                     startTimeTask(it, true)
1642 1650
                 }
1643 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 1659
             Const.ACTION_SCREEN_OFF -> {

Loading…
Cancel
Save