From 9dbb3de5980828012c59cd4e8a72da5020251e54 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 10 Feb 2019 18:08:59 +0000 Subject: [PATCH] Allow deleting operations in debug builds --- .../eu/faircode/email/AdapterOperation.java | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterOperation.java b/app/src/main/java/eu/faircode/email/AdapterOperation.java index 5954c94895..e7eb4391f6 100644 --- a/app/src/main/java/eu/faircode/email/AdapterOperation.java +++ b/app/src/main/java/eu/faircode/email/AdapterOperation.java @@ -49,7 +49,7 @@ public class AdapterOperation extends RecyclerView.Adapter all = new ArrayList<>(); private List filtered = new ArrayList<>(); - public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { + public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private View itemView; private TextView tvFolder; private TextView tvMessage; @@ -70,10 +70,14 @@ public class AdapterOperation extends RecyclerView.Adapter() { + @Override + protected Void onExecute(Context context, Bundle args) { + long id = args.getLong("id"); + long folder = args.getLong("folder"); + DB db = DB.getInstance(context); + db.operation().deleteOperation(id); + db.folder().setFolderError(folder, null); + return null; + } + + @Override + protected void onException(Bundle args, Throwable ex) { + Helper.unexpectedError(context, owner, ex); + } + }.execute(context, owner, args, "operation:delete"); + + return true; + } } AdapterOperation(Context context, LifecycleOwner owner) {