Commit 9b23e92
Fix crash in TriangleCustomLayerActivity (#10399)
### Summary
Fixes https://mapbox.atlassian.net/browse/MAPSAND-2488
- Fixes a crash in `TriangleCustomLayerActivity` caused by using a
removed/incompatible layer insertion API.
### Problem
`TriangleCustomLayerActivity` crashed when adding a custom layer because
it used `addLayerBelow(CustomLayer(...), below = "building")`, which
depends on a specific layer ID (`"building"`) that may not be present in
the current style, causing a runtime crash.
### Solution
Replace `addLayerBelow` with `addLayer` using the slot-based API
(`slot("middle")`), which is the correct modern approach for inserting
custom layers at a predefined position in the style without hardcoding a
layer ID dependency.
### Key Changes
- **`TriangleCustomLayerActivity.kt`**: `addLayerBelow(CustomLayer(...),
below = "building")` → `addLayer(customLayer(...) { slot("middle") })`
- **Import**: Removed `CustomLayer` and `addLayerBelow` imports; now
uses `addLayer` and the `customLayer` DSL builder
### Validation
- [x] Activity no longer crashes when loading
- [x] Verify the custom triangle layer renders correctly at the expected
z-order in the `middle` slot
GitOrigin-RevId: 7de2a5108b26d665c4c5091bd120808a01f8ab451 parent bcd5faa commit 9b23e92
1 file changed
Lines changed: 5 additions & 5 deletions
File tree
- app/src/main/java/com/mapbox/maps/testapp/examples/customlayer
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
0 commit comments