dingyi222666 / TreeView

An Android TreeView with RecyclerView
Apache License 2.0
109 stars 10 forks source link

Is it not possible to drag between child nodes? #8

Closed zhengyu-android closed 1 year ago

zhengyu-android commented 1 year ago

Hello, is it not possible to drag between child nodes?

dingyi222666 commented 1 year ago

No, I’m implementing it. It’s an experimental feature.

dingyi222666 commented 1 year ago

https://github.com/dingyi222666/TreeView/commit/393831458cbf2188a7d0a010d80d06d2da4a0b43

zhengyu-android commented 1 year ago

Thank you,Is there a separate interface for refreshing nodes?

dingyi222666 commented 1 year ago

Thank you,Is there a separate interface for refreshing nodes?

What does your separate interface mean?

zhengyu-android commented 1 year ago

private fun createTree(): Tree { return Tree.createTree().apply { generator = ItemTreeNodeGenerator(item) initTree() } }

1、怎么动态添加与移除子节点 2、如何单独只刷新子节点

dingyi222666 commented 1 year ago

private fun createTree(): Tree { return Tree.createTree().apply { generator = ItemTreeNodeGenerator(item) initTree() } }

1、怎么动态添加与移除子节点 2、如何单独只刷新子节点

第一点可能比较困难,你需要对真实数据做操作后刷新。(当然也可以使用 DataSource 相关类,但是那个比较麻烦)

第二点的话你可以看这里,传的第二个参数就是子节点。

dingyi222666 commented 1 year ago

已经支持了拖动节点,故此 issue 关闭。但仍然可以继续讨论。

zhengyu-android commented 1 year ago

对真实数据做操作后刷新,如果数据量非常大会卡顿吗

dingyi222666 commented 1 year ago

默认是只刷新展开了的节点(及其往后一级),不会一次加载全部数据(除非你的全部节点都展开了)。

数据量看你的情况,这个实际上是看 RecyclerView 实际能承载的 view 数量了。

zhengyu-android commented 1 year ago

lifecycleScope.launch { binding.treeView.refresh() } 使用这个刷新吗

dingyi222666 commented 1 year ago

lifecycleScope.launch { binding.treeView.refresh() } 使用这个刷新吗

zhengyu-android commented 1 year ago

好的 谢谢你

zhengyu-android commented 1 year ago

1、如何重写点击子节点的事件 2、FATAL EXCEPTION: pool-6-thread-2 Process: com.iimt.robotarm, PID: 8582 java.util.ConcurrentModificationException at java.util.ArrayList$Itr.next(ArrayList.java:860) at java.util.AbstractList.hashCode(AbstractList.java:566) at com.iimt.robotarm.result.TreeNodeData.hashCode(Unknown Source:81) at io.github.dingyi222666.view.treeview.TreeNode.hashCode(treeNodes.kt:108)

添加很多数据的话,会这样报错
dingyi222666 commented 1 year ago
  1. 重写 TreeNodeEventListener#onClick
  2. 麻烦详细提供一下相关错误,日志,复现代码。并新开一个 issue 描述该问题
zhengyu-android commented 1 year ago

怎么拖动子节点并更新数据呢?