diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 9a28ac088f..ca53b9cc88 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 swDupMsgId; private SwitchCompat swThreadByRef; private SwitchCompat swMdn; + private SwitchCompat swAppChooser; private SwitchCompat swDeleteConfirmation; private EditText etKeywords; private SwitchCompat swTestIab; @@ -303,7 +304,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", "delete_confirmation", "global_keywords", "test_iab" + "infra", "tld_flags", "dup_msgids", "thread_byref", "mdn", "app_chooser", "delete_confirmation", "global_keywords", "test_iab" }; private final static String[] RESET_QUESTIONS = new String[]{ @@ -492,6 +493,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swDupMsgId = view.findViewById(R.id.swDupMsgId); swThreadByRef = view.findViewById(R.id.swThreadByRef); swMdn = view.findViewById(R.id.swMdn); + swAppChooser = view.findViewById(R.id.swAppChooser); swDeleteConfirmation = view.findViewById(R.id.swDeleteConfirmation); etKeywords = view.findViewById(R.id.etKeywords); swTestIab = view.findViewById(R.id.swTestIab); @@ -1859,6 +1861,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swAppChooser.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("app_chooser", checked).apply(); + } + }); + swDeleteConfirmation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -2612,6 +2621,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false)); swThreadByRef.setChecked(prefs.getBoolean("thread_byref", true)); swMdn.setChecked(prefs.getBoolean("mdn", swExperiments.isChecked())); + swAppChooser.setChecked(prefs.getBoolean("app_chooser", true)); swDeleteConfirmation.setChecked(prefs.getBoolean("delete_confirmation", true)); etKeywords.setText(prefs.getString("global_keywords", null)); swTestIab.setChecked(prefs.getBoolean("test_iab", false)); diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index b4839c9816..d1aa2927ce 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -940,14 +940,18 @@ public class Helper { } static Intent getChooser(Context context, Intent intent) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean app_chooser = prefs.getBoolean("app_chooser", true); + if (!app_chooser) + return intent; + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { PackageManager pm = context.getPackageManager(); if (pm.queryIntentActivities(intent, 0).size() == 1) return intent; - else - return Intent.createChooser(intent, context.getString(R.string.title_select_app)); - } else - return Intent.createChooser(intent, context.getString(R.string.title_select_app)); + } + + return Intent.createChooser(intent, context.getString(R.string.title_select_app)); } static void share(Context context, File file, String type, String name) { diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index d67e4deab6..8f8d6171ed 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -2283,6 +2283,18 @@ app:layout_constraintTop_toBottomOf="@id/swThreadByRef" app:switchPadding="12dp" /> + + Duplicates by message ID Thread by common reference Process MDNs + Use Android app chooser Permanent deletion confirmation If you turn this off, please do not complain if you accidentally delete messages irreversibly Global keywords