本文整理汇总了Java中com.unnamed.b.atv.model.TreeNode类的典型用法代码示例。如果您正苦于以下问题:Java TreeNode类的具体用法?Java TreeNode怎么用?Java TreeNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TreeNode类属于com.unnamed.b.atv.model包,在下文中一共展示了TreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addGpxFile
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
public void addGpxFile(File file, MapsManager manager) {
try {
TreeNode gpxRoot = GpxUtils.gpxFile2TreeNode(file);
gpxRoot.setViewHolder(new GpxHolder(mContext, manager));
treeView.addNode(root, gpxRoot);
for (TreeNode node : gpxRoot.getChildren()) {
node.setViewHolder(new GpxHolder(mContext, manager));
for (TreeNode n : node.getChildren()) {
n.setViewHolder(new GpxHolder(mContext, manager));
}
}
} catch (Exception e) {
Log.d(TAG, "Fail to load GPX file " + file.getName());
}
}
示例2: addKmlFile
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
public void addKmlFile(File file, MapsManager manager) {
try {
// TODO temporary method to deal with kml file
GpxHolder.GpxTreeItem.Builder kml_builder = new GpxHolder.GpxTreeItem.Builder();
InputStream kmlStream = new FileInputStream(file);
TreeNode kmlRoot = new TreeNode(kml_builder
.setType(GpxHolder.ITEM_TYPE_KML)
.setIcon(GpxHolder.ITEM_ICON_GPX)
.setName(file.getName())
.setPath(file.getPath())
.setKmllayer(new KmlLayer(manager.getCurrentMap(), kmlStream, mContext))
.build());
kmlRoot.setViewHolder(new GpxHolder(mContext, manager));
treeView.addNode(root, kmlRoot);
} catch (Exception e) {
Log.d(TAG, "Fail to load GPX file " + file.getName());
}
}
示例3: collapseNode
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
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);
}
}
}
示例4: expandNode
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
public void expandNode(final TreeNode node, boolean includeSubnodes) {
node.setExpanded(true);
final TreeNode.BaseNodeViewHolder parentViewHolder = getViewHolderForNode(node);
parentViewHolder.getNodeItemsView().removeAllViews();
parentViewHolder.toggle(true);
for (final TreeNode n : node.getChildren()) {
addNode(parentViewHolder.getNodeItemsView(), n);
if (n.isExpanded() || includeSubnodes) {
expandNode(n, includeSubnodes);
}
}
if (mUseDefaultAnimation) {
expand(parentViewHolder.getNodeItemsView());
} else {
parentViewHolder.getNodeItemsView().setVisibility(View.VISIBLE);
}
}
示例5: getViewHolderForNode
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
private TreeNode.BaseNodeViewHolder getViewHolderForNode(TreeNode node) {
TreeNode.BaseNodeViewHolder viewHolder = node.getViewHolder();
if (viewHolder == null) {
try {
final Object object = defaultViewHolderClass.getConstructor(Context.class).newInstance(mContext);
viewHolder = (TreeNode.BaseNodeViewHolder) object;
node.setViewHolder(viewHolder);
} catch (Exception e) {
throw new RuntimeException("Could not instantiate class " + defaultViewHolderClass);
}
}
if (viewHolder.getContainerStyle() <= 0) {
viewHolder.setContainerStyle(containerStyle);
}
if (viewHolder.getTreeView() == null) {
viewHolder.setTreeViev(this);
}
return viewHolder;
}
示例6: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(TreeNode node, ForumItemTree value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.forum_item_default, null, false);
title = (TextView) view.findViewById(R.id.forum_item_title);
icon = (ImageView) view.findViewById(R.id.forum_item_icon);
currentValue = value;
title.setText(value.getTitle());
icon.setImageDrawable(App.getVecDrawable(context, value.getForums() == null ? R.drawable.ic_forum_go_to_topics : (node.isExpanded() ? R.drawable.ic_expand_less_black_24dp : R.drawable.ic_expand_more_black_24dp)));
if (value.getForums() == null) {
int bg = App.getDrawableResAttr(context, R.attr.count_background);
icon.setBackgroundResource(bg);
} else {
icon.setBackground(null);
}
return view;
}
示例7: showForums
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public void showForums(ForumItemTree forumRoot) {
tView = new AndroidTreeView(getContext());
root = TreeNode.root();
recourse(forumRoot, root);
tView.setRoot(root);
tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
tView.setDefaultViewHolder(DefaultForumHolder.class);
tView.setDefaultNodeClickListener(nodeClickListener);
tView.setDefaultNodeLongClickListener(nodeLongClickListener);
treeContainer.removeAllViews();
treeContainer.addView(tView.getView());
if (forumId != -1) {
scrollToForum(forumId);
forumId = -1;
}
}
示例8: addProfileData
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
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);
}
示例9: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(TreeNode node, SocialItem value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_social_node, null, false);
final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
iconView.setIconText(context.getResources().getString(value.icon));
TextView connectionsLabel = (TextView) view.findViewById(R.id.connections);
Random r = new Random();
connectionsLabel.setText(r.nextInt(150) + " connections");
TextView userNameLabel = (TextView) view.findViewById(R.id.username);
userNameLabel.setText(NAMES[r.nextInt(4)]);
TextView sizeText = (TextView) view.findViewById(R.id.size);
sizeText.setText(r.nextInt(10) + " items");
return view;
}
示例10: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(final TreeNode node, String value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_selectable_item, null, false);
tvValue = (TextView) view.findViewById(R.id.node_value);
tvValue.setText(value);
nodeSelector = (CheckBox) view.findViewById(R.id.node_selector);
nodeSelector.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
node.setSelected(isChecked);
}
});
nodeSelector.setChecked(node.isSelected());
if (node.isLastChild()) {
view.findViewById(R.id.bot_line).setVisibility(View.INVISIBLE);
}
return view;
}
示例11: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(TreeNode node, IconTreeItemHolder.IconTreeItem value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_header_node, null, false);
TextView tvValue = (TextView) view.findViewById(R.id.node_value);
tvValue.setText(value.text);
final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
iconView.setIconText(context.getResources().getString(value.icon));
arrowView = (PrintView) view.findViewById(R.id.arrow_icon);
if (node.isLeaf()) {
arrowView.setVisibility(View.INVISIBLE);
}
return view;
}
示例12: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(TreeNode node, PlaceItem value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_place_node, null, false);
TextView placeName = (TextView) view.findViewById(R.id.place_name);
placeName.setText(value.name);
Random r = new Random();
boolean like = r.nextBoolean();
PrintView likeView = (PrintView) view.findViewById(R.id.like);
likeView.setIconText(context.getString(like ? R.string.ic_thumbs_up : R.string.ic_thumbs_down));
return view;
}
示例13: expandNode
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
private void expandNode(final TreeNode node, boolean includeSubnodes) {
node.setExpanded(true);
final TreeNode.BaseNodeViewHolder parentViewHolder = getViewHolderForNode(node);
parentViewHolder.getNodeItemsView().removeAllViews();
parentViewHolder.toggle(true);
for (final TreeNode n : node.getChildren()) {
addNode(parentViewHolder.getNodeItemsView(), n);
if (n.isExpanded() || includeSubnodes) {
expandNode(n, includeSubnodes);
}
}
if (mUseDefaultAnimation) {
expand(parentViewHolder.getNodeItemsView());
} else {
parentViewHolder.getNodeItemsView().setVisibility(View.VISIBLE);
}
}
示例14: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(final TreeNode node, IconTreeItem value) {
this.node = node;
this.value = value;
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_icon_node, null, false);
tvValue = (TextView) view.findViewById(R.id.node_value);
tvValue.setText(value.text);
final ImageView iconView = (ImageView) view.findViewById(R.id.icon);
iconView.setImageResource(value.icon);
arrowView = (PrintView) view.findViewById(R.id.arrow_icon);
return view;
}
示例15: createNodeView
import com.unnamed.b.atv.model.TreeNode; //导入依赖的package包/类
@Override
public View createNodeView(TreeNode node, IconTreeItem value) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.layout_icon_node, null, false);
tvValue = (TextView) view.findViewById(R.id.node_value);
tvValue.setText(value.text);
final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
iconView.setIconText(context.getResources().getString(value.icon));
arrowView = (PrintView) view.findViewById(R.id.arrow_icon);
if (node.isLeaf()) {
arrowView.setVisibility(View.INVISIBLE);
}
return view;
}