From 39229c34f6119d2233bdb4dc013cd8677329eef8 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 18 Dec 2020 21:18:09 +0100 Subject: [PATCH] cancel touch event after opening context menu in search view --- src/main/java/eu/siacs/conversations/ui/SearchActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java index d73249f4b..1b2430f6d 100644 --- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java @@ -39,6 +39,7 @@ import android.text.TextWatcher; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; import android.widget.AdapterView; import android.widget.EditText; @@ -130,7 +131,8 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc } @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { + public void onCreateContextMenu(final ContextMenu menu, final View v, ContextMenu.ContextMenuInfo menuInfo) { + v.dispatchTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)); AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo; final Message message = this.messages.get(acmi.position); this.selectedMessageReference = new WeakReference<>(message);