I have a selectable textView with
textView.setTextIsSelectable(true)
I want to show my own popup menu on double tap and I want to show standart text selection controls on long tap. But now when I make double tap I see text selection action mode and then popup menu. How I can disable text selection mode on double tap?
I've tried to make textView selectable in onLongClickListener and then call performLongClick() - works only with second long tap, I don't need this
textView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
textView.setTextIsSelectable(true);
if (view.getTag() == null){
view.setTag(new Object());
view.performLongClick();
}
return false;
}
});
Also tried call textView private method via reflection to show selection action mode - falls with java.lang.NoSuchFieldException: mEditor, I checked the sources and I see mEditor field
Field field = textView.getClass().getDeclaredField("mEditor");
field.setAccessible(true);
Object mEditor = field.gettextView);
Class c = Class.forName("android.widget.Editor");
Method method = c.getMethod("startSelectionActionMode", null);
method.setAccessible(true);
Object result = method.invoke(mEditor);
So, how I can disable text selection mode on double tap and show text selection only with long tap?