Skip to content

Commit d60a4fe

Browse files
jushgithub-actions[bot]
authored andcommitted
Revert renaming HeavyRouteLineValueProvider, LightRouteLineValueProvider...
GitOrigin-RevId: 99793188691c566bde6ba658d33541e0a5cc0ccd
1 parent 4974fcd commit d60a4fe

13 files changed

Lines changed: 417 additions & 416 deletions

File tree

ui-maps/src/main/java/com/mapbox/navigation/ui/maps/internal/route/line/MapboxRouteLineUtils.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ import com.mapbox.navigation.base.utils.DecodeUtils.completeGeometryToLineString
4040
import com.mapbox.navigation.base.utils.DecodeUtils.stepsGeometryToPoints
4141
import com.mapbox.navigation.core.routealternatives.AlternativeRouteMetadata
4242
import com.mapbox.navigation.ui.maps.route.RouteLayerConstants
43-
import com.mapbox.navigation.ui.maps.route.line.api.HeavyRouteLineExpressionValueProvider
44-
import com.mapbox.navigation.ui.maps.route.line.api.LightRouteLineExpressionValueProvider
43+
import com.mapbox.navigation.ui.maps.route.line.api.HeavyRouteLineValueProvider
44+
import com.mapbox.navigation.ui.maps.route.line.api.LightRouteLineValueProvider
4545
import com.mapbox.navigation.ui.maps.route.line.api.LineGradientCommandApplier
4646
import com.mapbox.navigation.ui.maps.route.line.api.RouteLineValueCommandHolder
4747
import com.mapbox.navigation.ui.maps.route.line.model.ExpressionOffsetData
@@ -2794,15 +2794,15 @@ internal object MapboxRouteLineUtils {
27942794
}
27952795
val primaryRouteTrafficLineExpressionCommandHolder =
27962796
RouteLineValueCommandHolder(
2797-
HeavyRouteLineExpressionValueProvider {
2797+
HeavyRouteLineValueProvider {
27982798
trafficExpressionProvider(it)
27992799
},
28002800
LineGradientCommandApplier(),
28012801
)
28022802

28032803
val primaryRouteBaseExpressionCommandHolder =
28042804
RouteLineValueCommandHolder(
2805-
LightRouteLineExpressionValueProvider {
2805+
LightRouteLineValueProvider {
28062806
// TODO why are we changing traveled portion to traveled color instead of
28072807
// making it transparent to show trail layers?
28082808
if (routeLineOptions.styleInactiveRouteLegsIndependently) {
@@ -2828,7 +2828,7 @@ internal object MapboxRouteLineUtils {
28282828
val primaryRouteCasingExpressionCommandHolder = RouteLineValueCommandHolder(
28292829
// TODO why are we changing traveled portion to traveled color instead of
28302830
// making it transparent to show trail layers?
2831-
LightRouteLineExpressionValueProvider {
2831+
LightRouteLineValueProvider {
28322832
if (routeLineOptions.styleInactiveRouteLegsIndependently) {
28332833
getExpressionSubstitutingColorForInactiveLegs(
28342834
vanishingPointOffset,
@@ -2854,7 +2854,7 @@ internal object MapboxRouteLineUtils {
28542854
// However, all layers are initialized to grey right now,
28552855
// and they should be initialized as transparent instead.
28562856
val primaryRouteTrailExpressionCommandHolder = RouteLineValueCommandHolder(
2857-
LightRouteLineExpressionValueProvider {
2857+
LightRouteLineValueProvider {
28582858
if (routeLineOptions.styleInactiveRouteLegsIndependently &&
28592859
routeLineOptions.vanishingRouteLineEnabled
28602860
) {
@@ -2896,7 +2896,7 @@ internal object MapboxRouteLineUtils {
28962896
)
28972897
// the same conditions apply for the trail casing as do for the trail layers
28982898
val primaryRouteTrailCasingExpressionCommandHolder = RouteLineValueCommandHolder(
2899-
LightRouteLineExpressionValueProvider {
2899+
LightRouteLineValueProvider {
29002900
if (routeLineOptions.styleInactiveRouteLegsIndependently &&
29012901
routeLineOptions.vanishingRouteLineEnabled
29022902
) {
@@ -2931,7 +2931,7 @@ internal object MapboxRouteLineUtils {
29312931
// If false produce a gradient for the restricted line layer that is completely transparent.
29322932
val primaryRouteRestrictedSectionsExpressionProducer =
29332933
RouteLineValueCommandHolder(
2934-
HeavyRouteLineExpressionValueProvider(
2934+
HeavyRouteLineValueProvider(
29352935
getNonMaskingRestrictedLineExpressionProducer(
29362936
restrictedExpressionData,
29372937
0.0,
@@ -2943,7 +2943,7 @@ internal object MapboxRouteLineUtils {
29432943
)
29442944

29452945
val blurLineHolder = RouteLineValueCommandHolder(
2946-
HeavyRouteLineExpressionValueProvider { options ->
2946+
HeavyRouteLineValueProvider { options ->
29472947
if (options.routeLineBlurEnabled) {
29482948
if (options.applyTrafficColorsToRouteLineBlur) {
29492949
trafficExpressionProvider(options)

ui-maps/src/main/java/com/mapbox/navigation/ui/maps/internal/route/line/RouteLineDataConverter.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.mapbox.maps.Style
55
import com.mapbox.maps.StylePropertyValue
66
import com.mapbox.maps.StylePropertyValueKind
77
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
8-
import com.mapbox.navigation.ui.maps.route.line.api.LightRouteLineExpressionValueProvider
8+
import com.mapbox.navigation.ui.maps.route.line.api.LightRouteLineValueProvider
99
import com.mapbox.navigation.ui.maps.route.line.api.LineGradientCommandApplier
1010
import com.mapbox.navigation.ui.maps.route.line.api.LineTrimCommandApplier
1111
import com.mapbox.navigation.ui.maps.route.line.api.RouteLineCommandApplier
@@ -147,7 +147,7 @@ private fun RouteLineExpressionEventData.toHolder(): RouteLineValueCommandHolder
147147
// deprecated
148148
"line-trim-offset" -> {
149149
RouteLineValueCommandHolder(
150-
LightRouteLineExpressionValueProvider {
150+
LightRouteLineValueProvider {
151151
StylePropertyValue(expression!!, StylePropertyValueKind.EXPRESSION)
152152
},
153153
object : RouteLineCommandApplier<StylePropertyValue>() {
@@ -168,17 +168,17 @@ private fun RouteLineExpressionEventData.toHolder(): RouteLineValueCommandHolder
168168

169169
"line-trim-end" -> {
170170
RouteLineValueCommandHolder(
171-
LightRouteLineExpressionValueProvider { value!! },
171+
LightRouteLineValueProvider { value!! },
172172
LineTrimCommandApplier(),
173173
)
174174
}
175175

176176
"line-gradient" -> {
177177
RouteLineValueCommandHolder(
178178
if (value != null) {
179-
LightRouteLineExpressionValueProvider { value!! }
179+
LightRouteLineValueProvider { value!! }
180180
} else {
181-
LightRouteLineExpressionValueProvider {
181+
LightRouteLineValueProvider {
182182
StylePropertyValue(expression!!, StylePropertyValueKind.EXPRESSION)
183183
}
184184
},

ui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/line/api/MapboxRouteLineApi.kt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
818818
val trafficExpProvider = RouteLineValueCommandHolder(
819819
// TODO why is this a "light" expression instead of "heavy"?
820820
// Congestion generation for initial draw uses "heavy"
821-
LightRouteLineExpressionValueProvider {
821+
LightRouteLineValueProvider {
822822
MapboxRouteLineUtils.getTrafficLineExpression(
823823
it,
824824
0.0,
@@ -831,7 +831,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
831831
LineGradientCommandApplier(),
832832
)
833833
val mainExpCommandHolder = RouteLineValueCommandHolder(
834-
LightRouteLineExpressionValueProvider {
834+
LightRouteLineValueProvider {
835835
MapboxRouteLineUtils.getExpressionSubstitutingColorForInactiveLegs(
836836
0.0,
837837
segments,
@@ -844,7 +844,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
844844
LineGradientCommandApplier(),
845845
)
846846
val casingExpApplier = RouteLineValueCommandHolder(
847-
LightRouteLineExpressionValueProvider {
847+
LightRouteLineValueProvider {
848848
MapboxRouteLineUtils.getExpressionSubstitutingColorForInactiveLegs(
849849
0.0,
850850
segments,
@@ -857,7 +857,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
857857
LineGradientCommandApplier(),
858858
)
859859
val trailExpCommandHolder = RouteLineValueCommandHolder(
860-
LightRouteLineExpressionValueProvider {
860+
LightRouteLineValueProvider {
861861
MapboxRouteLineUtils.getExpressionSubstitutingColorForInactiveLegs(
862862
0.0,
863863
segments,
@@ -870,7 +870,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
870870
LineGradientCommandApplier(),
871871
)
872872
val trailCasingExpCommandHolder = RouteLineValueCommandHolder(
873-
LightRouteLineExpressionValueProvider {
873+
LightRouteLineValueProvider {
874874
MapboxRouteLineUtils.getExpressionSubstitutingColorForInactiveLegs(
875875
0.0,
876876
segments,
@@ -887,7 +887,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
887887
val restrictedExpCommandHolder = RouteLineValueCommandHolder(
888888
// TODO why is this a "light" expression instead of "heavy"?
889889
// Congestion generation for initial draw uses "heavy"
890-
LightRouteLineExpressionValueProvider(
890+
LightRouteLineValueProvider(
891891
getRestrictedLineExpressionProducer(
892892
routeLineOptions,
893893
restrictedExpressionData,
@@ -1205,7 +1205,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12051205
val alternateRoute1TrafficExpressionCommandHolder =
12061206
alternativeRoute1?.route?.let { route ->
12071207
RouteLineValueCommandHolder(
1208-
HeavyRouteLineExpressionValueProvider {
1208+
HeavyRouteLineValueProvider {
12091209
MapboxRouteLineUtils.getTrafficLineExpression(
12101210
route,
12111211
routeLineOptions,
@@ -1224,7 +1224,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12241224
val alternateRoute2TrafficExpressionCommandHolder =
12251225
if (partitionedRoutes.second.size > 1) {
12261226
RouteLineValueCommandHolder(
1227-
HeavyRouteLineExpressionValueProvider {
1227+
HeavyRouteLineValueProvider {
12281228
MapboxRouteLineUtils.getTrafficLineExpression(
12291229
alternativeRoute2!!.route,
12301230
routeLineOptions,
@@ -1251,7 +1251,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12511251
val wayPointsFeatureCollection = wayPointsFeatureCollectionDef.await()
12521252

12531253
val alternateRoute1BaseExpressionCommandHolder = RouteLineValueCommandHolder(
1254-
LightRouteLineExpressionValueProvider {
1254+
LightRouteLineValueProvider {
12551255
MapboxRouteLineUtils.getRouteLineExpression(
12561256
alternative1PercentageTraveled,
12571257
Color.TRANSPARENT,
@@ -1262,7 +1262,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12621262
)
12631263

12641264
val alternateRoute1CasingExpressionCommandHolder = RouteLineValueCommandHolder(
1265-
LightRouteLineExpressionValueProvider {
1265+
LightRouteLineValueProvider {
12661266
MapboxRouteLineUtils.getRouteLineExpression(
12671267
alternative1PercentageTraveled,
12681268
Color.TRANSPARENT,
@@ -1273,7 +1273,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12731273
)
12741274

12751275
val alternateRoute1TrailExpressionCommandHolder = RouteLineValueCommandHolder(
1276-
LightRouteLineExpressionValueProvider {
1276+
LightRouteLineValueProvider {
12771277
MapboxRouteLineUtils.getRouteLineExpression(
12781278
alternative1PercentageTraveled,
12791279
Color.TRANSPARENT,
@@ -1284,7 +1284,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12841284
)
12851285

12861286
val alternateRoute1TrailCasingExpressionCommandHolder = RouteLineValueCommandHolder(
1287-
LightRouteLineExpressionValueProvider {
1287+
LightRouteLineValueProvider {
12881288
MapboxRouteLineUtils.getRouteLineExpression(
12891289
alternative1PercentageTraveled,
12901290
Color.TRANSPARENT,
@@ -1296,7 +1296,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
12961296

12971297
val alternateRoute1RestrictedSectionsExpressionCommandHolder =
12981298
RouteLineValueCommandHolder(
1299-
LightRouteLineExpressionValueProvider {
1299+
LightRouteLineValueProvider {
13001300
MapboxRouteLineUtils.getRouteLineExpression(
13011301
alternative1PercentageTraveled,
13021302
Color.TRANSPARENT,
@@ -1307,14 +1307,14 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13071307
)
13081308

13091309
val alternateRoute1BlurExpressionHolder = RouteLineValueCommandHolder(
1310-
LightRouteLineExpressionValueProvider {
1310+
LightRouteLineValueProvider {
13111311
getSingleColorExpression(Color.TRANSPARENT)
13121312
},
13131313
LineGradientCommandApplier(),
13141314
)
13151315

13161316
val alternateRoute2BaseExpressionCommandHolder = RouteLineValueCommandHolder(
1317-
LightRouteLineExpressionValueProvider {
1317+
LightRouteLineValueProvider {
13181318
MapboxRouteLineUtils.getRouteLineExpression(
13191319
alternative2PercentageTraveled,
13201320
Color.TRANSPARENT,
@@ -1325,7 +1325,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13251325
)
13261326

13271327
val alternateRoute2CasingExpressionCommandHolder = RouteLineValueCommandHolder(
1328-
LightRouteLineExpressionValueProvider {
1328+
LightRouteLineValueProvider {
13291329
MapboxRouteLineUtils.getRouteLineExpression(
13301330
alternative2PercentageTraveled,
13311331
Color.TRANSPARENT,
@@ -1336,7 +1336,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13361336
)
13371337

13381338
val alternateRoute2TrailExpressionCommandHolder = RouteLineValueCommandHolder(
1339-
LightRouteLineExpressionValueProvider {
1339+
LightRouteLineValueProvider {
13401340
MapboxRouteLineUtils.getRouteLineExpression(
13411341
alternative2PercentageTraveled,
13421342
Color.TRANSPARENT,
@@ -1347,7 +1347,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13471347
)
13481348

13491349
val alternateRoute2TrailCasingExpressionCommandHolder = RouteLineValueCommandHolder(
1350-
LightRouteLineExpressionValueProvider {
1350+
LightRouteLineValueProvider {
13511351
MapboxRouteLineUtils.getRouteLineExpression(
13521352
alternative2PercentageTraveled,
13531353
Color.TRANSPARENT,
@@ -1359,7 +1359,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13591359

13601360
val alternateRoute2RestrictedSectionsExpressionCommandHolder =
13611361
RouteLineValueCommandHolder(
1362-
LightRouteLineExpressionValueProvider {
1362+
LightRouteLineValueProvider {
13631363
MapboxRouteLineUtils.getRouteLineExpression(
13641364
alternative2PercentageTraveled,
13651365
Color.TRANSPARENT,
@@ -1370,7 +1370,7 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13701370
)
13711371

13721372
val alternateRoute2BlurExpressionHolder = RouteLineValueCommandHolder(
1373-
LightRouteLineExpressionValueProvider {
1373+
LightRouteLineValueProvider {
13741374
getSingleColorExpression(Color.TRANSPARENT)
13751375
},
13761376
LineGradientCommandApplier(),
@@ -1391,28 +1391,28 @@ class MapboxRouteLineApi @VisibleForTesting internal constructor(
13911391
)
13921392
RouteLineDynamicData(
13931393
baseExpressionCommandHolder = RouteLineValueCommandHolder(
1394-
LightRouteLineExpressionValueProvider { exp },
1394+
LightRouteLineValueProvider { exp },
13951395
LineGradientCommandApplier(),
13961396
),
13971397
casingExpressionCommandHolder = RouteLineValueCommandHolder(
1398-
LightRouteLineExpressionValueProvider { exp },
1398+
LightRouteLineValueProvider { exp },
13991399
LineGradientCommandApplier(),
14001400
),
14011401
trafficExpressionCommandHolder = RouteLineValueCommandHolder(
1402-
LightRouteLineExpressionValueProvider { exp },
1402+
LightRouteLineValueProvider { exp },
14031403
LineGradientCommandApplier(),
14041404
),
14051405
restrictedSectionExpressionCommandHolder = RouteLineValueCommandHolder(
1406-
LightRouteLineExpressionValueProvider { exp },
1406+
LightRouteLineValueProvider { exp },
14071407
LineGradientCommandApplier(),
14081408
),
14091409
trimOffset = RouteLineTrimOffset(vanishingPointOffset),
14101410
trailExpressionCommandHolder = RouteLineValueCommandHolder(
1411-
LightRouteLineExpressionValueProvider { exp },
1411+
LightRouteLineValueProvider { exp },
14121412
LineGradientCommandApplier(),
14131413
),
14141414
trailCasingExpressionCommandHolder = RouteLineValueCommandHolder(
1415-
LightRouteLineExpressionValueProvider { exp },
1415+
LightRouteLineValueProvider { exp },
14161416
LineGradientCommandApplier(),
14171417
),
14181418
)
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.mapbox.navigation.ui.maps.route.line.api
22

3-
import android.util.Log
3+
import androidx.annotation.AnyThread
44
import com.mapbox.maps.StylePropertyValue
55
import com.mapbox.navigation.ui.maps.internal.route.line.RouteLineViewOptionsData
6-
import kotlinx.coroutines.delay
76
import kotlinx.coroutines.withContext
87
import kotlin.coroutines.CoroutineContext
98

@@ -14,15 +13,20 @@ internal fun interface RouteLineCommandProvider<T, R> {
1413
* Please note that this can be a heavy task and [workerCoroutineContext] might be used to
1514
* generate the command.
1615
*/
16+
@AnyThread
1717
suspend fun generateCommand(workerCoroutineContext: CoroutineContext, input: R): T
1818
}
1919

20-
internal abstract class RouteLineExpressionValueProvider : RouteLineCommandProvider<StylePropertyValue, RouteLineViewOptionsData>
20+
internal abstract class RouteLineValueProvider : RouteLineCommandProvider<StylePropertyValue, RouteLineViewOptionsData>
2121

22-
internal class LightRouteLineExpressionValueProvider(
22+
/**
23+
* Version of [RouteLineValueProvider] that does not use a worker context to generate the expression.
24+
*/
25+
internal class LightRouteLineValueProvider(
2326
private val anyThreadExpressionGenerator: (RouteLineViewOptionsData) -> StylePropertyValue,
24-
) : RouteLineExpressionValueProvider() {
27+
) : RouteLineValueProvider() {
2528

29+
@AnyThread
2630
override suspend fun generateCommand(
2731
workerCoroutineContext: CoroutineContext,
2832
input: RouteLineViewOptionsData,
@@ -31,21 +35,20 @@ internal class LightRouteLineExpressionValueProvider(
3135
}
3236
}
3337

34-
internal class HeavyRouteLineExpressionValueProvider(
38+
/**
39+
* Version of [RouteLineValueProvider] that uses a worker context to generate the expression.
40+
*/
41+
internal class HeavyRouteLineValueProvider(
3542
private val workerThreadExpressionGenerator: (RouteLineViewOptionsData) -> StylePropertyValue,
36-
) : RouteLineExpressionValueProvider() {
37-
private val TAG = "MbxRouteLineView"
43+
) : RouteLineValueProvider() {
44+
45+
@AnyThread
3846
override suspend fun generateCommand(
3947
workerCoroutineContext: CoroutineContext,
4048
input: RouteLineViewOptionsData,
4149
): StylePropertyValue {
4250
return withContext(workerCoroutineContext) {
43-
Log.d(TAG, "generateCommand() called")
44-
workerThreadExpressionGenerator(input).also {
45-
Log.d(TAG, "generateCommand() delaying...")
46-
delay(1000L)
47-
Log.d(TAG, "generateCommand() done")
48-
}
51+
workerThreadExpressionGenerator(input)
4952
}
5053
}
5154
}

0 commit comments

Comments
 (0)