mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-28 00:20:50 +01:00
Show embedded images after confirmation only
This commit is contained in:
@@ -726,29 +726,30 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
||||
float scale = context.getResources().getDisplayMetrics().density;
|
||||
int px = (int) (48 * scale + 0.5f);
|
||||
|
||||
if (source != null && source.startsWith("cid")) {
|
||||
String[] cids = source.split(":");
|
||||
if (cids.length > 1) {
|
||||
String cid = "<" + cids[1] + ">";
|
||||
EntityAttachment attachment = DB.getInstance(context).attachment().getAttachment(message.id, cid);
|
||||
if (attachment == null || !attachment.available) {
|
||||
Drawable d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
|
||||
d.setBounds(0, 0, px, px);
|
||||
return d;
|
||||
} else {
|
||||
File file = EntityAttachment.getFile(context, attachment.id);
|
||||
Drawable d = Drawable.createFromPath(file.getAbsolutePath());
|
||||
if (d == null) {
|
||||
d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
|
||||
if (properties.showImages(message.id)) {
|
||||
// Embedded images
|
||||
if (source != null && source.startsWith("cid")) {
|
||||
String[] cids = source.split(":");
|
||||
if (cids.length > 1) {
|
||||
String cid = "<" + cids[1] + ">";
|
||||
EntityAttachment attachment = DB.getInstance(context).attachment().getAttachment(message.id, cid);
|
||||
if (attachment == null || !attachment.available) {
|
||||
Drawable d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
|
||||
d.setBounds(0, 0, px, px);
|
||||
} else
|
||||
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
||||
return d;
|
||||
return d;
|
||||
} else {
|
||||
File file = EntityAttachment.getFile(context, attachment.id);
|
||||
Drawable d = Drawable.createFromPath(file.getAbsolutePath());
|
||||
if (d == null) {
|
||||
d = context.getResources().getDrawable(R.drawable.baseline_warning_24, context.getTheme());
|
||||
d.setBounds(0, 0, px, px);
|
||||
} else
|
||||
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (properties.showImages(message.id)) {
|
||||
// Get cache folder
|
||||
File dir = new File(context.getCacheDir(), "images");
|
||||
dir.mkdir();
|
||||
|
||||
Reference in New Issue
Block a user