mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 13:47:05 +02:00
Added auto block junk senders
This commit is contained in:
@@ -64,6 +64,7 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
||||
final ImageButton ibMore = view.findViewById(R.id.ibMore);
|
||||
final TextView tvMore = view.findViewById(R.id.tvMore);
|
||||
final Button btnEditRules = view.findViewById(R.id.btnEditRules);
|
||||
final CheckBox cbJunkAuto = view.findViewById(R.id.cbJunkAuto);
|
||||
final CheckBox cbJunkFilter = view.findViewById(R.id.cbJunkFilter);
|
||||
final ImageButton ibInfoFilter = view.findViewById(R.id.ibInfoFilter);
|
||||
final CheckBox cbBlocklist = view.findViewById(R.id.cbBlocklist);
|
||||
@@ -73,6 +74,7 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
||||
final Group grpMore = view.findViewById(R.id.grpMore);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean auto_junk = prefs.getBoolean("auto_junk", false);
|
||||
boolean check_blocklist = prefs.getBoolean("check_blocklist", false);
|
||||
boolean use_blocklist = prefs.getBoolean("use_blocklist", false);
|
||||
|
||||
@@ -88,7 +90,7 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
||||
cbBlockSender.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
cbBlockDomain.setEnabled(isChecked);
|
||||
cbBlockDomain.setEnabled(isChecked && ActivityBilling.isPro(context));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -156,6 +158,13 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
||||
}
|
||||
});
|
||||
|
||||
cbJunkAuto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
prefs.edit().putBoolean("auto_junk", isChecked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
cbJunkFilter.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
@@ -241,9 +250,10 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
||||
tvMessage.setText(inJunk
|
||||
? getString(R.string.title_folder_junk)
|
||||
: getString(R.string.title_ask_spam_who, from));
|
||||
cbBlockSender.setEnabled(canBlock && ActivityBilling.isPro(context));
|
||||
cbBlockSender.setEnabled(canBlock);
|
||||
cbBlockDomain.setEnabled(false);
|
||||
ibMore.setImageLevel(1);
|
||||
cbJunkAuto.setChecked(auto_junk);
|
||||
cbBlocklist.setChecked(check_blocklist && use_blocklist);
|
||||
tvBlocklist.setText(TextUtils.join(", ", DnsBlockList.getNamesEnabled(context)));
|
||||
grpInJunk.setVisibility(inJunk ? View.GONE : View.VISIBLE);
|
||||
@@ -256,7 +266,7 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean onExecute(Context context, Bundle args) throws Throwable {
|
||||
protected Boolean onExecute(Context context, Bundle args) {
|
||||
long aid = args.getLong("account");
|
||||
long fid = args.getLong("folder");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user