1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 03:05:31 +00:00

Added options to disable asking for showing images / original messages

This commit is contained in:
M66B 2021-10-27 09:10:40 +02:00
parent b6359b0485
commit c06518608b
4 changed files with 58 additions and 5 deletions

View file

@ -4167,7 +4167,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean current = properties.getValue(full ? "full" : "images", message.id);
boolean asked = properties.getValue(full ? "full_asked" : "images_asked", message.id);
boolean confirm = prefs.getBoolean(full ? "confirm_html" : "confirm_images", true);
if (current || asked || !confirm) {
boolean ask = prefs.getBoolean(full ? "ask_html" : "ask_images", true);
if (current || asked || !confirm || !ask) {
if (current && message.from != null) {
SharedPreferences.Editor editor = prefs.edit();
for (Address sender : message.from) {

View file

@ -63,8 +63,10 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private SwitchCompat swCheckLinksDbl;
private SwitchCompat swBrowseLinks;
private SwitchCompat swConfirmImages;
private SwitchCompat swAskImages;
private SwitchCompat swHtmlImages;
private SwitchCompat swConfirmHtml;
private SwitchCompat swAskHtml;
private SwitchCompat swDisableTracking;
private SwitchCompat swHideTimeZone;
private Button btnPin;
@ -92,7 +94,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "check_links_dbl", "browse_links",
"confirm_images", "html_always_images", "confirm_html",
"confirm_images", "ask_images", "html_always_images", "confirm_html", "ask_html",
"disable_tracking", "hide_timezone",
"pin", "biometrics", "biometrics_timeout", "autolock",
"client_id", "display_hidden", "incognito_keyboard", "secure",
@ -114,8 +116,10 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swCheckLinksDbl = view.findViewById(R.id.swCheckLinksDbl);
swBrowseLinks = view.findViewById(R.id.swBrowseLinks);
swConfirmImages = view.findViewById(R.id.swConfirmImages);
swAskImages = view.findViewById(R.id.swAskImages);
swHtmlImages = view.findViewById(R.id.swHtmlImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
swAskHtml = view.findViewById(R.id.swAskHtml);
swDisableTracking = view.findViewById(R.id.swDisableTracking);
swHideTimeZone = view.findViewById(R.id.swHideTimeZone);
btnPin = view.findViewById(R.id.btnPin);
@ -174,6 +178,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_images", checked).apply();
swAskImages.setEnabled(checked);
}
});
swAskImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("ask_images", checked).apply();
}
});
@ -188,6 +200,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_html", checked).apply();
swAskHtml.setEnabled(checked);
}
});
swAskHtml.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("ask_html", checked).apply();
}
});
@ -431,8 +451,12 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swBrowseLinks.setChecked(prefs.getBoolean("browse_links", false));
swBrowseLinks.setEnabled(!swConfirmLinks.isChecked());
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));
swAskImages.setChecked(prefs.getBoolean("ask_images", true));
swAskImages.setEnabled(swConfirmImages.isChecked());
swHtmlImages.setChecked(prefs.getBoolean("html_always_images", false));
swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true));
swAskHtml.setChecked(prefs.getBoolean("ask_html", true));
swAskHtml.setEnabled(swConfirmHtml.isChecked());
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", true));

View file

@ -137,6 +137,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmImages" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAskImages"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_ask_images"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmImagesHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlImages"
android:layout_width="0dp"
@ -145,7 +158,7 @@
android:text="@string/title_ask_show_html_images"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmImagesHint"
app:layout_constraintTop_toBottomOf="@+id/swAskImages"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
@ -173,6 +186,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmHtml" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAskHtml"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_ask_html"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmHtmlHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDisableTracking"
android:layout_width="0dp"
@ -182,7 +208,7 @@
android:text="@string/title_advanced_tracking"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmHtmlHint"
app:layout_constraintTop_toBottomOf="@+id/swAskHtml"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View file

@ -588,8 +588,10 @@
<string name="title_advanced_confirm_links">Confirm opening links</string>
<string name="title_advanced_check_links_dbl">Check domain block lists for suspicious links</string>
<string name="title_advanced_browse_links">Delegate opening links to Android</string>
<string name="title_advanced_confirm_images">Confirm showing images</string>
<string name="title_advanced_confirm_images">Show no images by default</string>
<string name="title_advanced_ask_images">Confirm showing images</string>
<string name="title_advanced_confirm_html">Show reformatted messages by default</string>
<string name="title_advanced_ask_html">Confirm showing original messages</string>
<string name="title_advanced_tracking">Attempt to recognize and disable tracking images</string>
<string name="title_advanced_hide_timezone">Send messages without timezone data</string>
<string name="title_advanced_client_id">Send app name and version to email server</string>