{"id":13644255,"url":"https://github.com/shineM/TreeView","last_synced_at":"2025-04-21T07:30:42.084Z","repository":{"id":58205484,"uuid":"88862385","full_name":"shineM/TreeView","owner":"shineM","description":"An android tree structure view with high performance and rich features","archived":false,"fork":false,"pushed_at":"2019-09-08T02:34:12.000Z","size":9158,"stargazers_count":469,"open_issues_count":23,"forks_count":95,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-11-09T16:44:08.727Z","etag":null,"topics":["android-library","android-ui","tree-structure","treeview"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shineM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-20T12:20:06.000Z","updated_at":"2024-11-01T06:15:31.000Z","dependencies_parsed_at":"2022-08-31T01:50:21.248Z","dependency_job_id":null,"html_url":"https://github.com/shineM/TreeView","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shineM%2FTreeView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shineM%2FTreeView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shineM%2FTreeView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shineM%2FTreeView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shineM","download_url":"https://codeload.github.com/shineM/TreeView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250014556,"owners_count":21360971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-library","android-ui","tree-structure","treeview"],"created_at":"2024-08-02T01:01:59.845Z","updated_at":"2025-04-21T07:30:39.949Z","avatar_url":"https://github.com/shineM.png","language":"Java","readme":"## TreeView\nAn android tree view with high performance and rich functions \n\n[中文介绍](http://texy.me/2017/05/01/android_tree_view/)\n\n### Captures\nThere are some gifs from Demo:\n\n* Select node:\n\u003cimg src='images/show_demo_select.gif' width='240'/\u003e\n\n* Operate all:\n\u003cimg src='images/show_demo_more_featrue.gif' width='240'/\u003e\n\n### Features\n- expandAll/collapseAll\n- expandNode/collapseNode\n- expandLevel/collapseLevel\n- toggleNode\n- deleteNode/addNode\n- selectNode/deselectNode\n- selectAll/deselectAll\n- getSelectedNodes\n- refreshTreeView\n\n### Usage\n**1.Reference the library from your module's build.gradle:**\n```groovy\nimplementation 'me.texy.treeview:treeview_lib:1.0.6'\n```\n**2.Implement your all level's BaseNodeViewBinder**\n\nSample：\n```java\npublic class FirstLevelNodeViewBinder extends BaseNodeViewBinder {\n  TextView textView;\n  public FirstLevelNodeViewBinder(View itemView) { \n    super(itemView);  \n    textView = (TextView) itemView.findViewById(R.id.node_name_view)\n  }\n  \n  @Override\n  public int getLayoutId() {\n    return R.layout.item_first_level;\n  }\n  \n  @Override\n  public void bindView(TreeNode treeNode) {\n    textView.setText(treeNode.getValue().toString());\n  }\n}\n\nSecondLevelNodeViewBinder\nThirdLevelNodeViewBinder\n.\n.\n.\n```\nIf you want add the selectable feature,replace BaseNodeViewBinder with CheckableNodeViewBinder.\n\n**3.Implement the BaseNodeViewFactory**\n\nSample：\n```java\npublic class MyNodeViewFactory extends BaseNodeViewFactory {\n  @Override\n  public BaseNodeViewBinder getNodeViewBinder(View view, int level) {\n    switch (level) {\n      case 0:\n        return new FirstLevelNodeViewBinder(view);\n      case 1:\n        return new SecondLevelNodeViewBinder(view);\n      case 2:\n        return new ThirdLevelNodeViewBinder(view);\n      default:\n        return null;\n    }\n  }\n}\n```\nIf you do not want to create a class file,just implement a anonymous inner class in TreeView's constructor\n\n**4.Add TreeView to wherever you want**\n\nSample:\n```java\nTreeNode root = TreeNode.root();\n//build the tree as you want\nfor (int i = 0; i \u003c 5; i++) {\n  TreeNode treeNode = new TreeNode(new String(\"Child \" + \"No.\" + i));\n  treeNode.setLevel(0);\n  root.addChild(treeNode);\n}\nView treeView = new TreeView(root, context, new MyNodeViewFactory()).getView();\n//add to view group where you want \n```\n\n### License\n\n    Copyright 2017 shineM.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n","funding_links":[],"categories":["TreeView"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FshineM%2FTreeView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FshineM%2FTreeView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FshineM%2FTreeView/lists"}