Added DNS blocklist check

This commit is contained in:
M66B
2021-06-19 10:00:38 +02:00
parent fd8cb3f68a
commit eae08d5e29
9 changed files with 2732 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ import android.app.TimePickerDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -84,6 +85,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
private SwitchCompat swCheckAuthentication;
private SwitchCompat swCheckReply;
private SwitchCompat swCheckMx;
private SwitchCompat swCheckBlocklist;
private TextView tvCheckBlocklistHint;
private SwitchCompat swTuneKeepAlive;
private Group grpExempted;
@@ -93,7 +96,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", "tune_keep_alive"
"check_authentication", "check_reply_domain", "check_mx", "check_blocklist", "tune_keep_alive"
};
@Override
@@ -139,6 +142,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swCheckAuthentication = view.findViewById(R.id.swCheckAuthentication);
swCheckReply = view.findViewById(R.id.swCheckReply);
swCheckMx = view.findViewById(R.id.swCheckMx);
swCheckBlocklist = view.findViewById(R.id.swCheckBlocklist);
tvCheckBlocklistHint = view.findViewById(R.id.tvCheckBlocklistHint);
swTuneKeepAlive = view.findViewById(R.id.swTuneKeepAlive);
grpExempted = view.findViewById(R.id.grpExempted);
@@ -334,6 +339,13 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
}
});
swCheckBlocklist.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("check_blocklist", checked).apply();
}
});
swTuneKeepAlive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -359,6 +371,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
}
});
tvCheckBlocklistHint.setText(TextUtils.join(",", DnsBlockList.DEFAULT_BLOCKLISTS));
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;
@@ -429,6 +442,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swCheckAuthentication.setChecked(prefs.getBoolean("check_authentication", true));
swCheckReply.setChecked(prefs.getBoolean("check_reply_domain", true));
swCheckMx.setChecked(prefs.getBoolean("check_mx", false));
swCheckBlocklist.setChecked(prefs.getBoolean("check_blocklist", false));
swTuneKeepAlive.setChecked(prefs.getBoolean("tune_keep_alive", true));
}