Skip to content

Commit 4e6a7f8

Browse files
author
Seth Bourget
committed
Added feature to mask the primary route line in order to give the appearance the active leg is above the inactive legs for multi-leg routes.
1 parent a3da3ba commit 4e6a7f8

File tree

26 files changed

+2615
-361
lines changed

26 files changed

+2615
-361
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Mapbox welcomes participation and contributions from everyone.
1010
- Fixed approaches list update in `RouteOptionsUpdater`(uses for reroute). It was putting to the origin approach corresponding approach from legacy approach list. [#6540](https://github.com/mapbox/mapbox-navigation-android/pull/6540)
1111
- Updated the `MapboxRestAreaApi` logic to load a SAPA map only if the upcoming rest stop is at the current step of the route leg. [#6695](https://github.com/mapbox/mapbox-navigation-android/pull/6695)
1212
- Fixed an issue where `MapboxRerouteController` could deliver a delayed interruption state notifications. Now, the interruption state is always delivered synchronously, as soon as it's available. [#6718](https://github.com/mapbox/mapbox-navigation-android/pull/6718)
13+
- Modified the route line implementation so that for multi-leg routes the active leg appears above inactive route legs. [#6742](https://github.com/mapbox/mapbox-navigation-android/pull/6742)
1314

1415
## Mapbox Navigation SDK 2.9.5 - 13 December, 2022
1516
### Changelog

instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/ui/routeline/RouteLineLayersTest.kt

Lines changed: 106 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -98,84 +98,102 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
9898
"background"
9999
)
100100
)
101-
102101
assertEquals(
103102
"mapbox-layerGroup-1-restricted",
104103
style.styleLayers[topLevelRouteLayerIndex - 1].id
105104
)
106105
assertEquals(
107-
"mapbox-layerGroup-1-traffic",
106+
"mapbox-masking-layer-traffic",
108107
style.styleLayers[topLevelRouteLayerIndex - 2].id
109108
)
110109
assertEquals(
111-
"mapbox-layerGroup-1-main",
110+
"mapbox-masking-layer-main",
112111
style.styleLayers[topLevelRouteLayerIndex - 3].id
113112
)
114113
assertEquals(
115-
"mapbox-layerGroup-1-casing",
114+
"mapbox-masking-layer-casing",
116115
style.styleLayers[topLevelRouteLayerIndex - 4].id
117116
)
118117
assertEquals(
119-
"mapbox-layerGroup-1-trail",
118+
"mapbox-masking-layer-trail",
120119
style.styleLayers[topLevelRouteLayerIndex - 5].id
121120
)
122121
assertEquals(
123-
"mapbox-layerGroup-1-trailCasing",
122+
"mapbox-masking-layer-trailCasing",
124123
style.styleLayers[topLevelRouteLayerIndex - 6].id
125124
)
126-
127125
assertEquals(
128-
"mapbox-layerGroup-2-restricted",
126+
"mapbox-layerGroup-1-traffic",
129127
style.styleLayers[topLevelRouteLayerIndex - 7].id
130128
)
131129
assertEquals(
132-
"mapbox-layerGroup-2-traffic",
130+
"mapbox-layerGroup-1-main",
133131
style.styleLayers[topLevelRouteLayerIndex - 8].id
134132
)
135133
assertEquals(
136-
"mapbox-layerGroup-2-main",
134+
"mapbox-layerGroup-1-casing",
137135
style.styleLayers[topLevelRouteLayerIndex - 9].id
138136
)
139137
assertEquals(
140-
"mapbox-layerGroup-2-casing",
138+
"mapbox-layerGroup-1-trail",
141139
style.styleLayers[topLevelRouteLayerIndex - 10].id
142140
)
143141
assertEquals(
144-
"mapbox-layerGroup-2-trail",
142+
"mapbox-layerGroup-1-trailCasing",
145143
style.styleLayers[topLevelRouteLayerIndex - 11].id
146144
)
147145
assertEquals(
148-
"mapbox-layerGroup-2-trailCasing",
146+
"mapbox-layerGroup-2-restricted",
149147
style.styleLayers[topLevelRouteLayerIndex - 12].id
150148
)
149+
assertEquals(
150+
"mapbox-layerGroup-2-traffic",
151+
style.styleLayers[topLevelRouteLayerIndex - 13].id
152+
)
153+
assertEquals(
154+
"mapbox-layerGroup-2-main",
155+
style.styleLayers[topLevelRouteLayerIndex - 14].id
156+
)
157+
assertEquals(
158+
"mapbox-layerGroup-2-casing",
159+
style.styleLayers[topLevelRouteLayerIndex - 15].id
160+
)
161+
assertEquals(
162+
"mapbox-layerGroup-2-trail",
163+
style.styleLayers[topLevelRouteLayerIndex - 16].id
164+
)
165+
assertEquals(
166+
"mapbox-layerGroup-2-trailCasing",
167+
style.styleLayers[topLevelRouteLayerIndex - 17].id
168+
)
151169

152170
assertEquals(
153171
"mapbox-layerGroup-3-restricted",
154-
style.styleLayers[topLevelRouteLayerIndex - 13].id
172+
style.styleLayers[topLevelRouteLayerIndex - 18].id
155173
)
156174
assertEquals(
157175
"mapbox-layerGroup-3-traffic",
158-
style.styleLayers[topLevelRouteLayerIndex - 14].id
176+
style.styleLayers[topLevelRouteLayerIndex - 19].id
159177
)
160178
assertEquals(
161179
"mapbox-layerGroup-3-main",
162-
style.styleLayers[topLevelRouteLayerIndex - 15].id
180+
style.styleLayers[topLevelRouteLayerIndex - 20].id
163181
)
164182
assertEquals(
165183
"mapbox-layerGroup-3-casing",
166-
style.styleLayers[topLevelRouteLayerIndex - 16].id
184+
style.styleLayers[topLevelRouteLayerIndex - 21].id
167185
)
168186
assertEquals(
169187
"mapbox-layerGroup-3-trail",
170-
style.styleLayers[topLevelRouteLayerIndex - 17].id
188+
style.styleLayers[topLevelRouteLayerIndex - 22].id
171189
)
172190
assertEquals(
173191
"mapbox-layerGroup-3-trailCasing",
174-
style.styleLayers[topLevelRouteLayerIndex - 18].id
192+
style.styleLayers[topLevelRouteLayerIndex - 23].id
175193
)
176194
assertEquals(
177195
"mapbox-bottom-level-route-layer",
178-
style.styleLayers[topLevelRouteLayerIndex - 19].id
196+
style.styleLayers[topLevelRouteLayerIndex - 24].id
179197
)
180198
}
181199
}
@@ -216,25 +234,45 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
216234
style.styleLayers[topLevelRouteLayerIndex - 1].id
217235
)
218236
assertEquals(
219-
"mapbox-layerGroup-1-traffic",
237+
"mapbox-masking-layer-traffic",
220238
style.styleLayers[topLevelRouteLayerIndex - 2].id
221239
)
222240
assertEquals(
223-
"mapbox-layerGroup-1-main",
241+
"mapbox-masking-layer-main",
224242
style.styleLayers[topLevelRouteLayerIndex - 3].id
225243
)
226244
assertEquals(
227-
"mapbox-layerGroup-1-casing",
245+
"mapbox-masking-layer-casing",
228246
style.styleLayers[topLevelRouteLayerIndex - 4].id
229247
)
230248
assertEquals(
231-
"mapbox-layerGroup-1-trail",
249+
"mapbox-masking-layer-trail",
232250
style.styleLayers[topLevelRouteLayerIndex - 5].id
233251
)
234252
assertEquals(
235-
"mapbox-layerGroup-1-trailCasing",
253+
"mapbox-masking-layer-trailCasing",
236254
style.styleLayers[topLevelRouteLayerIndex - 6].id
237255
)
256+
assertEquals(
257+
"mapbox-layerGroup-1-traffic",
258+
style.styleLayers[topLevelRouteLayerIndex - 7].id
259+
)
260+
assertEquals(
261+
"mapbox-layerGroup-1-main",
262+
style.styleLayers[topLevelRouteLayerIndex - 8].id
263+
)
264+
assertEquals(
265+
"mapbox-layerGroup-1-casing",
266+
style.styleLayers[topLevelRouteLayerIndex - 9].id
267+
)
268+
assertEquals(
269+
"mapbox-layerGroup-1-trail",
270+
style.styleLayers[topLevelRouteLayerIndex - 10].id
271+
)
272+
assertEquals(
273+
"mapbox-layerGroup-1-trailCasing",
274+
style.styleLayers[topLevelRouteLayerIndex - 11].id
275+
)
238276
// This mimics selecting an alternative route by making the first
239277
// alternative the primary route and the original primary route one
240278
// of the alternatives.
@@ -257,25 +295,45 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
257295
style.styleLayers[topLevelRouteLayerIndex - 1].id
258296
)
259297
assertEquals(
260-
"mapbox-layerGroup-2-traffic",
298+
"mapbox-masking-layer-traffic",
261299
style.styleLayers[topLevelRouteLayerIndex - 2].id
262300
)
263301
assertEquals(
264-
"mapbox-layerGroup-2-main",
302+
"mapbox-masking-layer-main",
265303
style.styleLayers[topLevelRouteLayerIndex - 3].id
266304
)
267305
assertEquals(
268-
"mapbox-layerGroup-2-casing",
306+
"mapbox-masking-layer-casing",
269307
style.styleLayers[topLevelRouteLayerIndex - 4].id
270308
)
271309
assertEquals(
272-
"mapbox-layerGroup-2-trail",
310+
"mapbox-masking-layer-trail",
273311
style.styleLayers[topLevelRouteLayerIndex - 5].id
274312
)
275313
assertEquals(
276-
"mapbox-layerGroup-2-trailCasing",
314+
"mapbox-masking-layer-trailCasing",
277315
style.styleLayers[topLevelRouteLayerIndex - 6].id
278316
)
317+
assertEquals(
318+
"mapbox-layerGroup-2-traffic",
319+
style.styleLayers[topLevelRouteLayerIndex - 7].id
320+
)
321+
assertEquals(
322+
"mapbox-layerGroup-2-main",
323+
style.styleLayers[topLevelRouteLayerIndex - 8].id
324+
)
325+
assertEquals(
326+
"mapbox-layerGroup-2-casing",
327+
style.styleLayers[topLevelRouteLayerIndex - 9].id
328+
)
329+
assertEquals(
330+
"mapbox-layerGroup-2-trail",
331+
style.styleLayers[topLevelRouteLayerIndex - 10].id
332+
)
333+
assertEquals(
334+
"mapbox-layerGroup-2-trailCasing",
335+
style.styleLayers[topLevelRouteLayerIndex - 11].id
336+
)
279337
countDownLatch.countDown()
280338
}
281339

