mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 18:48:31 +00:00
Auto download inline images on show images
This commit is contained in:
parent
cd1d89a7d3
commit
e7ea4ca015
1 changed files with 29 additions and 0 deletions
|
@ -1596,6 +1596,35 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putSerializable("message", message);
|
args.putSerializable("message", message);
|
||||||
bodyTask.execute(context, owner, args, "message:body");
|
bodyTask.execute(context, owner, args, "message:body");
|
||||||
|
|
||||||
|
// Download inline images
|
||||||
|
new SimpleTask<Void>() {
|
||||||
|
@Override
|
||||||
|
protected Void onExecute(Context context, Bundle args) {
|
||||||
|
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
|
||||||
|
|
||||||
|
DB db = DB.getInstance(context);
|
||||||
|
try {
|
||||||
|
db.beginTransaction();
|
||||||
|
|
||||||
|
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||||
|
for (EntityAttachment attachment : attachments)
|
||||||
|
if (!attachment.available && !TextUtils.isEmpty(attachment.cid))
|
||||||
|
EntityOperation.queue(context, db, message, EntityOperation.ATTACHMENT, attachment.sequence);
|
||||||
|
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
|
Helper.unexpectedError(context, owner, ex);
|
||||||
|
}
|
||||||
|
}.execute(context, owner, args, "show:images");
|
||||||
}
|
}
|
||||||
|
|
||||||
private SimpleTask<SpannableStringBuilder> bodyTask = new SimpleTask<SpannableStringBuilder>() {
|
private SimpleTask<SpannableStringBuilder> bodyTask = new SimpleTask<SpannableStringBuilder>() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue