Browse Source

Close message on moving from archive

main
M66B 6 years ago
parent
commit
36bdc2cce7
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      app/src/main/java/eu/faircode/email/FragmentMessage.java

+ 12
- 5
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -810,19 +810,23 @@ public class FragmentMessage extends FragmentEx {
args.putLong("target", target.getItemId()); args.putLong("target", target.getItemId());
new SimpleTask<Void>() {
new SimpleTask<Boolean>() {
@Override @Override
protected Void onLoad(Context context, Bundle args) {
protected Boolean onLoad(Context context, Bundle args) {
long id = args.getLong("id"); long id = args.getLong("id");
long target = args.getLong("target"); long target = args.getLong("target");
boolean close = false;
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
try { try {
db.beginTransaction(); db.beginTransaction();
EntityMessage message = db.message().getMessage(id); EntityMessage message = db.message().getMessage(id);
EntityFolder folder = db.folder().getFolder(message.folder); EntityFolder folder = db.folder().getFolder(message.folder);
if (!EntityFolder.ARCHIVE.equals(folder.type))
close = EntityFolder.ARCHIVE.equals(folder.type);
if (!close)
db.message().setMessageUiHide(message.id, true); db.message().setMessageUiHide(message.id, true);
EntityOperation.queue(db, message, EntityOperation.MOVE, target); EntityOperation.queue(db, message, EntityOperation.MOVE, target);
@ -834,12 +838,14 @@ public class FragmentMessage extends FragmentEx {
EntityOperation.process(context); EntityOperation.process(context);
return null;
return close;
} }
@Override @Override
protected void onLoaded(Bundle args, Void result) {
protected void onLoaded(Bundle args, Boolean close) {
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
if (close) // archived message
getFragmentManager().popBackStack();
} }
@Override @Override
@ -891,6 +897,7 @@ public class FragmentMessage extends FragmentEx {
@Override @Override
protected void onLoaded(Bundle args, Void result) { protected void onLoaded(Bundle args, Void result) {
getFragmentManager().popBackStack();
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
} }


Loading…
Cancel
Save