Added option to enable/disable DMARC viewer

This commit is contained in:
M66B 2023-08-27 17:21:47 +02:00
parent 5be2874179
commit 7afa991080
3 changed files with 23 additions and 1 deletions

View File

@ -243,6 +243,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swMdn;
private SwitchCompat swAppChooser;
private SwitchCompat swDeleteConfirmation;
private SwitchCompat swDmarcViewer;
private EditText etKeywords;
private SwitchCompat swTestIab;
private Button btnImportProviders;
@ -497,6 +498,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swMdn = view.findViewById(R.id.swMdn);
swAppChooser = view.findViewById(R.id.swAppChooser);
swDeleteConfirmation = view.findViewById(R.id.swDeleteConfirmation);
swDmarcViewer = view.findViewById(R.id.swDmarcViewer);
etKeywords = view.findViewById(R.id.etKeywords);
swTestIab = view.findViewById(R.id.swTestIab);
btnImportProviders = view.findViewById(R.id.btnImportProviders);
@ -1889,6 +1891,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swDmarcViewer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
Helper.enableComponent(compoundButton.getContext(), ActivityDmarc.class, checked);
}
});
etKeywords.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -2642,6 +2651,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swMdn.setChecked(prefs.getBoolean("mdn", swExperiments.isChecked()));
swAppChooser.setChecked(prefs.getBoolean("app_chooser", false));
swDeleteConfirmation.setChecked(prefs.getBoolean("delete_confirmation", true));
swDmarcViewer.setChecked(Helper.isComponentEnabled(getContext(), ActivityDmarc.class));
etKeywords.setText(prefs.getString("global_keywords", null));
swTestIab.setChecked(prefs.getBoolean("test_iab", false));

View File

@ -2332,6 +2332,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDeleteConfirmation" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDmarcViewer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_dmarc_viewer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDeleteConfirmationHint"
app:switchPadding="12dp" />
<EditText
android:id="@+id/etKeywords"
android:layout_width="0dp"
@ -2342,7 +2353,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDeleteConfirmationHint" />
app:layout_constraintTop_toBottomOf="@id/swDmarcViewer" />
<TextView
android:id="@+id/tvKeywordsHint"

View File

@ -906,6 +906,7 @@
<string name="title_advanced_app_chooser" translatable="false">Use Android app chooser</string>
<string name="title_advanced_delete_confirmation" translatable="false">Permanent deletion confirmation</string>
<string name="title_advanced_deletion_confirmation_hint" translatable="false">If you turn this off, please do not complain if you accidentally delete messages irreversibly</string>
<string name="title_advanced_dmarc_viewer" translatable="false">DMARC viewer</string>
<string name="title_advanced_global_keywords" translatable="false">Global keywords</string>
<string name="title_advanced_test_iab" translatable="false">Test IAB</string>
<string name="title_advanced_import_providers" translatable="false">Import providers</string>