Swipe junk to permanently delete

This commit is contained in:
M66B 2020-04-18 18:39:46 +02:00
parent 8b129b8152
commit b8a0071b93
1 changed files with 6 additions and 5 deletions

View File

@ -1628,9 +1628,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message.folderReadOnly) if (message.folderReadOnly)
return 0; return 0;
if (EntityFolder.JUNK.equals(message.folderType))
return 0;
if (EntityFolder.OUTBOX.equals(message.folderType)) if (EntityFolder.OUTBOX.equals(message.folderType))
return 0; return 0;
@ -1696,6 +1693,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
Long action = (dX > 0 ? swipes.swipe_right : swipes.swipe_left); Long action = (dX > 0 ? swipes.swipe_right : swipes.swipe_left);
String actionType = (dX > 0 ? swipes.right_type : swipes.left_type);
if (action == null) if (action == null)
return; return;
@ -1722,7 +1720,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
else if (FragmentAccount.SWIPE_ACTION_JUNK.equals(action)) else if (FragmentAccount.SWIPE_ACTION_JUNK.equals(action))
icon = R.drawable.baseline_flag_24; icon = R.drawable.baseline_flag_24;
else if (FragmentAccount.SWIPE_ACTION_DELETE.equals(action) || 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; icon = R.drawable.baseline_delete_forever_24;
else else
icon = EntityFolder.getIcon(dX > 0 ? swipes.right_type : swipes.left_type); 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); 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) { if (action == null) {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
return; return;
@ -1818,7 +1818,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
adapter.notifyItemChanged(pos); adapter.notifyItemChanged(pos);
onSwipeJunk(message); onSwipeJunk(message);
} else if (FragmentAccount.SWIPE_ACTION_DELETE.equals(action) || } 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); adapter.notifyItemChanged(pos);
onSwipeDelete(message); onSwipeDelete(message);
} else } else