mirror of https://github.com/M66B/FairEmail.git
Show image description when not showing images
This commit is contained in:
parent
655f0e3d3b
commit
a6963da515
|
@ -127,7 +127,7 @@ public class ActivityEml extends ActivityBase {
|
|||
|
||||
result.html = parts.getHtml(context);
|
||||
if (result.html != null)
|
||||
result.body = HtmlHelper.fromHtml(HtmlHelper.sanitize(context, result.html));
|
||||
result.body = HtmlHelper.fromHtml(HtmlHelper.sanitize(context, result.html, false));
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
mmessage.writeTo(bos);
|
||||
|
|
|
@ -2054,7 +2054,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
body = document.html();
|
||||
}
|
||||
|
||||
String html = HtmlHelper.sanitize(context, body);
|
||||
String html = HtmlHelper.sanitize(context, body, show_images);
|
||||
if (debug)
|
||||
html += "<pre>" + Html.escapeHtml(html) + "</pre>";
|
||||
|
||||
|
|
|
@ -2868,7 +2868,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
Spanned spannedRef = null;
|
||||
File refFile = draft.getRefFile(context);
|
||||
if (refFile.exists()) {
|
||||
String quote = HtmlHelper.sanitize(context, Helper.readText(refFile));
|
||||
String quote = HtmlHelper.sanitize(context, Helper.readText(refFile), show_images);
|
||||
Spanned spannedQuote = HtmlHelper.fromHtml(quote,
|
||||
new Html.ImageGetter() {
|
||||
@Override
|
||||
|
|
|
@ -84,7 +84,7 @@ public class HtmlHelper {
|
|||
|
||||
private static final ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||
|
||||
static String sanitize(Context context, String html) {
|
||||
static String sanitize(Context context, String html, boolean show_images) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean paranoid = prefs.getBoolean("paranoid", true);
|
||||
|
||||
|
@ -224,17 +224,25 @@ public class HtmlHelper {
|
|||
else
|
||||
table.tagName("div");
|
||||
|
||||
// Remove link tracking pixels
|
||||
if (paranoid)
|
||||
for (Element img : document.select("img"))
|
||||
if (isTrackingPixel(img)) {
|
||||
String src = img.attr("src");
|
||||
img.removeAttr("src");
|
||||
img.tagName("a");
|
||||
img.attr("href", src);
|
||||
img.appendText(context.getString(R.string.title_hint_tracking_image,
|
||||
img.attr("width"), img.attr("height")));
|
||||
// Images
|
||||
for (Element img : document.select("img")) {
|
||||
// Remove link tracking pixels
|
||||
if (paranoid && isTrackingPixel(img)) {
|
||||
String src = img.attr("src");
|
||||
img.removeAttr("src");
|
||||
img.tagName("a");
|
||||
img.attr("href", src);
|
||||
img.appendText(context.getString(R.string.title_hint_tracking_image,
|
||||
img.attr("width"), img.attr("height")));
|
||||
}
|
||||
|
||||
if (!show_images) {
|
||||
String alt = img.attr("alt");
|
||||
if (!TextUtils.isEmpty(alt)) {
|
||||
img.appendText(alt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Autolink
|
||||
final Pattern pattern = Pattern.compile(
|
||||
|
|
Loading…
Reference in New Issue