Contribute child folder unread to collapsed parent

pull/194/head
M66B 5 years ago
parent 664220a1f3
commit 7b58d770c1

@ -276,10 +276,11 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
ivNotify.setVisibility(folder.notify ? View.VISIBLE : View.GONE); ivNotify.setVisibility(folder.notify ? View.VISIBLE : View.GONE);
} }
if (folder.unseen > 0) int unseen = folder.unseen + (folder.collapsed ? folder.childs_unseen : 0);
if (unseen > 0)
tvName.setText(context.getString(R.string.title_name_count, tvName.setText(context.getString(R.string.title_name_count,
folder.getDisplayName(context, folder.parent_ref == null ? null : folder.parent_ref), folder.getDisplayName(context, folder.parent_ref == null ? null : folder.parent_ref),
NF.format(folder.unseen))); NF.format(unseen)));
else else
tvName.setText(folder.getDisplayName(context, folder.parent_ref)); tvName.setText(folder.getDisplayName(context, folder.parent_ref));
@ -1225,8 +1226,11 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
continue; continue;
List<TupleFolderEx> childs = null; List<TupleFolderEx> childs = null;
if (parent.child_refs != null) if (parent.child_refs != null) {
childs = getHierarchical(parent.child_refs, indentation + 1); childs = getHierarchical(parent.child_refs, indentation + 1);
for (TupleFolderEx child : childs)
parent.childs_unseen += child.unseen + child.childs_unseen;
}
if (!subscribed_only || if (!subscribed_only ||
parent.accountProtocol != EntityAccount.TYPE_IMAP || parent.accountProtocol != EntityAccount.TYPE_IMAP ||

@ -57,6 +57,8 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
public TupleFolderEx parent_ref; public TupleFolderEx parent_ref;
@Ignore @Ignore
public List<TupleFolderEx> child_refs; public List<TupleFolderEx> child_refs;
@Ignore
public int childs_unseen = 0;
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {

Loading…
Cancel
Save