diff --git a/app/src/main/java/eu/faircode/email/EntityFolder.java b/app/src/main/java/eu/faircode/email/EntityFolder.java index 74e028c8ec..7af292953e 100644 --- a/app/src/main/java/eu/faircode/email/EntityFolder.java +++ b/app/src/main/java/eu/faircode/email/EntityFolder.java @@ -214,6 +214,14 @@ public class EntityFolder extends EntityOrder implements Serializable { TRASH, JUNK )); + private static final List SYSTEM_FOLDER_POLL = Collections.unmodifiableList(Arrays.asList( + false, // inbox + false, // drafts + false, // sent + false, // archive + true, // trash + true // junk + )); // MUST match SYSTEM_FOLDER_SYNC private static final List SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList( true, // inbox true, // drafts @@ -235,6 +243,7 @@ public class EntityFolder extends EntityOrder implements Serializable { void setProperties() { int sync = EntityFolder.SYSTEM_FOLDER_SYNC.indexOf(type); this.synchronize = (sync >= 0); + this.poll = (sync < 0 || EntityFolder.SYSTEM_FOLDER_POLL.get(sync)); this.download = (sync < 0 || EntityFolder.SYSTEM_FOLDER_DOWNLOAD.get(sync)); this.sync_days = EntityFolder.DEFAULT_SYNC; @@ -251,6 +260,11 @@ public class EntityFolder extends EntityOrder implements Serializable { } } + static boolean shouldPoll(String type) { + int sync = EntityFolder.SYSTEM_FOLDER_SYNC.indexOf(type); + return (sync < 0 || EntityFolder.SYSTEM_FOLDER_POLL.get(sync)); + } + static EntityFolder getOutbox() { EntityFolder outbox = new EntityFolder(); outbox.name = "OUTBOX"; diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index f85920ad9e..f730cada2f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -1164,28 +1164,28 @@ public class FragmentAccount extends FragmentBase { if (drafts != null) { drafts.type = EntityFolder.DRAFTS; - drafts.poll = false; + drafts.poll = EntityFolder.shouldPoll(drafts.type); folders.add(drafts); } if (sent != null) { sent.type = EntityFolder.SENT; - sent.poll = false; + sent.poll = EntityFolder.shouldPoll(sent.type); folders.add(sent); } if (archive != null) { archive.type = EntityFolder.ARCHIVE; - archive.poll = false; + archive.poll = EntityFolder.shouldPoll(archive.type); folders.add(archive); } if (trash != null) { trash.type = EntityFolder.TRASH; - trash.poll = false; + trash.poll = EntityFolder.shouldPoll(trash.type); folders.add(trash); } if (junk != null) { junk.type = EntityFolder.JUNK; - junk.poll = false; + junk.poll = EntityFolder.shouldPoll(junk.type); folders.add(junk); }