use touch listeners for hiding popup button

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-11-08 15:47:20 +01:00 committed by Marcel Hibbe
parent 0920029183
commit eda9b94182
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -896,6 +896,7 @@ class CallActivity : CallBaseActivity() {
val action = me.actionMasked val action = me.actionMasked
if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) {
animateCallControls(true, 0) animateCallControls(true, 0)
binding!!.popupMenu.visibility = View.GONE
} }
false false
} }
@ -903,6 +904,7 @@ class CallActivity : CallBaseActivity() {
val action = me.actionMasked val action = me.actionMasked
if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) {
animateCallControls(true, 0) animateCallControls(true, 0)
binding!!.popupMenu.visibility = View.GONE
} }
false 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() { fun clickRaiseOrLowerHandButton() {
raiseHandViewModel!!.clickHandButton() raiseHandViewModel!!.clickHandButton()
} }