diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java
index df51b197dd..757e46adc9 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptions.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java
@@ -87,7 +87,8 @@ public class FragmentOptions extends FragmentBase {
"message_zoom", "overview_mode", "addresses", "attachments_alt", "thumbnails",
"contrast", "monospaced", "monospaced_pre",
"text_color", "text_size", "text_font", "text_align", "text_separators",
- "inline_images", "collapse_quotes", "seekbar", "actionbar", "actionbar_color", "navbar_colorize",
+ "collapse_quotes", "image_placeholders", "inline_images",
+ "seekbar", "actionbar", "actionbar_color", "navbar_colorize",
"autoscroll", "swipenav", "swipe_close", "swipe_move", "autoexpand", "autoclose", "onclose",
"language_detection",
"quick_filter", "quick_scroll",
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
index 22ef8d668f..8aac3b4cd7 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
@@ -126,6 +126,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swTextAlign;
private SwitchCompat swTextSeparators;
private SwitchCompat swCollapseQuotes;
+ private SwitchCompat swImagesPlaceholders;
private SwitchCompat swImagesInline;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swThumbnails;
@@ -145,7 +146,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"addresses",
"message_zoom", "overview_mode", "contrast", "monospaced", "monospaced_pre",
"text_color", "text_size", "text_font", "text_align", "text_separators",
- "inline_images", "collapse_quotes", "attachments_alt", "thumbnails",
+ "collapse_quotes", "image_placeholders", "inline_images", "attachments_alt", "thumbnails",
"parse_classes", "authentication"
};
@@ -221,6 +222,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swTextAlign = view.findViewById(R.id.swTextAlign);
swTextSeparators = view.findViewById(R.id.swTextSeparators);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
+ swImagesPlaceholders = view.findViewById(R.id.swImagesPlaceholders);
swImagesInline = view.findViewById(R.id.swImagesInline);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swThumbnails = view.findViewById(R.id.swThumbnails);
@@ -770,6 +772,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
+ swImagesPlaceholders.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("image_placeholders", checked).apply();
+ }
+ });
+
swImagesInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -968,6 +977,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swTextAlign.setChecked(prefs.getBoolean("text_align", true));
swTextSeparators.setChecked(prefs.getBoolean("text_separators", false));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
+ swImagesPlaceholders.setChecked(prefs.getBoolean("image_placeholders", true));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));
diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java
index 82aa6a1ef4..7d669d094b 100644
--- a/app/src/main/java/eu/faircode/email/HtmlHelper.java
+++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java
@@ -370,6 +370,7 @@ public class HtmlHelper {
boolean parse_classes = prefs.getBoolean("parse_classes", true);
boolean inline_images = prefs.getBoolean("inline_images", false);
boolean text_separators = prefs.getBoolean("text_separators", false);
+ boolean image_placeholders = prefs.getBoolean("image_placeholders", true);
int textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
@@ -959,6 +960,10 @@ public class HtmlHelper {
img.remove();
continue;
}
+ if (!show_images && !image_placeholders) {
+ img.removeAttr("src");
+ continue;
+ }
if (alt.length() > MAX_ALT)
alt = alt.substring(0, MAX_ALT) + "…";
@@ -2288,11 +2293,13 @@ public class HtmlHelper {
break;
case "img":
String src = element.attr("src");
- Drawable d = (imageGetter == null
- ? context.getDrawable(R.drawable.twotone_broken_image_24)
- : imageGetter.getDrawable(src));
- ssb.insert(start, "\uFFFC"); // Object replacement character
- setSpan(ssb, new ImageSpan(d, src), start, start + 1);
+ if (!TextUtils.isEmpty(src)) {
+ Drawable d = (imageGetter == null
+ ? context.getDrawable(R.drawable.twotone_broken_image_24)
+ : imageGetter.getDrawable(src));
+ ssb.insert(start, "\uFFFC"); // Object replacement character
+ setSpan(ssb, new ImageSpan(d, src), start, start + 1);
+ }
break;
case "li":
if (start == 0 || ssb.charAt(start - 1) != '\n')
diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml
index 9f2145bad6..cc537cfdcd 100644
--- a/app/src/main/res/layout/fragment_options_display.xml
+++ b/app/src/main/res/layout/fragment_options_display.xml
@@ -1007,6 +1007,30 @@
app:layout_constraintTop_toBottomOf="@id/swTextSeparators"
app:switchPadding="12dp" />
+
+
+
+
Use text alignment
Use separator lines
Collapse quoted text
+ Show image placeholders
Automatically show inline images
Show relative conversation position with a dot
Show conversation action bar
@@ -572,6 +573,7 @@
Only available when message text has been downloaded
Scrolling can be slow due to a bug in some Android versions when the number of lines is more than one
This can result in very small fonts
+ This applies to reformatted messages only
Inline images are images included in the message
This will more accurately display messages, but possibly with a delay