Quellcode durchsuchen

1.rv禁止多点触控

20241218TB223FC(测试jar包)
wangwanlei vor 10 Monaten
Ursprung
Commit
79ac202752
1 geänderte Dateien mit 23 neuen und 10 gelöschten Zeilen
  1. 23
    10
      app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt

+ 23
- 10
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Datei anzeigen

@@ -34,6 +34,8 @@ import androidx.appcompat.content.res.AppCompatResources
34 34
 import androidx.lifecycle.lifecycleScope
35 35
 import androidx.lifecycle.viewModelScope
36 36
 import androidx.recyclerview.widget.GridLayoutManager
37
+import androidx.recyclerview.widget.RecyclerView
38
+import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
37 39
 import androidx.work.PeriodicWorkRequest
38 40
 import androidx.work.WorkManager
39 41
 import com.baidu.location.BDAbstractLocationListener
@@ -669,21 +671,15 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
669 671
 
670 672
             override fun clearMemory(context: Context, data: List<AppInfo>) {
671 673
                 lifecycleScope.launch(Dispatchers.IO){
672
-                    delay(500)
673
-                    withContext(Dispatchers.Main){
674
-                        StrategyUtils.clearMemory(context,data)
675
-                        Toaster.show(context.getString(R.string.speedend))
676
-                    }
674
+                    StrategyUtils.clearMemory(context,data)
675
+                    Toaster.show(context.getString(R.string.speedend))
677 676
                 }
678 677
             }
679 678
 
680 679
             override fun clearAppData(context: Context) {
681 680
                 lifecycleScope.launch(Dispatchers.IO){
682
-                    delay(500)
683
-                    withContext(Dispatchers.Main){
684
-                        StrategyUtils.clearAppData(context)
685
-                        Toaster.show(context.getString(R.string.clearend))
686
-                    }
681
+                    StrategyUtils.clearAppData(context)
682
+                    Toaster.show(context.getString(R.string.clearend))
687 683
                 }
688 684
             }
689 685
 
@@ -782,6 +778,23 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
782 778
     override fun onResume() {
783 779
         super.onResume()
784 780
         LogShow("执行onresume")
781
+        mBinding.rv.addOnItemTouchListener(object: OnItemTouchListener{
782
+            override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
783
+                if (e.pointerCount>1){
784
+                    return true
785
+                }
786
+                return false
787
+            }
788
+
789
+            override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
790
+
791
+            }
792
+
793
+            override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {
794
+
795
+            }
796
+
797
+        })
785 798
         updateNetErrorAppRv()
786 799
          updateResumeStrategy()
787 800
      /*   userBean?.let {

Laden…
Abbrechen
Speichern