Added POP3 swipe to hide

pull/178/head
M66B 5 years ago
parent 65a056e58a
commit 31f8c14353

@ -104,6 +104,7 @@ public interface DaoAccount {
@Query("SELECT account.id" +
", account.swipe_left, l.type AS left_type, l.name AS left_name, l.color AS left_color" +
", account.swipe_right, r.type AS right_type, r.name AS right_name, r.color AS right_color" +
", account.leave_deleted" +
" FROM account" +
" LEFT JOIN folder l ON l.id = account.swipe_left" +
" LEFT JOIN folder r ON r.id = account.swipe_right" +

@ -1632,13 +1632,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (EntityFolder.OUTBOX.equals(message.folderType))
return 0;
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
TupleAccountSwipes swipes = accountSwipes.get(message.account);
if (swipes == null)
return 0;
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
int flags = 0;
if (swipes.swipe_left != null &&
(swipes.swipe_left < 0 ||
@ -1684,16 +1684,21 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message == null)
return;
TupleAccountSwipes swipes;
TupleAccountSwipes swipes = accountSwipes.get(message.account);
if (swipes == null)
return;
if (message.accountProtocol != EntityAccount.TYPE_IMAP) {
swipes = new TupleAccountSwipes();
swipes.swipe_right = FragmentAccount.SWIPE_ACTION_SEEN;
if (swipes.leave_deleted) {
if (message.ui_snoozed != null && message.ui_snoozed == Long.MAX_VALUE)
swipes.swipe_left = FragmentAccount.SWIPE_ACTION_HIDE; // show
else {
swipes.swipe_left = 0L;
swipes.left_type = EntityFolder.TRASH;
} else {
swipes = accountSwipes.get(message.account);
if (swipes == null)
return;
swipes.left_type = EntityFolder.TRASH; // hide
}
} else
swipes.swipe_left = FragmentAccount.SWIPE_ACTION_DELETE;
}
Long action = (dX > 0 ? swipes.swipe_right : swipes.swipe_left);
@ -1727,6 +1732,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
icon = R.drawable.baseline_delete_forever_24;
else
icon = EntityFolder.getIcon(dX > 0 ? swipes.right_type : swipes.left_type);
Drawable d = getResources().getDrawable(icon, getContext().getTheme()).mutate();
d.setTint(Helper.resolveColor(getContext(), android.R.attr.textColorSecondary));
@ -1777,16 +1783,22 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return;
}
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
TupleAccountSwipes swipes = accountSwipes.get(message.account);
if (swipes == null) {
adapter.notifyDataSetChanged();
return;
}
if (message.accountProtocol != EntityAccount.TYPE_IMAP) {
if (direction == ItemTouchHelper.LEFT) {
if (swipes.leave_deleted)
onActionHide(message);
else {
adapter.notifyItemChanged(pos);
onSwipeDelete(message);
}
} else
onActionSeenSelection(!message.ui_seen, message.id);
TupleAccountSwipes swipes = accountSwipes.get(message.account);
if (swipes == null) {
adapter.notifyDataSetChanged();
return;
}

@ -29,4 +29,5 @@ public class TupleAccountSwipes {
public String right_type;
public String right_name;
public Integer right_color;
public Boolean leave_deleted;
}

Loading…
Cancel
Save