Prevent crash

This commit is contained in:
M66B 2022-06-23 07:56:44 +02:00
parent 29c1156782
commit 64d1955325
2 changed files with 42 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.graphics.Canvas;
import android.os.Build;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.textclassifier.TextClassifier;
@ -270,6 +271,26 @@ public class FixedEditText extends AppCompatEditText {
}
}
@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
try {
return super.startActionMode(callback);
} catch (Throwable ex) {
Log.e(ex);
return null;
}
}
@Override
public ActionMode startActionMode(ActionMode.Callback callback, int type) {
try {
return super.startActionMode(callback, type);
} catch (Throwable ex) {
Log.e(ex);
return null;
}
}
@NonNull
@Override
@RequiresApi(api = Build.VERSION_CODES.O)

View File

@ -29,6 +29,7 @@ import android.text.Selection;
import android.text.Spannable;
import android.text.Spanned;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.MotionEvent;
@ -351,6 +352,26 @@ public class FixedTextView extends AppCompatTextView {
}
}
@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
try {
return super.startActionMode(callback);
} catch (Throwable ex) {
Log.e(ex);
return null;
}
}
@Override
public ActionMode startActionMode(ActionMode.Callback callback, int type) {
try {
return super.startActionMode(callback, type);
} catch (Throwable ex) {
Log.e(ex);
return null;
}
}
@Override
public void setText(CharSequence text, BufferType type) {
try {