Hide/seen folder in main folder list

pull/212/head
M66B 2 years ago
parent fc77f3c591
commit 15638dad2e

@ -236,8 +236,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private void bindTo(final TupleFolderEx folder) {
boolean disabled = isDisabled(folder);
boolean hide_seen = (account < 0 && !primary &&
folder.hide_seen && folder.unseen + folder.childs_unseen == 0);
int p = 0;
if (show_compact)
@ -247,7 +245,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
p = dp3;
view.setPadding(p, p, p, p);
view.setActivated(folder.tbc != null || folder.rename != null || folder.tbd != null);
view.setAlpha(folder.hide || hide_seen || disabled ? Helper.LOW_LIGHT : 1.0f);
view.setAlpha(folder.hide || folder.isHidden() || disabled ? Helper.LOW_LIGHT : 1.0f);
if (listener == null && selectedModel != null)
itemView.setBackgroundColor(
@ -1379,7 +1377,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
if (account < 0 && !primary) {
List<TupleFolderEx> 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<AdapterFolder.ViewHolder
(parent.subscribed != null && parent.subscribed) ||
(childs != null && childs.size() > 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);
}
}
}

@ -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) {

@ -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) {

@ -1200,7 +1200,7 @@
<string name="title_edit_account_color">Edit account color</string>
<string name="title_hide_folder">Hide folder</string>
<string name="title_hide_seen_folder">Hide folder if all messages are read</string>
<string name="title_hide_seen_folder_hint">Only in the folder list shown on the start screen</string>
<string name="title_hide_seen_folder_hint">Only in the account and unified folder list</string>
<string name="title_unified_folder">Show in unified inbox</string>
<string name="title_navigation_folder">Show in navigation menu</string>
<string name="title_navigation_folder_hide">Hide in navigation menu</string>

Loading…
Cancel
Save