Added option to enable using block list

pull/199/head
M66B 3 years ago
parent 69326fb48b
commit e5474bd27f

@ -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));
}

@ -678,6 +678,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheckBlocklistHint" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUseBlocklist"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_junk_blocklist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheckBlocklistWarning"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTuneKeepAlive"
android:layout_width="0dp"
@ -687,7 +699,7 @@
android:text="@string/title_advanced_tune_keep_alive"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheckBlocklistWarning"
app:layout_constraintTop_toBottomOf="@id/swUseBlocklist"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

Loading…
Cancel
Save