Check for Android 6.0 for word iterator work around

This commit is contained in:
M66B 2020-09-13 20:48:05 +02:00
parent eb7fde9945
commit 75fe7d0ec9
2 changed files with 3 additions and 18 deletions

View File

@ -21,7 +21,6 @@ package eu.faircode.email;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -98,20 +97,6 @@ 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 @Override
public boolean performLongClick() { public boolean performLongClick() {
try { try {

View File

@ -111,9 +111,9 @@ public class FixedTextView extends AppCompatTextView {
@Override @Override
public boolean dispatchTouchEvent(MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) {
// https://issuetracker.google.com/issues/37068143 // https://issuetracker.google.com/issues/37068143
if ((BuildConfig.DEBUG || Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) && if (event.getActionMasked() == MotionEvent.ACTION_DOWN &&
hasSelection() && Build.VERSION.RELEASE.equals("6.0") && hasSelection()) {
event.getActionMasked() == MotionEvent.ACTION_DOWN) { // Remove selection
CharSequence text = getText(); CharSequence text = getText();
setText(null); setText(null);
setText(text); setText(text);