Added option to disable image placeholders

This commit is contained in:
M66B
2020-11-16 09:45:21 +01:00
parent ef2f2ca99e
commit 3e9b60d433
5 changed files with 52 additions and 8 deletions

View File

@@ -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')