Search in sources :

Example 1 with ArrowExpandSelectableHeaderHolder

use of com.unnamed.b.atv.sample.holder.ArrowExpandSelectableHeaderHolder 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)

Aggregations

View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 TreeNode (com.unnamed.b.atv.model.TreeNode)1 ArrowExpandSelectableHeaderHolder (com.unnamed.b.atv.sample.holder.ArrowExpandSelectableHeaderHolder)1 AndroidTreeView (com.unnamed.b.atv.view.AndroidTreeView)1