mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +00:00
Swipe move similar messages
This commit is contained in:
parent
11a581dff8
commit
828d936325
2 changed files with 22 additions and 6 deletions
|
@ -1471,6 +1471,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, args, "message:seen");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2625,6 +2627,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
args.putLongArray("disabled", new long[]{message.folder});
|
||||
args.putLong("message", message.id);
|
||||
args.putBoolean("copy", copy);
|
||||
args.putBoolean("similar", false);
|
||||
|
||||
FragmentDialogFolder fragment = new FragmentDialogFolder();
|
||||
fragment.setArguments(args);
|
||||
|
|
|
@ -1371,10 +1371,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
args.putLongArray("disabled", new long[]{message.folder});
|
||||
args.putLong("message", message.id);
|
||||
args.putBoolean("copy", false);
|
||||
args.putBoolean("similar", true);
|
||||
|
||||
FragmentDialogFolder fragment = new FragmentDialogFolder();
|
||||
fragment.setArguments(args);
|
||||
fragment.setTargetFragment(FragmentMessages.this, FragmentMessages.REQUEST_MESSAGE_MOVE);
|
||||
fragment.setTargetFragment(FragmentMessages.this, REQUEST_MESSAGE_MOVE);
|
||||
fragment.show(getFragmentManager(), "message:move");
|
||||
}
|
||||
});
|
||||
|
@ -4073,8 +4074,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
long id = args.getLong("message");
|
||||
boolean copy = args.getBoolean("copy");
|
||||
long target = args.getLong("folder");
|
||||
boolean copy = args.getBoolean("copy");
|
||||
boolean similar = args.getBoolean("similar");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
|
@ -4084,10 +4086,21 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
if (message == null)
|
||||
return null;
|
||||
|
||||
if (copy)
|
||||
EntityOperation.queue(context, message, EntityOperation.COPY, target);
|
||||
else
|
||||
EntityOperation.queue(context, message, EntityOperation.MOVE, target);
|
||||
if (similar) {
|
||||
if (copy)
|
||||
throw new IllegalArgumentException();
|
||||
else {
|
||||
List<EntityMessage> messages = db.message().getMessageByThread(
|
||||
message.account, message.thread, threading ? null : id, message.folder);
|
||||
for (EntityMessage threaded : messages)
|
||||
EntityOperation.queue(context, threaded, EntityOperation.MOVE, target);
|
||||
}
|
||||
} else {
|
||||
if (copy)
|
||||
EntityOperation.queue(context, message, EntityOperation.COPY, target);
|
||||
else
|
||||
EntityOperation.queue(context, message, EntityOperation.MOVE, target);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue