Search in sources :

Example 11 with TreeNode

use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.

the class SelectableTreeFragment method fillFolder.

private void fillFolder(TreeNode folder) {
    TreeNode file1 = new TreeNode("File1").setViewHolder(new SelectableItemHolder(getActivity()));
    TreeNode file2 = new TreeNode("File2").setViewHolder(new SelectableItemHolder(getActivity()));
    TreeNode file3 = new TreeNode("File3").setViewHolder(new SelectableItemHolder(getActivity()));
    folder.addChildren(file1, file2, file3);
}
Also used : SelectableItemHolder(com.unnamed.b.atv.sample.holder.SelectableItemHolder) TreeNode(com.unnamed.b.atv.model.TreeNode)

Example 12 with TreeNode

use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.

the class TwoDScrollingArrowExpandFragment method fillFolder.

private void fillFolder(TreeNode folder) {
    TreeNode currentNode = folder;
    for (int i = 0; i < 4; i++) {
        TreeNode file = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, NAME + " " + i));
        currentNode.addChild(file);
        currentNode = file;
    }
}
Also used : TreeNode(com.unnamed.b.atv.model.TreeNode) IconTreeItemHolder(com.unnamed.b.atv.sample.holder.IconTreeItemHolder)

Example 13 with TreeNode

use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.

the class TwoDScrollingArrowExpandFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_selectable_nodes, null, false);
    rootView.findViewById(R.id.status).setVisibility(View.GONE);
    ViewGroup containerView = (ViewGroup) rootView.findViewById(R.id.container);
    TreeNode root = TreeNode.root();
    TreeNode s1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Folder with very long name ")).setViewHolder(new ArrowExpandSelectableHeaderHolder(getActivity()));
    TreeNode s2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Another folder with very long name")).setViewHolder(new ArrowExpandSelectableHeaderHolder(getActivity()));
    fillFolder(s1);
    fillFolder(s2);
    root.addChildren(s1, s2);
    tView = new AndroidTreeView(getActivity(), root);
    tView.setDefaultAnimation(true);
    tView.setUse2dScroll(true);
    tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
    tView.setDefaultNodeClickListener(TwoDScrollingArrowExpandFragment.this);
    tView.setDefaultViewHolder(ArrowExpandSelectableHeaderHolder.class);
    containerView.addView(tView.getView());
    tView.setUseAutoToggle(false);
    tView.expandAll();
    if (savedInstanceState != null) {
        String state = savedInstanceState.getString("tState");
        if (!TextUtils.isEmpty(state)) {
            tView.restoreState(state);
        }
    }
    return rootView;
}
Also used : ArrowExpandSelectableHeaderHolder(com.unnamed.b.atv.sample.holder.ArrowExpandSelectableHeaderHolder) ViewGroup(android.view.ViewGroup) TreeNode(com.unnamed.b.atv.model.TreeNode) AndroidTreeView(com.unnamed.b.atv.view.AndroidTreeView) AndroidTreeView(com.unnamed.b.atv.view.AndroidTreeView) View(android.view.View)

Example 14 with TreeNode

use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.

the class TwoDScrollingFragment method fillFolder.

private void fillFolder(TreeNode folder) {
    TreeNode currentNode = folder;
    for (int i = 0; i < 10; i++) {
        TreeNode file = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, NAME)).setViewHolder(new SelectableHeaderHolder(getActivity()));
        currentNode.addChild(file);
        currentNode = file;
    }
}
Also used : TreeNode(com.unnamed.b.atv.model.TreeNode) SelectableHeaderHolder(com.unnamed.b.atv.sample.holder.SelectableHeaderHolder)

Example 15 with TreeNode

use of com.unnamed.b.atv.model.TreeNode in project AndroidTreeView by bmelnychuk.

the class TwoDScrollingFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_selectable_nodes, null, false);
    rootView.findViewById(R.id.status).setVisibility(View.GONE);
    ViewGroup containerView = (ViewGroup) rootView.findViewById(R.id.container);
    TreeNode root = TreeNode.root();
    TreeNode s1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Folder with very long name ")).setViewHolder(new SelectableHeaderHolder(getActivity()));
    TreeNode s2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Another folder with very long name")).setViewHolder(new SelectableHeaderHolder(getActivity()));
    fillFolder(s1);
    fillFolder(s2);
    root.addChildren(s1, s2);
    tView = new AndroidTreeView(getActivity(), root);
    tView.setDefaultAnimation(true);
    tView.setUse2dScroll(true);
    tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
    containerView.addView(tView.getView());
    tView.expandAll();
    if (savedInstanceState != null) {
        String state = savedInstanceState.getString("tState");
        if (!TextUtils.isEmpty(state)) {
            tView.restoreState(state);
        }
    }
    return rootView;
}
Also used : ViewGroup(android.view.ViewGroup) TreeNode(com.unnamed.b.atv.model.TreeNode) AndroidTreeView(com.unnamed.b.atv.view.AndroidTreeView) SelectableHeaderHolder(com.unnamed.b.atv.sample.holder.SelectableHeaderHolder) AndroidTreeView(com.unnamed.b.atv.view.AndroidTreeView) View(android.view.View)

Aggregations

TreeNode (com.unnamed.b.atv.model.TreeNode)22 View (android.view.View)10 ViewGroup (android.view.ViewGroup)6 AndroidTreeView (com.unnamed.b.atv.view.AndroidTreeView)5 TextView (android.widget.TextView)4 LayoutInflater (android.view.LayoutInflater)3 PrintView (com.github.johnkil.print.PrintView)3 IconTreeItemHolder (com.unnamed.b.atv.sample.holder.IconTreeItemHolder)3 SelectableHeaderHolder (com.unnamed.b.atv.sample.holder.SelectableHeaderHolder)3 CompoundButton (android.widget.CompoundButton)2 ScrollView (android.widget.ScrollView)2 ProfileHolder (com.unnamed.b.atv.sample.holder.ProfileHolder)2 Context (android.content.Context)1 ContextThemeWrapper (android.view.ContextThemeWrapper)1 LinearLayout (android.widget.LinearLayout)1 ArrowExpandSelectableHeaderHolder (com.unnamed.b.atv.sample.holder.ArrowExpandSelectableHeaderHolder)1 HeaderHolder (com.unnamed.b.atv.sample.holder.HeaderHolder)1 PlaceHolderHolder (com.unnamed.b.atv.sample.holder.PlaceHolderHolder)1 SelectableItemHolder (com.unnamed.b.atv.sample.holder.SelectableItemHolder)1 SocialViewHolder (com.unnamed.b.atv.sample.holder.SocialViewHolder)1