GithubHelp home page GithubHelp logo

amrdeveloper / treeview Goto Github PK

View Code? Open in Web Editor NEW
169.0 5.0 21.0 2.37 MB

Multi roots TreeView :palm_tree: implementation for Android Platform with a lot of options and customization

Home Page: https://amrdeveloper.github.io/TreeView/

License: MIT License

Java 100.00%
treeview java kotlin android-library android-treeview androidtreeview

treeview's People

Contributors

amrdeveloper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

treeview's Issues

How to set Custom magin to every child layout?

First of all congratulations to the dev for making this great easy to use TreeView library 👏.
Describe the solution you'd like
My feature request is about to get a set margin option in TreeNode by default for each child layout. As you did in example projects extended custom class with TreeNode, i also tried the same to set my custom margin method but it didn't work for me. So if you make a default margin option in TreeNode it will be easy for noob devs like me.

Child nodes have incorrect level/depth

Describe the bug
Child nodes have incorrect depth if they tree is constructed from bottom up with more then 3 levels.
Sample tree:

graph TD
0_lvl_0-->0-0_lvl_1
0-0_lvl_1-->0-0-0_lvl_2
0-0_lvl_1-->0-0-1_lvl_2
0-0-0_lvl_2-->0-0-0-0_lvl_3
0-0-0_lvl_2-->0-0-0-1_lvl_3

Actual levels of nodes (ignore incorrect parent of 0-0-0-0 and 0-0-0-1):

graph TD
0_lvl_0-->0-0_lvl_1
0-0_lvl_1-->0-0-0_lvl_2
0-0_lvl_1-->0-0-1_lvl_2
0-0_lvl_1-->0-0-0-0_lvl_2
0-0_lvl_1-->0-0-0-1_lvl_2

Problem is caused by the fact that node level update is done only for first level of children when node is added as child to another node, but it should be done recursively.

Easy solution would be to update child levels whenever node level is changed via setLevel.

To Reproduce
Steps to reproduce the behavior:

  1. Create 4 level treenode hierarchy.
  2. Check node level of 4th level leaf node.
  3. Reported level should be 3 but will be 2.

Expected behavior
When adding node as child all it's children should have level updated recursively.
Also when setting node level via setLevel all it's children level should be recursively updated.

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: API 28 emulator

Additional context
N/A

How to disable collapse?

First of all thank you for hard word this is a great component.
My question is how to prevent collapse action?.
I want to keep the ui unfolding

Node can't be reselected

Describe the bug
Node can't be selected again if it was selected and then unselected.
Issue appears to be here

if (currentSelectedNode != null) currentSelectedNode.setSelected(false);

The previously selected node is always set as unselected even if the newly selected node is the same.
I propose following change:

if (currentNode == currentSelectedNode) {
  currentSelectedNode.setSelected(!currentSelectedNode.isSelected());
} else {
  if (currentSelectedNode != null) currentSelectedNode.setSelected(false);
  currentSelectedNode = currentNode;
}

To Reproduce
Steps to reproduce the behavior:

  1. Create tree with at least one node
  2. Click on the same node 3 times
  3. The node state is unselected

Expected behavior
If user is clicking on the same node it's state should switch between selected/unselected

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: API 28 Emulator

Additional context
Workaround for this issue is to click on different node, thus breaking the loop which is keeping the node in unset state.

Use this library

Hi,
I'm a beginner in java and I would like to use this library but I don't understand how to use it. The example is half explained, for example I don't understand what are the parent and child layouts.
If you have just a working example it would help me a lot!
Thanks

Storage Folders to Adapter

How do I get all the storage folders and add them to the treeViewAdapter? I've tried all sorts of ways, but I can't.

File root = new File("/storage/emulated/0/");
for (File file : root.listFiles()) {
    TreeNode node = new TreeNode(file.getName(), R.layout.layout);
}

The problem is adding the child folders, I don't know how to do this.

Initially tree is expanded but isExpanded() is set to false leading to a minor bug

Describe the bug
When the tree is shown for the first time, it is all expanded but the treeNode class has a false set in isExpanded variable, because of this when you tap on the node it expands again replicating it's childrens.

To Reproduce
Steps to reproduce the behavior:

  1. Just create a Tree with atleast 3 child'
  2. Expand the First Node
  3. you will see duplicate child node

Expected behavior
Either the tree should be collapsed from the start or isExpanded should be set to true.

Screenshots
Screenshot_20240315-171009(marked)

Screenshot_20240315-171001

Smartphone (please complete the following information):

  • Device: Nothing Phone 1
  • OS: Android (Nothing OS)
  • Version: 14 (2.5.3)

Additional context
Add any other context about the problem here.

Highlight selected item

Hi,
thanks a lot for this useful library.
Is possible to highlight a selected item? select a single choice item.
Thanks

To link a json file to treeview automatically?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

No item click effect like RecyclerView

Describe the bug
My TreeView row using CardView, I set it to “selectableItemBackground” but no click effect work. It works fine with default RecyclerView (using same layout.xml).

To Reproduce
Steps to reproduce the behavior:

  1. Create TreeView with custom tree node view
  2. Add android:focusable="true", android:clickable="true" and android:foreground="?attr/selectableItemBackground" to custom tree node view
  3. Click on 1 tree node
  4. No click effect performed

Expected behavior
TreeView item should has ripple effect when clicked.
https://drive.google.com/file/d/116yVaXkOfKYCWkDr6ZSc7rb4KdzsEnVd/view?usp=sharing

Video
https://drive.google.com/file/d/118hr4uv6pyGhtSHLSnOu_EO6UP6h6vD8/view?usp=sharing

Smartphone (please complete the following information):

  • Device: Realme 5i
  • OS: Android 13
  • Version 1.1.3

multi-select function

Hi! First of all thank you for open source such a useful component. In the process of using it, I added the checkbox myself, and wanted to support the check function, but because of my limited level, there were many problems in the process of customization. Will the multi-select function be added in the future?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.