Hide expander when no childs at all

pull/156/head
M66B 5 years ago
parent 46ae47b5c9
commit 57a9d0ae54

@ -188,7 +188,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
vwLevel.setLayoutParams(lp); vwLevel.setLayoutParams(lp);
ivExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */); ivExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */);
ivExpander.setVisibility(account < 0 ivExpander.setVisibility(account < 0 || !folder.expander
? View.GONE ? View.GONE
: folder.child_refs != null && folder.child_refs.size() > 0 : folder.child_refs != null && folder.child_refs.size() > 0
? View.VISIBLE : View.INVISIBLE); ? 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); DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new DiffCallback(items, hierarchical), false);

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

Loading…
Cancel
Save