Hide in unified folder list if all messages are read

pull/207/head
M66B 3 years ago
parent 1ee4717659
commit a40aa805ac

@ -226,7 +226,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private void bindTo(final TupleFolderEx folder) {
boolean disabled = isDisabled(folder);
boolean hide_seen = (folder.hide_seen && folder.unseen + folder.childs_unseen == 0);
boolean hide_seen = (account < 0 && !primary &&
folder.hide_seen && folder.unseen + folder.childs_unseen == 0);
int p = (show_compact && all.size() < DENSE_ITEMS_THRESHOLD ? dp3 : 0);
view.setPadding(p, p, p, p);
@ -1265,9 +1266,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 ||
(folder.hide_seen && folder.unseen + folder.childs_unseen == 0)))
if (show_hidden || !folder.hide_seen || folder.unseen + folder.childs_unseen > 0)
filtered.add(folder);
if (filtered.size() > 0)
@ -1473,9 +1472,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}
}
if (parent.hide_seen && parent.unseen + parent.childs_unseen == 0 && !show_hidden)
continue;
if (!subscribed_only ||
EntityFolder.INBOX.equals(parent.type) ||
parent.accountProtocol != EntityAccount.TYPE_IMAP ||
@ -1533,9 +1529,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
while (p1 != null && p2 != null) {
if (p1.hide != p2.hide)
return false;
if ((p1.hide_seen && p1.unseen + p1.childs_unseen == 0) !=
(p2.hide_seen && p2.unseen + p2.childs_unseen == 0))
return false;
if (p1.collapsed != p2.collapsed)
return false;

@ -2305,7 +2305,6 @@ public abstract class DB extends RoomDatabase {
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `hide_seen` INTEGER NOT NULL DEFAULT 0");
db.execSQL("UPDATE `folder` SET hide = 0 WHERE unified");
}
}).addMigrations(new Migration(230, 231) {
@Override

@ -118,6 +118,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHide" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvHideSeenHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_hide_seen_folder_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHideSeen" />
<CheckBox
android:id="@+id/cbUnified"
android:layout_width="wrap_content"
@ -125,7 +137,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_unified_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHideSeen" />
app:layout_constraintTop_toBottomOf="@id/tvHideSeenHint" />
<CheckBox
android:id="@+id/cbNavigation"

@ -1065,6 +1065,7 @@
<string name="title_edit_account_name">Edit account name</string>
<string name="title_hide_folder">Hide folder</string>
<string name="title_hide_seen_folder">Hide if all messages are read</string>
<string name="title_hide_seen_folder_hint">Only in the unified folder list shown on the start screen</string>
<string name="title_unified_folder">Show in unified inbox</string>
<string name="title_navigation_folder">Show in navigation menu</string>
<string name="title_synchronize_folder">Synchronize (receive messages)</string>

Loading…
Cancel
Save