Browse Source

1.多次调用按钮禁用方法调用。

0423x6e6f
wangwanlei 2 months ago
parent
commit
1133cf9b81

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

21
 import android.os.Build
21
 import android.os.Build
22
 import android.provider.Settings
22
 import android.provider.Settings
23
 import android.util.TypedValue
23
 import android.util.TypedValue
24
+import android.view.KeyEvent
24
 import android.view.MotionEvent
25
 import android.view.MotionEvent
25
 import android.view.View
26
 import android.view.View
26
 import android.view.View.OnClickListener
27
 import android.view.View.OnClickListener
674
 
675
 
675
     private fun startAutoApp(autoAppBean: AutoAppBean) {
676
     private fun startAutoApp(autoAppBean: AutoAppBean) {
676
         try {
677
         try {
678
+            StrategyUtils.initMainResume()
677
             try {
679
             try {
678
                 val am = getSystemService(ACTIVITY_SERVICE) as ActivityManager
680
                 val am = getSystemService(ACTIVITY_SERVICE) as ActivityManager
679
                 /*val runningTasks = am.getRunningTasks(1)
681
                 /*val runningTasks = am.getRunningTasks(1)
921
 
923
 
922
     override fun onResume() {
924
     override fun onResume() {
923
         super.onResume()
925
         super.onResume()
926
+        userBean?.let {
927
+            StrategyUtils.initMainResume()
928
+        }
924
         isResumeFlag = true
929
         isResumeFlag = true
925
         Const.startAppStoreFlag = false
930
         Const.startAppStoreFlag = false
926
         updateNetErrorAppRv()
931
         updateNetErrorAppRv()
2211
             true
2216
             true
2212
         }
2217
         }
2213
     }
2218
     }
2219
+
2220
+    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
2221
+        when(keyCode){
2222
+            KeyEvent.KEYCODE_HOME->{
2223
+                return true
2224
+            }
2225
+        }
2226
+        return super.onKeyDown(keyCode, event)
2227
+    }
2214
 }
2228
 }

+ 11
- 0
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt View File

510
         ManageApplication.hideHomeSoftKey(true)
510
         ManageApplication.hideHomeSoftKey(true)
511
         ManageApplication.hideMenuSoftKey(true)
511
         ManageApplication.hideMenuSoftKey(true)
512
     }
512
     }
513
+
514
+    fun initMainResume(){
515
+       try {
516
+           //禁止状态栏下拉,屏蔽底部虚拟键。
517
+           ManageApplication.disableStatusBarPanel(true)
518
+           ManageApplication.hideHomeSoftKey(true)
519
+           ManageApplication.hideMenuSoftKey(true)
520
+       }catch (e:Exception){
521
+          LogShow("设置出现问题问题是"+e.toString())
522
+       }
523
+    }
513
 }
524
 }

Loading…
Cancel
Save