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 (leave_deleted) {
new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
message.ui_hide = true;
}
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
@ -3648,7 +3653,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageFound(id, false);
// Prevent new message notification on undo
db.message().setMessageUiIgnored(id, true);
db.message().setMessageLastAttempt(id, now);
db.setTransactionSuccessful();
} finally {
@ -3801,7 +3805,6 @@ public class FragmentMessages extends FragmentBase
message.ui_busy = null;
db.message().setMessageUiBusy(message.id, message.ui_busy);
db.message().setMessageLastAttempt(id, null);
EntityOperation.queue(context, message, EntityOperation.DELETE);
db.setTransactionSuccessful();
@ -3827,7 +3830,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageUiHide(id, false);
db.message().setMessageUiBusy(id, null);
db.message().setMessageLastAttempt(id, null);
db.setTransactionSuccessful();
} finally {
@ -8233,6 +8235,20 @@ public class FragmentMessages extends FragmentBase
args.putParcelableArrayList("result", result);
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
protected Void onExecute(Context context, Bundle args) {
ArrayList<MessageTarget> result = args.getParcelableArrayList("result");
@ -8253,7 +8269,6 @@ public class FragmentMessages extends FragmentBase
db.message().setMessageFound(target.id, false);
// Prevent new message notification on undo
db.message().setMessageUiIgnored(target.id, true);
db.message().setMessageLastAttempt(target.id, now);
}
db.setTransactionSuccessful();
@ -8307,7 +8322,6 @@ public class FragmentMessages extends FragmentBase
Log.i("Move id=" + target.id + " target=" + target.targetFolder.name);
db.message().setMessageUiBusy(target.id, null);
db.message().setMessageLastAttempt(target.id, null);
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().setMessageUiHide(target.id, false);
db.message().setMessageFound(target.id, target.found);
db.message().setMessageLastAttempt(target.id, null);
}
db.setTransactionSuccessful();

Loading…
Cancel
Save