diff --git a/app/src/main/java/eu/faircode/email/FixedEditText.java b/app/src/main/java/eu/faircode/email/FixedEditText.java index 6ca850c68e..a6ff6597fa 100644 --- a/app/src/main/java/eu/faircode/email/FixedEditText.java +++ b/app/src/main/java/eu/faircode/email/FixedEditText.java @@ -21,6 +21,7 @@ package eu.faircode.email; import android.content.Context; import android.graphics.Canvas; +import android.os.Build; import android.util.AttributeSet; import android.view.MotionEvent; @@ -97,6 +98,20 @@ public class FixedEditText extends AppCompatEditText { } } + @Override + public boolean dispatchTouchEvent(MotionEvent event) { + // https://issuetracker.google.com/issues/37068143 + if ((BuildConfig.DEBUG || Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) && + hasSelection() && + event.getActionMasked() == MotionEvent.ACTION_DOWN) { + CharSequence text = getText(); + setText(null); + setText(text); + } + + return super.dispatchTouchEvent(event); + } + @Override public boolean performLongClick() { try { diff --git a/app/src/main/java/eu/faircode/email/FixedTextView.java b/app/src/main/java/eu/faircode/email/FixedTextView.java index dce8e8e9b7..126cc8bfe7 100644 --- a/app/src/main/java/eu/faircode/email/FixedTextView.java +++ b/app/src/main/java/eu/faircode/email/FixedTextView.java @@ -111,7 +111,7 @@ public class FixedTextView extends AppCompatTextView { @Override public boolean dispatchTouchEvent(MotionEvent event) { // https://issuetracker.google.com/issues/37068143 - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M && + if ((BuildConfig.DEBUG || Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) && hasSelection() && event.getActionMasked() == MotionEvent.ACTION_DOWN) { CharSequence text = getText();