Hide expander when no childs at all

This commit is contained in:
M66B
2019-06-07 18:25:32 +02:00
parent 46ae47b5c9
commit 57a9d0ae54
2 changed files with 15 additions and 3 deletions

View File

@@ -188,7 +188,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
vwLevel.setLayoutParams(lp);
ivExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */);
ivExpander.setVisibility(account < 0
ivExpander.setVisibility(account < 0 || !folder.expander
? View.GONE
: folder.child_refs != null && folder.child_refs.size() > 0
? View.VISIBLE : View.INVISIBLE);
@@ -724,7 +724,16 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}
}
hierarchical = getHierarchical(parents, 0);
boolean anyChild = false;
for (TupleFolderEx parent : parents)
if (parent.child_refs != null && parent.child_refs.size() > 0) {
anyChild = true;
break;
}
for (TupleFolderEx parent : parents)
parent.expander = anyChild;
hierarchical = getHierarchical(parents, anyChild ? 0 : 1);
}
DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new DiffCallback(items, hierarchical), false);

View File

@@ -45,7 +45,10 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
public int executing;
@Ignore
int indentation;
int indentation = 0;
@Ignore
boolean expander = true;
@Ignore
TupleFolderEx parent_ref;