diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index cb5b348b08..71490a5723 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -236,8 +236,6 @@ public class AdapterFolder extends RecyclerView.Adapter filtered = new ArrayList<>(); for (TupleFolderEx folder : folders) - if (show_hidden || !folder.hide_seen || folder.unseen + folder.childs_unseen > 0) + if (show_hidden || !folder.isHidden()) filtered.add(folder); if (filtered.size() > 0) @@ -1591,9 +1589,11 @@ public class AdapterFolder extends RecyclerView.Adapter 0)) { parent.indentation = indentation; - result.add(parent); - if (!parent.collapsed && childs != null) - result.addAll(childs); + if (show_hidden || !parent.isHidden()) { + result.add(parent); + if (!parent.collapsed && childs != null) + result.addAll(childs); + } } } diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java index 33f21b4b56..0c43541656 100644 --- a/app/src/main/java/eu/faircode/email/DB.java +++ b/app/src/main/java/eu/faircode/email/DB.java @@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress; // https://developer.android.com/topic/libraries/architecture/room.html @Database( - version = 260, + version = 261, entities = { EntityIdentity.class, EntityAccount.class, @@ -2626,6 +2626,15 @@ public abstract class DB extends RoomDatabase { logMigration(startVersion, endVersion); db.execSQL("ALTER TABLE `rule` ADD COLUMN `daily` INTEGER NOT NULL DEFAULT 0"); } + }).addMigrations(new Migration(260, 261) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase db) { + logMigration(startVersion, endVersion); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + String startup = prefs.getString("startup", "unified"); + if (!"folders".equals(startup)) + db.execSQL("UPDATE `folder` SET `hide_seen` = 0"); + } }).addMigrations(new Migration(998, 999) { @Override public void migrate(@NonNull SupportSQLiteDatabase db) { diff --git a/app/src/main/java/eu/faircode/email/TupleFolderEx.java b/app/src/main/java/eu/faircode/email/TupleFolderEx.java index 57ee1aa748..5e235c5a16 100644 --- a/app/src/main/java/eu/faircode/email/TupleFolderEx.java +++ b/app/src/main/java/eu/faircode/email/TupleFolderEx.java @@ -63,6 +63,10 @@ public class TupleFolderEx extends EntityFolder implements Serializable { @Ignore public int childs_unseen = 0; + boolean isHidden() { + return (this.hide_seen && this.unseen + this.childs_unseen == 0); + } + @Override public boolean equals(Object obj) { if (obj instanceof TupleFolderEx) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 925c92cc5f..e9a8165dea 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1200,7 +1200,7 @@ Edit account color Hide folder Hide folder if all messages are read - Only in the folder list shown on the start screen + Only in the account and unified folder list Show in unified inbox Show in navigation menu Hide in navigation menu