@@ -332,9 +390,13 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
332390
)?.visibility
333391
)
334392
assertEquals(
335-
"mapbox-layerGroup-1-traffic",
393+
"mapbox-masking-layer-traffic",
336394
style.styleLayers[topLevelRouteLayerIndex - 1].id
337395
)
396+
assertEquals(
397+
"mapbox-layerGroup-1-traffic",
398+
style.styleLayers[topLevelRouteLayerIndex - 6].id
399+
)
338400
// This mimics selecting an alternative route by making the first
339401
// alternative the primary route and the original primary route one
340402
// of the alternatives.
@@ -354,24 +416,34 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
354416
override fun onFinish() {
355417
// Primary route group is now 2 and not visible
356418
assertEquals(
357-
"mapbox-layerGroup-2-traffic",
419+
"mapbox-masking-layer-traffic",
358420
style.styleLayers[topLevelRouteLayerIndex - 1].id
359421
)
422+
assertEquals(
423+
"mapbox-layerGroup-2-traffic",
424+
style.styleLayers[topLevelRouteLayerIndex - 6].id
425+
)
360426
assertEquals(
361427
Visibility.NONE,
362428
style.getLayer(
363429
style.styleLayers[topLevelRouteLayerIndex - 1].id
364430
)?.visibility
365431
)
432+
assertEquals(
433+
Visibility.NONE,
434+
style.getLayer(
435+
style.styleLayers[topLevelRouteLayerIndex - 6].id
436+
)?.visibility
437+
)
366438
// Previously primary route group is 1 and is now visible
367439
assertEquals(
368440
"mapbox-layerGroup-1-traffic",
369-
style.styleLayers[topLevelRouteLayerIndex - 6].id
441+
style.styleLayers[topLevelRouteLayerIndex - 11].id
370442
)
371443
assertEquals(
372444
Visibility.VISIBLE,
373445
style.getLayer(
374-
style.styleLayers[topLevelRouteLayerIndex - 6].id
446+
style.styleLayers[topLevelRouteLayerIndex - 11].id
375447
)?.visibility
376448
)
377449
countDownLatch.countDown()

0 commit comments

Comments
 (0)