From ba116353d90b0bbd5441db0e44309e9fb0ff5390 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 2 Feb 2019 08:43:32 +0000 Subject: [PATCH] Use trash if no archive for right swipe target --- .../main/java/eu/faircode/email/FragmentAccount.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 22aa1231f1..cb7705e49b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -1397,6 +1397,14 @@ public class FragmentAccount extends FragmentBase { Long left = (account == null ? null : account.swipe_left); Long right = (account == null ? null : account.swipe_right); + String leftDefault = EntityFolder.TRASH; + String rightDefault = EntityFolder.TRASH; + for (EntityFolder folder : folders) + if (EntityFolder.ARCHIVE.equals(folder.type)) { + rightDefault = folder.type; + break; + } + for (int pos = 0; pos < folders.size(); pos++) { EntityFolder folder = folders.get(pos); @@ -1411,10 +1419,10 @@ public class FragmentAccount extends FragmentBase { else if (EntityFolder.JUNK.equals(folder.type)) spJunk.setSelection(pos); - if (left == null ? (account == null && EntityFolder.TRASH.equals(folder.type)) : left.equals(folder.id)) + if (left == null ? (account == null && leftDefault.equals(folder.type)) : left.equals(folder.id)) spLeft.setSelection(pos); - if (right == null ? (account == null && EntityFolder.ARCHIVE.equals(folder.type)) : right.equals(folder.id)) + if (right == null ? (account == null && rightDefault.equals(folder.type)) : right.equals(folder.id)) spRight.setSelection(pos); }