diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index b442de6f98..92374822ff 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -52,6 +52,7 @@ import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -474,6 +475,7 @@ public class AdapterFolder extends RecyclerView.Adapter() { + @Override + protected void onPreExecute(Bundle args) { + ToastEx.makeText(context, R.string.title_executing, Toast.LENGTH_LONG).show(); + } + + @Override + protected Void onExecute(Context context, Bundle args) throws Throwable { + long id = args.getLong("id"); + + DB db = DB.getInstance(context); + EntityFolder folder = db.folder().getFolder(id); + if (folder == null) + return null; + + EntityOperation.queue(context, folder, EntityOperation.EXPUNGE); + return null; + } + + @Override + protected void onException(Bundle args, Throwable ex) { + Log.unexpectedError(parentFragment.getParentFragmentManager(), ex); + } + }.execute(context, owner, args, "folder:expunge"); + } + private void onActionEmpty(String type) { Bundle aargs = new Bundle(); if (EntityFolder.TRASH.equals(type)) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index de8ced4c26..19f43aad2a 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -203,7 +203,8 @@ class Core { !EntityOperation.FETCH.equals(op.name) && !EntityOperation.SYNC.equals(op.name) && !EntityOperation.SUBSCRIBE.equals(op.name) && - !EntityOperation.PURGE.equals(op.name)) + !EntityOperation.PURGE.equals(op.name) && + !EntityOperation.EXPUNGE.equals(op.name)) throw new MessageRemovedException(); // Process similar operations diff --git a/app/src/main/java/eu/faircode/email/FragmentOperations.java b/app/src/main/java/eu/faircode/email/FragmentOperations.java index 1e0828950a..a40db74e8d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOperations.java +++ b/app/src/main/java/eu/faircode/email/FragmentOperations.java @@ -198,6 +198,7 @@ public class FragmentOperations extends FragmentBase { if (delete) { addAll(ops, db.operation().getOperations(EntityOperation.DELETE)); addAll(ops, db.operation().getOperations(EntityOperation.PURGE)); + addAll(ops, db.operation().getOperations(EntityOperation.EXPUNGE)); } for (EntityOperation op : ops) { diff --git a/app/src/main/res/layout/dialog_delete_operations.xml b/app/src/main/res/layout/dialog_delete_operations.xml index bc56f37634..33fbd3c44c 100644 --- a/app/src/main/res/layout/dialog_delete_operations.xml +++ b/app/src/main/res/layout/dialog_delete_operations.xml @@ -109,7 +109,7 @@ android:layout_height="wrap_content" android:layout_marginStart="48dp" android:fontFamily="monospace" - android:text="DELETE, PURGE" + android:text="DELETE, PURGE, EXPUNGE" android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textSize="12sp" app:layout_constraintStart_toStartOf="parent"