From 3980cd6dd3bdb4d5b4e2fa6b7bf02b4c1a186fe5 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 21 Oct 2018 14:23:48 +0000 Subject: [PATCH] Check swipe target --- app/src/main/java/eu/faircode/email/FragmentMessages.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 9ea2c4d6..5447e121 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -338,7 +338,10 @@ public class FragmentMessages extends FragmentEx { EntityMessage message = db.message().getMessage(id); EntityFolder folder = db.folder().getFolder(message.folder); - if (swipeTarget < 0 || direction == ItemTouchHelper.LEFT) { + if (swipeTarget >= 0 && direction == ItemTouchHelper.RIGHT) + target = db.folder().getFolder(swipeTarget); + + if (target == null || !target.account.equals((message.account))) { if (EntityFolder.ARCHIVE.equals(folder.type) || EntityFolder.TRASH.equals(folder.type)) target = db.folder().getFolderByType(message.account, EntityFolder.INBOX); else { @@ -349,8 +352,6 @@ public class FragmentMessages extends FragmentEx { if (target == null) target = db.folder().getFolderByType(message.account, EntityFolder.INBOX); } - } else { - target = db.folder().getFolder(swipeTarget); } result.target = target.name;