mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 13:24:52 +02:00
Debug: skip action mode
This commit is contained in:
@@ -20,6 +20,7 @@ package eu.faircode.email;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
@@ -32,6 +33,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.widget.AppCompatEditText;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class FixedEditText extends AppCompatEditText {
|
||||
public FixedEditText(@NonNull Context context) {
|
||||
@@ -274,6 +276,8 @@ public class FixedEditText extends AppCompatEditText {
|
||||
@Override
|
||||
public ActionMode startActionMode(ActionMode.Callback callback) {
|
||||
try {
|
||||
if (skipActionMode())
|
||||
return null;
|
||||
return super.startActionMode(callback);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
@@ -285,6 +289,8 @@ public class FixedEditText extends AppCompatEditText {
|
||||
public ActionMode startActionMode(ActionMode.Callback callback, int type) {
|
||||
try {
|
||||
// callback class: android.widget.Editor$TextActionModeCallback
|
||||
if (skipActionMode())
|
||||
return null;
|
||||
return super.startActionMode(callback, type);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
@@ -292,6 +298,20 @@ public class FixedEditText extends AppCompatEditText {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean skipActionMode() {
|
||||
try {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
if (!prefs.contains("skip_action_mode")) {
|
||||
if ("fuxi_eea".equals(Build.PRODUCT) && Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU)
|
||||
return true;
|
||||
}
|
||||
return prefs.getBoolean("skip_action_mode", false);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
|
||||
Reference in New Issue
Block a user