From badbd134f50c4fbd45d44064179404e49b68b353 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 14 Aug 2018 14:16:29 +0000 Subject: [PATCH] Added option to delete attachments --- .../eu/faircode/email/AdapterAttachment.java | 30 +++++++++++++++++-- .../java/eu/faircode/email/DaoAttachment.java | 3 ++ .../eu/faircode/email/FragmentCompose.java | 2 +- .../eu/faircode/email/FragmentMessage.java | 2 +- app/src/main/res/layout/item_attachment.xml | 12 ++++++-- 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterAttachment.java b/app/src/main/java/eu/faircode/email/AdapterAttachment.java index b62738f5..de34c2ff 100644 --- a/app/src/main/java/eu/faircode/email/AdapterAttachment.java +++ b/app/src/main/java/eu/faircode/email/AdapterAttachment.java @@ -51,6 +51,7 @@ import androidx.recyclerview.widget.RecyclerView; public class AdapterAttachment extends RecyclerView.Adapter { private Context context; private LifecycleOwner owner; + private boolean readonly; private boolean debug; private List all = new ArrayList<>(); @@ -58,6 +59,7 @@ public class AdapterAttachment extends RecyclerView.Adapter() { + @Override + protected Void onLoad(Context context, Bundle args) { + DB.getInstance(context).attachment().deleteAttachment(attachment.id); + File dir = new File(context.getFilesDir(), "attachments"); + File file = new File(dir, attachment.filename); + file.delete(); + + return null; + } + }.load(context, owner, args); + + } else { if (attachment.filename == null) { if (attachment.progress == null) { Bundle args = new Bundle(); @@ -183,12 +207,14 @@ public class AdapterAttachment extends RecyclerView.Adapter + +