本文整理汇总了Java中com.unnamed.b.atv.model.TreeNode.setViewHolder方法的典型用法代码示例。如果您正苦于以下问题:Java TreeNode.setViewHolder方法的具体用法?Java TreeNode.setViewHolder怎么用?Java TreeNode.setViewHolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.unnamed.b.atv.model.TreeNode
的用法示例。
在下文中一共展示了TreeNode.setViewHolder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例4: 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(new Object[]{mContext});
viewHolder = (TreeNode.BaseNodeViewHolder) object;
node.setViewHolder(viewHolder);
} catch (Exception e) {
e.printStackTrace();
}
}
if (viewHolder.getContainerStyle() <= 0) {
viewHolder.setContainerStyle(containerStyle);
}
return viewHolder;
}
示例5: fromCommentNode
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
public TreeNode fromCommentNode(CommentNode node)
{
TreeNode myNode = new TreeNode(node);
myNode.setExpanded(true);
myNode.setViewHolder(new CommentNodeViewHolder(this.context));
List<CommentNode> children = node.getChildren();
for (CommentNode child : children) {
myNode.addChild(this.fromCommentNode(child));
}
return myNode;
}
示例6: fromSubmission
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
public TreeNode fromSubmission(Submission submission)
{
TreeNode rootNode = new TreeNode(null);
TreeNode postNode = new TreeNode(submission);
postNode.setViewHolder(new SubmissionNodeViewHolder(this.context));
rootNode.addChild(postNode);
List<CommentNode> comments = submission.getComments().getChildren();
for (CommentNode comment : comments) {
rootNode.addChild(this.commentTreeNodeAdapter.fromCommentNode(comment));
}
return rootNode;
}