From b8a0071b932e18f5848a6dbf3aa9d4b48c41d7b4 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 18 Apr 2020 18:39:46 +0200 Subject: [PATCH] Swipe junk to permanently delete --- .../main/java/eu/faircode/email/FragmentMessages.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 168b5d9fbc..61eb1ba1d5 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1628,9 +1628,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. if (message.folderReadOnly) return 0; - if (EntityFolder.JUNK.equals(message.folderType)) - return 0; - if (EntityFolder.OUTBOX.equals(message.folderType)) return 0; @@ -1696,6 +1693,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. } Long action = (dX > 0 ? swipes.swipe_right : swipes.swipe_left); + String actionType = (dX > 0 ? swipes.right_type : swipes.left_type); if (action == null) return; @@ -1722,7 +1720,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. else if (FragmentAccount.SWIPE_ACTION_JUNK.equals(action)) icon = R.drawable.baseline_flag_24; else if (FragmentAccount.SWIPE_ACTION_DELETE.equals(action) || - (action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType))) + (action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType)) || + (EntityFolder.TRASH.equals(actionType) && EntityFolder.JUNK.equals(message.folderType))) icon = R.drawable.baseline_delete_forever_24; else icon = EntityFolder.getIcon(dX > 0 ? swipes.right_type : swipes.left_type); @@ -1793,6 +1792,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. } Long action = (direction == ItemTouchHelper.LEFT ? swipes.swipe_left : swipes.swipe_right); + String actionType = (direction == ItemTouchHelper.LEFT ? swipes.left_type : swipes.right_type); if (action == null) { adapter.notifyDataSetChanged(); return; @@ -1818,7 +1818,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. adapter.notifyItemChanged(pos); onSwipeJunk(message); } else if (FragmentAccount.SWIPE_ACTION_DELETE.equals(action) || - (action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType))) { + (action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType)) || + (EntityFolder.TRASH.equals(actionType) && EntityFolder.JUNK.equals(message.folderType))) { adapter.notifyItemChanged(pos); onSwipeDelete(message); } else