{"id":22928975,"url":"https://github.com/jakebonk/draggabletreeview","last_synced_at":"2025-09-13T08:36:50.297Z","repository":{"id":144186907,"uuid":"94965898","full_name":"jakebonk/DraggableTreeView","owner":"jakebonk","description":"TreeView with drag and drop (n-th level)","archived":false,"fork":false,"pushed_at":"2017-06-26T19:05:00.000Z","size":118,"stargazers_count":102,"open_issues_count":2,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-01T07:56:10.911Z","etag":null,"topics":["android","custom-view","drag-and-drop","java","nestedscrollview","tree-view"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakebonk.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,"governance":null}},"created_at":"2017-06-21T05:23:10.000Z","updated_at":"2025-01-19T22:01:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"3312adb9-52d5-4a4a-b1b9-c7d5f96097a4","html_url":"https://github.com/jakebonk/DraggableTreeView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jakebonk/DraggableTreeView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebonk%2FDraggableTreeView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebonk%2FDraggableTreeView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebonk%2FDraggableTreeView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebonk%2FDraggableTreeView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakebonk","download_url":"https://codeload.github.com/jakebonk/DraggableTreeView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebonk%2FDraggableTreeView/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274939618,"owners_count":25377848,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","custom-view","drag-and-drop","java","nestedscrollview","tree-view"],"created_at":"2024-12-14T09:28:36.035Z","updated_at":"2025-09-13T08:36:50.269Z","avatar_url":"https://github.com/jakebonk.png","language":"Java","readme":"[![](https://jitpack.io/v/jakebonk/DraggableTreeView.svg)](https://jitpack.io/#jakebonk/DraggableTreeView)\n\n# DraggableTreeView\nDraggableTreeView is a custom view that mimics a Tree View directory and also implements drag and drop. The tree view can go to the n-th level by default there is no limit.\n\n## Example\n\n![Basic Example](https://thumbs.gfycat.com/ConfusedPerkyDwarfmongoose-size_restricted.gif)\n\n## Download library with Jitpack.io\nAdd this to your build.gradle file for your app.\n\n```java\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n```\n\nAdd this to your dependencies in build.gradle for your project.\n\n```java\n\tdependencies {\n\t        compile 'com.github.jakebonk:DraggableTreeView:1.0.1'\n\t}\n```\n  \n  ## Usage\n  \n  DraggableTreeView is organized by a custom adapter called TreeViewAdapter, I included a Simple implementation of the adapter class called SimpleTreeViewAdapter. \n\n```java\n      DraggableTreeView draggableTreeView = (DraggableTreeView)findViewById(R.id.dtv);\n      TreeNode root = new TreeNode(this);\n      TreeNode item = new TreeNode(\"Item 1\");\n      TreeNode item2 = new TreeNode(\"Item 2\");\n\n      TreeNode subitem = new TreeNode(\"Sub Item 2\");\n      subitem.addChild(new TreeNode(\"Sub Sub Item 1\"));\n      item.addChild(subitem);\n      item.addChild(new TreeNode(\"Sub Item 1\"));\n      root.addChild(new TreeNode(\"Item 3\"));\n      root.addChild(new TreeNode(\"Item 4\"));\n      root.addChild(new TreeNode(\"Item 5\"));\n      root.addChild(new TreeNode(\"Item 6\"));\n      root.addChild(new TreeNode(\"Item 7\"));\n      root.addChild(new TreeNode(\"Item 8\"));\n      root.addChild(new TreeNode(\"Item 9\"));\n      root.addChild(new TreeNode(\"Item 10\"));\n      root.addChild(new TreeNode(\"Item 11\"));\n      root.addChild(new TreeNode(\"Item 12\"));\n      root.addChild(item2);\n      root.addChild(item);\n      SimpleTreeViewAdapter adapter = new SimpleTreeViewAdapter(this,root);\n      draggableTreeView.setAdapter(adapter);\n```\n\nYou can also change both the succesful placeholder as well as the bad placeholder by passing a view through the function \n\n```java\n      adapter.setBadPlaceholder(view);\n```\nor\n```java\n      adapter.setPlaceholder(view);      \n```\n\nBy assigning the variable maxLevel a value you can define how many levels the tree view can drag to.\n```java\n      draggableTreeView.maxLevels = 4;     \n```\n\n## Callback functions\n\nThere are three call back functions that can be used, onStartDrag, onChangedPosition, and onEndDrag to use it simply call setOnDragItemListener\n\nExample:\n```java\n\tdraggableTreeView.setOnDragItemListener(new DraggableTreeView.DragItemCallback() {\n            @Override\n            public void onStartDrag(View item, TreeNode node) {\n                Log.e(\"start\",(String)node.getData());\n            }\n\n            @Override\n            public void onChangedPosition(View item, TreeNode child, TreeNode parent, int position) {\n                Log.e(\"changed\",(String)parent.getData()+\" \u003e \"+(String)child.getData()+\":\"+String.valueOf(position));\n            }\n\n            @Override\n            public void onEndDrag(View item, TreeNode child, TreeNode parent, int position) {\n                Log.e(\"end\",(String)parent.getData()+\" \u003e \"+(String)child.getData()+\":\"+String.valueOf(position));\n            }\n        });\n```\n\n\n\n  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakebonk%2Fdraggabletreeview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakebonk%2Fdraggabletreeview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakebonk%2Fdraggabletreeview/lists"}