AndroidTreeView icon indicating copy to clipboard operation
AndroidTreeView copied to clipboard

Handling "click/selection" and "expansion" separately

Open wwahmed opened this issue 9 years ago • 11 comments

Imagine if the tree was used to display a list of hierarchical folders. In such a view, clicking on a node should allow us to take an action as though that node was selected, and expanding the node to show its children should only be done if the user click on an expand icon next to folder name.

The Demo Application has a Folder view demo, but that only allows clicking (selecting?) the leaf nodes. If a node has children, it cannot be selected, and only expanded.

Is there a way to achieve this effect?

wwahmed avatar Apr 26 '16 19:04 wwahmed

I think you can achieve this with treeView.setUseAutoToggle(false) and then custom click listener to the arrow just like in the sampe app ArrowExpandSelectableHeaderHolder.java

bmelnychuk avatar Apr 27 '16 15:04 bmelnychuk

@bmelnychuk Thank you for your response. I actually was hoping for such a method to exist so I could do exactly that. But TreeView does not have a method called setUseAutoToggle --- do I need to fork and create it or am I missing something?

wwahmed avatar Apr 29 '16 02:04 wwahmed

Ohh, I did not update version in central, will do asap

bmelnychuk avatar Apr 29 '16 08:04 bmelnychuk

@bmelnychuk Thanks - looking forward to new version update..Hopefully soon :)

wwahmed avatar Apr 29 '16 19:04 wwahmed

HI @bmelnychuk sorry to bug you - but just wanted to check if you had a chance to upload the latest ?

thanks

wwahmed avatar May 02 '16 14:05 wwahmed

Isn't it available in version 1.2.8?

bmelnychuk avatar May 02 '16 17:05 bmelnychuk

@bmelnychuk Does not seem to be in 1.2.8

wwahmed avatar May 02 '16 20:05 wwahmed

@bmelnychuk By the way, it does seem to be present in the latest code on Github. It just doesn't seem to be in the latest available dependency version. So it needs to be built and pushed out ?

wwahmed avatar May 02 '16 20:05 wwahmed

I will do this today

bmelnychuk avatar May 03 '16 07:05 bmelnychuk

Ok, version 1.2.9 is available, sorry for delay

bmelnychuk avatar May 04 '16 07:05 bmelnychuk

@bmelnychuk Thank you - it works as advertised now :D

wwahmed avatar May 04 '16 18:05 wwahmed