Swipe to permanently delete local drafts

pull/198/head
M66B 4 years ago
parent e451e82977
commit 8eb987ef38

@ -1924,14 +1924,21 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (EntityFolder.OUTBOX.equals(message.folderType))
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
if (message.uid == null && message.accountProtocol == EntityAccount.TYPE_IMAP)
TupleAccountSwipes swipes = accountSwipes.get(message.account);
if (swipes == null)
return 0;
if (message.folderReadOnly)
if (message.uid == null &&
message.accountProtocol == EntityAccount.TYPE_IMAP &&
EntityFolder.DRAFTS.equals(message.folderType))
return makeMovementFlags(0,
(EntityFolder.TRASH.equals(swipes.left_type) ? ItemTouchHelper.LEFT : 0) |
(EntityFolder.TRASH.equals(swipes.right_type) ? ItemTouchHelper.RIGHT : 0));
if (message.uid == null && message.accountProtocol == EntityAccount.TYPE_IMAP)
return 0;
TupleAccountSwipes swipes = accountSwipes.get(message.account);
if (swipes == null)
if (message.folderReadOnly)
return 0;
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
@ -1999,6 +2006,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return;
}
if (message.uid == null &&
message.accountProtocol == EntityAccount.TYPE_IMAP &&
EntityFolder.DRAFTS.equals(message.folderType)) {
boolean right = EntityFolder.TRASH.equals(swipes.right_type);
boolean left = EntityFolder.TRASH.equals(swipes.left_type);
swipes = new TupleAccountSwipes();
swipes.swipe_right = (right ? EntityMessage.SWIPE_ACTION_DELETE : null);
swipes.right_type = null;
swipes.swipe_left = (left ? EntityMessage.SWIPE_ACTION_DELETE : null);
swipes.left_type = null;
}
if (message.accountProtocol != EntityAccount.TYPE_IMAP) {
if (swipes.swipe_right == null)
swipes.swipe_right = EntityMessage.SWIPE_ACTION_SEEN;
@ -2123,6 +2142,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return;
}
if (message.uid == null &&
message.accountProtocol == EntityAccount.TYPE_IMAP &&
EntityFolder.DRAFTS.equals(message.folderType) &&
EntityFolder.TRASH.equals(actionType)) {
action = EntityMessage.SWIPE_ACTION_DELETE;
actionType = null;
}
Log.i("Swiped dir=" + direction + " message=" + message.id);
if (EntityMessage.SWIPE_ACTION_ASK.equals(action)) {

Loading…
Cancel
Save