mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2026-06-19 19:00:14 +02:00
Add the `android` target to the Compose Multiplatform library and a sensible
default renderer, so the largest Compose audience is a first-class consumer.
- Core `tree-structure` and `tree-structure-compose` now build and publish an
`-android` variant (compileSdk 35, minSdk 21). The core needs it too: its
inline `tree { }` DSL is built per target, and Android consumers (JVM 11/17)
cannot inline a JVM-21 build.
- `TreeNodeRow`: a foundation-only default node row (clickable, indented, with a
`▾`/`▸` marker, no Material dependency), plus a no-content `LazyTree(root,
label = …)` overload that uses it. The existing lambda overload is unchanged.
- New `samples` Android app module demonstrating `LazyTree` + `@Preview`
(not published; excluded from API validation).
- Toolchain: Gradle wrapper 8.5 -> 8.10.2, Android Gradle Plugin 8.7.2.
- binary-compatibility-validator now emits per-target dumps (api/jvm, api/android)
for the two multi-JVM-target modules; CI assembles the Android outputs.
This commit is contained in:
19
README.md
19
README.md
@@ -16,7 +16,7 @@ usually a better fit.
|
||||
|
||||
## Features
|
||||
|
||||
- Kotlin Multiplatform: JVM, JS, Wasm, iOS, and a native host target.
|
||||
- Kotlin Multiplatform: JVM, Android, JS, Wasm, iOS, and a native host target.
|
||||
- Build trees with a `tree { child(...) }` DSL or node by node with `addChild`.
|
||||
- Pre-order, post-order, and level-order traversal, as iterators or lazy `Sequence`s.
|
||||
- Navigation: `root()`, `ancestors()`, `siblings()`, `leaves()`, `descendants()`, `isLeaf`, `degree`.
|
||||
@@ -181,12 +181,23 @@ root.asFlow(TreeNodeIterators.LevelOrder).map { it.value }
|
||||
|
||||
### Compose UI (`tree-structure-compose`)
|
||||
|
||||
A `LazyTree` composable for Compose Multiplatform (JVM/desktop, iOS, Wasm). Only the visible nodes
|
||||
are composed, and you decide how each node looks:
|
||||
A `LazyTree` composable for Compose Multiplatform (JVM/desktop, Android, iOS, Wasm). Only the visible
|
||||
nodes are composed.
|
||||
|
||||
```kotlin
|
||||
implementation("com.github.adriankuta:tree-structure-compose:4.1.1")
|
||||
```
|
||||
|
||||
For the common case, the no-content overload renders each node with the built-in `TreeNodeRow`
|
||||
(a clickable, indented row with a `▾`/`▸` marker — foundation-only, no Material dependency):
|
||||
|
||||
```kotlin
|
||||
LazyTree(root) // sensible default
|
||||
LazyTree(root, label = { it.name }) // map a node's value to its text
|
||||
```
|
||||
|
||||
Or supply your own row for full control:
|
||||
|
||||
```kotlin
|
||||
LazyTree(root) { node, depth, expanded, toggle ->
|
||||
Row(Modifier.padding(start = (depth * 16).dp).clickable(onClick = toggle)) {
|
||||
@@ -196,6 +207,8 @@ LazyTree(root) { node, depth, expanded, toggle ->
|
||||
}
|
||||
```
|
||||
|
||||
A runnable Android demo lives in the [`samples-android`](samples-android) module.
|
||||
|
||||
### Immutable (`tree-structure-immutable`)
|
||||
|
||||
A persistent `ImmutableTreeNode` with structural sharing. Every operation (`addChild`,
|
||||
|
||||
Reference in New Issue
Block a user