mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 23:43:07 +00:00
Show number of deleted operations
This commit is contained in:
parent
155f88abd0
commit
bfbb431cff
2 changed files with 24 additions and 4 deletions
|
@ -31,6 +31,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -150,15 +151,21 @@ public class FragmentOperations extends FragmentBase {
|
|||
args.putBoolean("flag", cbFlag.isChecked());
|
||||
args.putBoolean("delete", cbDelete.isChecked());
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
new SimpleTask<Integer>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
protected void onPostExecute(Bundle args) {
|
||||
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer onExecute(Context context, Bundle args) {
|
||||
boolean error = args.getBoolean("error");
|
||||
boolean fetch = args.getBoolean("fetch");
|
||||
boolean move = args.getBoolean("move");
|
||||
boolean flag = args.getBoolean("flag");
|
||||
boolean delete = args.getBoolean("delete");
|
||||
|
||||
int deleted = 0;
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
@ -196,8 +203,10 @@ public class FragmentOperations extends FragmentBase {
|
|||
|
||||
for (EntityOperation op : ops) {
|
||||
EntityLog.log(context, "Deleting operation=" + op.id + ":" + op.name + " error=" + op.error);
|
||||
if (db.operation().deleteOperation(op.id) > 0)
|
||||
if (db.operation().deleteOperation(op.id) > 0) {
|
||||
op.cleanup(context, false);
|
||||
deleted++;
|
||||
}
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
@ -205,7 +214,17 @@ public class FragmentOperations extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Integer deleted) {
|
||||
if (deleted == null)
|
||||
deleted = -1;
|
||||
ToastEx.makeText(
|
||||
getContext(),
|
||||
getString(R.string.title_delete_operation_deleted, deleted),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -744,6 +744,7 @@
|
|||
<string name="title_delete_operation_move">Move operations</string>
|
||||
<string name="title_delete_operation_flag">Flag operations</string>
|
||||
<string name="title_delete_operation_delete">Delete operations</string>
|
||||
<string name="title_delete_operation_deleted">%1$d operations deleted</string>
|
||||
<string name="title_delete_contacts">Delete all local contacts?</string>
|
||||
<string name="title_no_operations">No pending operations</string>
|
||||
<string name="title_hint_operations">Deleting operations can result in disappearing messages and synchronization problems</string>
|
||||
|
|
Loading…
Reference in a new issue