diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java index 13e0716187..f651a8502e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java @@ -87,6 +87,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr private SwitchCompat swCheckMx; private SwitchCompat swCheckBlocklist; private TextView tvCheckBlocklistHint; + private SwitchCompat swUseBlocklist; private SwitchCompat swTuneKeepAlive; private Group grpExempted; @@ -96,7 +97,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr "enabled", "poll_interval", "auto_optimize", "schedule", "schedule_start", "schedule_end", "sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "gmail_thread_id", "sync_folders", "sync_shared_folders", "subscriptions", - "check_authentication", "check_reply_domain", "check_mx", "check_blocklist", "tune_keep_alive" + "check_authentication", "check_reply_domain", "check_mx", "check_blocklist", "use_blocklist", "tune_keep_alive" }; @Override @@ -144,6 +145,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr swCheckMx = view.findViewById(R.id.swCheckMx); swCheckBlocklist = view.findViewById(R.id.swCheckBlocklist); tvCheckBlocklistHint = view.findViewById(R.id.tvCheckBlocklistHint); + swUseBlocklist = view.findViewById(R.id.swUseBlocklist); swTuneKeepAlive = view.findViewById(R.id.swTuneKeepAlive); grpExempted = view.findViewById(R.id.grpExempted); @@ -343,6 +345,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("check_blocklist", checked).apply(); + swUseBlocklist.setEnabled(checked); + } + }); + + swUseBlocklist.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("use_blocklist", checked).apply(); } }); @@ -444,6 +454,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr swCheckReply.setChecked(prefs.getBoolean("check_reply_domain", true)); swCheckMx.setChecked(prefs.getBoolean("check_mx", false)); swCheckBlocklist.setChecked(prefs.getBoolean("check_blocklist", false)); + swUseBlocklist.setChecked(prefs.getBoolean("use_blocklist", false)); + swUseBlocklist.setEnabled(swCheckBlocklist.isChecked()); swTuneKeepAlive.setChecked(prefs.getBoolean("tune_keep_alive", true)); } diff --git a/app/src/main/res/layout/fragment_options_synchronize.xml b/app/src/main/res/layout/fragment_options_synchronize.xml index 518006cb77..0c035b1627 100644 --- a/app/src/main/res/layout/fragment_options_synchronize.xml +++ b/app/src/main/res/layout/fragment_options_synchronize.xml @@ -678,6 +678,18 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvCheckBlocklistHint" /> + +