Simplify workaround

pull/215/head
M66B 6 months ago
parent 8d46dbab13
commit 4245956835

@ -3632,6 +3632,11 @@ public class FragmentMessages extends FragmentBase
if (delete_asked) { if (delete_asked) {
if (leave_deleted) { if (leave_deleted) {
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
message.ui_hide = true;
}
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id"); long id = args.getLong("id");
@ -3648,7 +3653,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageFound(id, false); db.message().setMessageFound(id, false);
// Prevent new message notification on undo // Prevent new message notification on undo
db.message().setMessageUiIgnored(id, true); db.message().setMessageUiIgnored(id, true);
db.message().setMessageLastAttempt(id, now);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
@ -3801,7 +3805,6 @@ public class FragmentMessages extends FragmentBase
message.ui_busy = null; message.ui_busy = null;
db.message().setMessageUiBusy(message.id, message.ui_busy); db.message().setMessageUiBusy(message.id, message.ui_busy);
db.message().setMessageLastAttempt(id, null);
EntityOperation.queue(context, message, EntityOperation.DELETE); EntityOperation.queue(context, message, EntityOperation.DELETE);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
@ -3827,7 +3830,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageUiHide(id, false); db.message().setMessageUiHide(id, false);
db.message().setMessageUiBusy(id, null); db.message().setMessageUiBusy(id, null);
db.message().setMessageLastAttempt(id, null);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
@ -8233,6 +8235,20 @@ public class FragmentMessages extends FragmentBase
args.putParcelableArrayList("result", result); args.putParcelableArrayList("result", result);
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
AdapterMessage adapter = (rvMessage == null ? null : (AdapterMessage) rvMessage.getAdapter());
if (adapter == null)
return;
ArrayList<MessageTarget> result = args.getParcelableArrayList("result");
for (MessageTarget target : result) {
TupleMessageEx message = adapter.getItemForKey(target.id);
if (message != null)
message.ui_hide = true;
}
}
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
ArrayList<MessageTarget> result = args.getParcelableArrayList("result"); ArrayList<MessageTarget> result = args.getParcelableArrayList("result");
@ -8253,7 +8269,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageFound(target.id, false); db.message().setMessageFound(target.id, false);
// Prevent new message notification on undo // Prevent new message notification on undo
db.message().setMessageUiIgnored(target.id, true); db.message().setMessageUiIgnored(target.id, true);
db.message().setMessageLastAttempt(target.id, now);
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
@ -8307,7 +8322,6 @@ public class FragmentMessages extends FragmentBase
Log.i("Move id=" + target.id + " target=" + target.targetFolder.name); Log.i("Move id=" + target.id + " target=" + target.targetFolder.name);
db.message().setMessageUiBusy(target.id, null); db.message().setMessageUiBusy(target.id, null);
db.message().setMessageLastAttempt(target.id, null);
EntityOperation.queue(context, message, EntityOperation.MOVE, target.targetFolder.id); EntityOperation.queue(context, message, EntityOperation.MOVE, target.targetFolder.id);
} }
@ -8341,7 +8355,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageUiBusy(target.id, null); db.message().setMessageUiBusy(target.id, null);
db.message().setMessageUiHide(target.id, false); db.message().setMessageUiHide(target.id, false);
db.message().setMessageFound(target.id, target.found); db.message().setMessageFound(target.id, target.found);
db.message().setMessageLastAttempt(target.id, null);
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();

Loading…
Cancel
Save