浏览代码

use touch listeners for hiding popup button

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
sowjanyakch 6 月之前
父节点
当前提交
eda9b94182
共有 1 个文件被更改,包括 2 次插入24 次删除
  1. 2 24
      app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt

+ 2 - 24
app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt

@@ -896,6 +896,7 @@ class CallActivity : CallBaseActivity() {
             val action = me.actionMasked
             if (action == MotionEvent.ACTION_DOWN) {
                 animateCallControls(true, 0)
+                binding!!.popupMenu.visibility = View.GONE
             }
             false
         }
@@ -903,6 +904,7 @@ class CallActivity : CallBaseActivity() {
             val action = me.actionMasked
             if (action == MotionEvent.ACTION_DOWN) {
                 animateCallControls(true, 0)
+                binding!!.popupMenu.visibility = View.GONE
             }
             false
         }
@@ -1380,30 +1382,6 @@ class CallActivity : CallBaseActivity() {
         }
     }
 
-    override fun dispatchTouchEvent(event: MotionEvent): Boolean {
-        if (binding!!.popupMenu.visibility == View.VISIBLE) {
-            if (event.action == MotionEvent.ACTION_DOWN) {
-                val buttonLocation = IntArray(2)
-                binding!!.popupMenu.getLocationOnScreen(buttonLocation)
-
-                val popupMenuWidth = binding!!.popupMenu.width
-                val popupMenuHeight = binding!!.popupMenu.height
-
-                val buttonLeft = buttonLocation[0]
-                val buttonTop = buttonLocation[1]
-                val buttonRight = buttonLeft + popupMenuWidth
-                val buttonBottom = buttonTop + popupMenuHeight
-
-                val x = event.rawX
-                val y = event.rawY
-                if (x < buttonLeft || x > buttonRight || y < buttonTop || y > buttonBottom) {
-                    binding!!.popupMenu.visibility = View.GONE
-                }
-            }
-        }
-        return super.dispatchTouchEvent(event)
-    }
-
     fun clickRaiseOrLowerHandButton() {
         raiseHandViewModel!!.clickHandButton()
     }