cancel touch event after opening context menu in search view

This commit is contained in:
Daniel Gultsch 2020-12-18 21:18:09 +01:00
parent 090b3b18d0
commit 39229c34f6
1 changed files with 3 additions and 1 deletions

View File

@ -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);