Block all network when showing original messages without showing images

This commit is contained in:
M66B 2019-07-08 13:49:31 +02:00
parent f39d973b1f
commit 7d4810ceae
2 changed files with 11 additions and 10 deletions

View File

@ -3629,6 +3629,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
settings.setDefaultFontSize(Math.round(textSize));
settings.setDefaultFixedFontSize(Math.round(textSize));
settings.setLoadsImagesAutomatically(show_images || inline);
settings.setBlockNetworkLoads(!show_images);
settings.setBlockNetworkImage(!show_images);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);

View File

@ -337,16 +337,8 @@ public class HtmlHelper {
Log.i("Image show=" + show + " inline=" + inline +
" embedded=" + embedded + " data=" + data + " source=" + source);
if (!(show || (inline && (embedded || data)))) {
// Show placeholder icon
int resid = (embedded || data ? R.drawable.baseline_photo_library_24 : R.drawable.baseline_image_24);
Drawable d = res.getDrawable(resid, theme);
d.setBounds(0, 0, px, px);
return d;
}
// Embedded images
if (embedded) {
if (embedded && (show || inline)) {
DB db = DB.getInstance(context);
String cid = "<" + source.substring(4) + ">";
EntityAttachment attachment = db.attachment().getAttachment(id, cid);
@ -377,7 +369,7 @@ public class HtmlHelper {
}
// Data URI
if (data)
if (data && (show || inline))
try {
return getDataDrawable(res, source);
} catch (IllegalArgumentException ex) {
@ -387,6 +379,14 @@ public class HtmlHelper {
return d;
}
if (!show) {
// Show placeholder icon
int resid = (embedded || data ? R.drawable.baseline_photo_library_24 : R.drawable.baseline_image_24);
Drawable d = res.getDrawable(resid, theme);
d.setBounds(0, 0, px, px);
return d;
}
// Get cache file name
File dir = new File(context.getCacheDir(), "images");
if (!dir.exists())