diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 8f513d14a3..4dced1a2cb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -240,6 +240,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swNativeDkim; private SwitchCompat swNativeArc; private EditText etNativeArcWhitelist; + private SwitchCompat swEasyCorrect; private SwitchCompat swInfra; private SwitchCompat swTldFlags; private SwitchCompat swDupMsgId; @@ -310,7 +311,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "max_backoff_power", "logarithmic_backoff", "exact_alarms", "native_dkim", "native_arc", "native_arc_whitelist", - "infra", "tld_flags", "dup_msgids", "thread_byref", "mdn", "app_chooser", "delete_confirmation", "global_keywords", "test_iab" + "easy_correct", "infra", "tld_flags", "dup_msgids", "thread_byref", "mdn", "app_chooser", "delete_confirmation", "global_keywords", "test_iab" }; private final static String[] RESET_QUESTIONS = new String[]{ @@ -499,6 +500,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swNativeDkim = view.findViewById(R.id.swNativeDkim); swNativeArc = view.findViewById(R.id.swNativeArc); etNativeArcWhitelist = view.findViewById(R.id.etNativeArcWhitelist); + swEasyCorrect = view.findViewById(R.id.swEasyCorrect); swInfra = view.findViewById(R.id.swInfra); swTldFlags = view.findViewById(R.id.swTldFlags); swDupMsgId = view.findViewById(R.id.swDupMsgId); @@ -1881,6 +1883,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swEasyCorrect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("easy_correct", checked).apply(); + } + }); + swInfra.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -2697,6 +2706,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swNativeArc.setChecked(prefs.getBoolean("native_arc", true)); etNativeArcWhitelist.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked()); etNativeArcWhitelist.setText(prefs.getString("native_arc_whitelist", null)); + swEasyCorrect.setChecked(prefs.getBoolean("easy_correct", false)); swInfra.setChecked(prefs.getBoolean("infra", false)); swTldFlags.setChecked(prefs.getBoolean("tld_flags", false)); swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false)); diff --git a/app/src/main/java/eu/faircode/email/SuggestionSpanEx.java b/app/src/main/java/eu/faircode/email/SuggestionSpanEx.java index b19b75e774..1bca769fde 100644 --- a/app/src/main/java/eu/faircode/email/SuggestionSpanEx.java +++ b/app/src/main/java/eu/faircode/email/SuggestionSpanEx.java @@ -20,11 +20,14 @@ package eu.faircode.email; */ import android.content.Context; +import android.content.SharedPreferences; import android.graphics.Color; import android.os.Build; import android.text.TextPaint; import android.text.style.SuggestionSpan; +import androidx.preference.PreferenceManager; + import java.lang.reflect.Field; public class SuggestionSpanEx extends SuggestionSpan { @@ -34,14 +37,23 @@ public class SuggestionSpanEx extends SuggestionSpan { private final int underlineThickness; public SuggestionSpanEx(Context context, String description, String[] suggestions, boolean misspelled) { - super(context, suggestions, - misspelled || Build.VERSION.SDK_INT < Build.VERSION_CODES.S - ? SuggestionSpan.FLAG_MISSPELLED - : SuggestionSpan.FLAG_GRAMMAR_ERROR); + super(context, suggestions, 0); + + int flags = (misspelled || Build.VERSION.SDK_INT < Build.VERSION_CODES.S + ? SuggestionSpan.FLAG_MISSPELLED + : SuggestionSpan.FLAG_GRAMMAR_ERROR); + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean easy_correct = prefs.getBoolean("easy_correct", false); + if (easy_correct) + flags |= SuggestionSpan.FLAG_EASY_CORRECT; + + this.setFlags(flags); + this.description = description; highlightColor = Helper.resolveColor(context, android.R.attr.textColorHighlight); - underlineColor = (misspelled ? Color.RED : highlightColor); - underlineThickness = Helper.dp2pixels(context, misspelled ? 2 : 2); + underlineColor = (BuildConfig.DEBUG ? Color.MAGENTA : (misspelled ? Color.RED : highlightColor)); + underlineThickness = Helper.dp2pixels(context, misspelled ? 2 : (BuildConfig.DEBUG ? 1 : 2)); } public String getDescription() { diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index fe5d12a20f..da95236836 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -2066,6 +2066,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swNativeArc" /> + + Use exact timers Native DKIM verification Native ARC verification + Easy correct Show infrastructure Show TLD flags Duplicates by message ID