use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.
the class AndroidTreeView method restoreNodeState.
private void restoreNodeState(TreeNode node, Set<String> openNodes) {
for (TreeNode n : node.getChildren()) {
if (openNodes.contains(n.getPath())) {
expandNode(n);
restoreNodeState(n, openNodes);
}
}
}
use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.
the class AndroidTreeView method collapseNode.
private void collapseNode(TreeNode node, final boolean includeSubnodes) {
node.setExpanded(false);
TreeNode.BaseNodeViewHolder nodeViewHolder = getViewHolderForNode(node);
if (mUseDefaultAnimation) {
collapse(nodeViewHolder.getNodeItemsView());
} else {
nodeViewHolder.getNodeItemsView().setVisibility(View.GONE);
}
nodeViewHolder.toggle(false);
if (includeSubnodes) {
for (TreeNode n : node.getChildren()) {
collapseNode(n, includeSubnodes);
}
}
}
use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.
the class AndroidTreeView method addNode.
private void addNode(ViewGroup container, final TreeNode n) {
final TreeNode.BaseNodeViewHolder viewHolder = getViewHolderForNode(n);
final View nodeView = viewHolder.getView();
container.addView(nodeView);
if (mSelectionModeEnabled) {
viewHolder.toggleSelectionMode(mSelectionModeEnabled);
}
nodeView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (n.getClickListener() != null) {
n.getClickListener().onClick(n, n.getValue());
} else if (nodeClickListener != null) {
nodeClickListener.onClick(n, n.getValue());
}
if (enableAutoToggle) {
toggleNode(n);
}
}
});
nodeView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (n.getLongClickListener() != null) {
return n.getLongClickListener().onLongClick(n, n.getValue());
} else if (nodeLongClickListener != null) {
return nodeLongClickListener.onLongClick(n, n.getValue());
}
if (enableAutoToggle) {
toggleNode(n);
}
return false;
}
});
}
use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.
the class CustomViewHolderFragment method addProfileData.
private void addProfileData(TreeNode profile) {
TreeNode socialNetworks = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_people, "Social")).setViewHolder(new HeaderHolder(getActivity()));
TreeNode places = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_place, "Places")).setViewHolder(new HeaderHolder(getActivity()));
TreeNode facebook = new TreeNode(new SocialViewHolder.SocialItem(R.string.ic_post_facebook)).setViewHolder(new SocialViewHolder(getActivity()));
TreeNode linkedin = new TreeNode(new SocialViewHolder.SocialItem(R.string.ic_post_linkedin)).setViewHolder(new SocialViewHolder(getActivity()));
TreeNode google = new TreeNode(new SocialViewHolder.SocialItem(R.string.ic_post_gplus)).setViewHolder(new SocialViewHolder(getActivity()));
TreeNode twitter = new TreeNode(new SocialViewHolder.SocialItem(R.string.ic_post_twitter)).setViewHolder(new SocialViewHolder(getActivity()));
TreeNode lake = new TreeNode(new PlaceHolderHolder.PlaceItem("A rose garden")).setViewHolder(new PlaceHolderHolder(getActivity()));
TreeNode mountains = new TreeNode(new PlaceHolderHolder.PlaceItem("The white house")).setViewHolder(new PlaceHolderHolder(getActivity()));
places.addChildren(lake, mountains);
socialNetworks.addChildren(facebook, google, twitter, linkedin);
profile.addChildren(socialNetworks, places);
}
use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.
the class FolderStructureFragment method fillDownloadsFolder.
private void fillDownloadsFolder(TreeNode node) {
TreeNode downloads = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Downloads" + (counter++)));
node.addChild(downloads);
if (counter < 5) {
fillDownloadsFolder(downloads);
}
}
Aggregations