@@ -46,7 +46,7 @@ import {
46
46
47
47
export { MapboxTraceCategory , MapStyle } ;
48
48
49
- declare const android , com , java , org : any ;
49
+ // declare const android, com, java, org: any;
50
50
51
51
export namespace BundleKludge {
52
52
export const bundle = { test : 'test' } ;
@@ -218,7 +218,7 @@ export class MapboxView extends MapboxViewBase {
218
218
*/
219
219
telemetry = false ;
220
220
public createNativeView ( ) : Object {
221
- // const telemetry = com.mapbox.mapboxsdk.maps.Mapbox.getTelemetry() ;
221
+ // const telemetry = com.mapbox.android.telemetry.TelemetryEnabler.updateTelemetryState ;
222
222
// if (telemetry != null) {
223
223
// telemetry.setUserTelemetryRequestState(telemetry);
224
224
// }
@@ -873,13 +873,11 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
873
873
874
874
// this.gcFix('com.mapbox.mapboxsdk.maps.MapView.OnDidFailLoadingMapListener', this.onDidFailLoadingMapListener);
875
875
876
- this . onDidFinishLoadingMapListener = new com . mapbox . mapboxsdk . maps . MapView . OnDidFinishLoadingMapListener ( {
877
- onDidFinishLoadingMap : ( map ) => {
878
- if ( Trace . isEnabled ( ) ) {
879
- CLog ( CLogTypes . info , 'show(): finished loading map:' ) ;
880
- }
881
- } ,
882
- } ) ;
876
+ if ( Trace . isEnabled ( ) ) {
877
+ this . onDidFinishLoadingMapListener = new com . mapbox . mapboxsdk . maps . MapView . OnDidFinishLoadingMapListener ( {
878
+ onDidFinishLoadingMap : ( ) => CLog ( CLogTypes . info , 'show(): finished loading map' ) ,
879
+ } ) ;
880
+ }
883
881
884
882
this . _mapboxViewInstance . addOnDidFinishLoadingMapListener ( this . onDidFinishLoadingMapListener ) ;
885
883
@@ -1588,7 +1586,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
1588
1586
1589
1587
// the create() method of the line manager requires a feature collection.
1590
1588
1591
- const featureCollection = new com . mapbox . geojson . FeatureCollection . fromFeature ( feature ) ;
1589
+ const featureCollection = com . mapbox . geojson . FeatureCollection . fromFeature ( feature ) ;
1592
1590
1593
1591
// this.gcFix('com.mapbox.geojson.FeatureCollection', featureCollection);
1594
1592
@@ -1713,7 +1711,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
1713
1711
// callback for when the style is successfully loaded.
1714
1712
1715
1713
this . onDidFinishLoadingStyleListener = new com . mapbox . mapboxsdk . maps . MapView . OnDidFinishLoadingStyleListener ( {
1716
- onDidFinishLoadingStyle : ( style ) => {
1714
+ onDidFinishLoadingStyle : ( ) => {
1717
1715
if ( Trace . isEnabled ( ) ) {
1718
1716
CLog ( CLogTypes . info , 'Mapbox:setMapStyle(): style loaded' ) ;
1719
1717
}
@@ -1744,7 +1742,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
1744
1742
1745
1743
// this.gcFix('com.mapbox.mapboxsdk.plugins.annotation.OnAnnotationClickListener', this.onAnnotationClickListener);
1746
1744
1747
- resolve ( style ) ;
1745
+ resolve ( ) ;
1748
1746
} ,
1749
1747
} ) ;
1750
1748
@@ -2384,7 +2382,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
2384
2382
* Not returning a boolean from the listener function will cause a crash.
2385
2383
*/
2386
2384
2387
- setOnMapClickListener ( listener : ( data : LatLng ) => void , nativeMap ?: MapboxView ) : Promise < void > {
2385
+ setOnMapClickListener ( listener : ( data : LatLng ) => boolean , nativeMap ?: MapboxView ) : Promise < void > {
2388
2386
return new Promise ( ( resolve , reject ) => {
2389
2387
try {
2390
2388
if ( ! this . _mapboxMapInstance ) {
@@ -2421,7 +2419,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
2421
2419
2422
2420
// ----------------------------------------------------------------------------------
2423
2421
2424
- setOnMapLongClickListener ( listener : ( data : LatLng ) => void , nativeMap ?) : Promise < void > {
2422
+ setOnMapLongClickListener ( listener : ( data : LatLng ) => boolean , nativeMap ?) : Promise < void > {
2425
2423
return new Promise ( ( resolve , reject ) => {
2426
2424
try {
2427
2425
if ( ! this . _mapboxMapInstance ) {
@@ -2931,18 +2929,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
2931
2929
fillExtrusionLayer . setSourceLayer ( 'building' ) ;
2932
2930
fillExtrusionLayer . setFilter ( com . mapbox . mapboxsdk . style . expressions . Expression . eq ( com . mapbox . mapboxsdk . style . expressions . Expression . get ( 'extrude' ) , 'true' ) ) ;
2933
2931
fillExtrusionLayer . setMinZoom ( 15 ) ;
2934
-
2932
+ const props = [ ] ;
2933
+ props [ 0 ] = com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionColor ( android . graphics . Color . LTGRAY ) ;
2934
+ props [ 1 ] = com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionHeight ( com . mapbox . mapboxsdk . style . expressions . Expression . get ( 'height' ) ) ;
2935
+ props [ 2 ] = com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionBase ( com . mapbox . mapboxsdk . style . expressions . Expression . get ( 'min_height' ) ) ;
2936
+ props [ 3 ] = com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionOpacity ( com . mapbox . mapboxsdk . style . expressions . Expression . literal ( 0.6 ) ) ;
2935
2937
// Set data-driven styling properties
2936
- fillExtrusionLayer . setProperties (
2937
- com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionColor ( android . graphics . Color . LTGRAY ) ,
2938
- com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionHeight (
2939
- com . mapbox . mapboxsdk . style . functions . Function . property ( 'height' , new com . mapbox . mapboxsdk . style . functions . stops . IdentityStops ( ) )
2940
- ) ,
2941
- com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionBase (
2942
- com . mapbox . mapboxsdk . style . functions . Function . property ( 'min_height' , new com . mapbox . mapboxsdk . style . functions . stops . IdentityStops ( ) )
2943
- ) ,
2944
- com . mapbox . mapboxsdk . style . layers . PropertyFactory . fillExtrusionOpacity ( new java . lang . Float ( 0.6 ) )
2945
- ) ;
2938
+ fillExtrusionLayer . setProperties ( props ) ;
2946
2939
2947
2940
this . _mapboxMapInstance . addLayer ( fillExtrusionLayer ) ;
2948
2941
resolve ( ) ;
@@ -2993,7 +2986,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
2993
2986
2994
2987
const geojsonString = JSON . stringify ( options . data ) ;
2995
2988
2996
- const feature : Feature = com . mapbox . geojson . Feature . fromJson ( geojsonString ) ;
2989
+ const feature = com . mapbox . geojson . Feature . fromJson ( geojsonString ) ;
2997
2990
2998
2991
if ( Trace . isEnabled ( ) ) {
2999
2992
CLog ( CLogTypes . info , 'Mapbox:addSource(): adding feature' ) ;
@@ -3314,11 +3307,11 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
3314
3307
} // end of paint section.
3315
3308
3316
3309
// now the layout section
3317
-
3310
+ const Property = com . mapbox . mapboxsdk . style . layers . Property ;
3318
3311
if ( typeof style . layout == 'undefined' ) {
3319
3312
lineProperties = [
3320
- com . mapbox . mapboxsdk . style . layers . PropertyFactory . lineCap ( com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_CAP_ROUND ) ,
3321
- com . mapbox . mapboxsdk . style . layers . PropertyFactory . lineJoin ( com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_JOIN_ROUND ) ,
3313
+ com . mapbox . mapboxsdk . style . layers . PropertyFactory . lineCap ( Property . LINE_CAP_ROUND ) ,
3314
+ com . mapbox . mapboxsdk . style . layers . PropertyFactory . lineJoin ( Property . LINE_JOIN_ROUND ) ,
3322
3315
] ;
3323
3316
} else {
3324
3317
// line cap
@@ -3330,12 +3323,16 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
3330
3323
3331
3324
switch ( style . layout [ 'line-cap' ] ) {
3332
3325
case 'round' :
3333
- property = com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_CAP_ROUND ;
3326
+ property = Property . LINE_CAP_ROUND ;
3334
3327
3335
3328
break ;
3336
3329
3337
3330
case 'square' :
3338
- property = com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_CAP_SQUARE ;
3331
+ property = Property . LINE_CAP_SQUARE ;
3332
+
3333
+ break ;
3334
+ case 'butt' :
3335
+ property = Property . LINE_CAP_BUTT ;
3339
3336
3340
3337
break ;
3341
3338
}
@@ -3350,13 +3347,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
3350
3347
3351
3348
switch ( style . layout [ 'line-join' ] ) {
3352
3349
case 'round' :
3353
- property = com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_JOIN_ROUND ;
3354
-
3350
+ property = Property . LINE_JOIN_ROUND ;
3355
3351
break ;
3356
-
3357
- case 'square' :
3358
- property = com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_JOIN_SQUARE ;
3359
-
3352
+ case 'miter' :
3353
+ property = Property . LINE_JOIN_MITER ;
3354
+ break ;
3355
+ case 'bevel' :
3356
+ property = Property . LINE_JOIN_BEVEL ;
3360
3357
break ;
3361
3358
}
3362
3359
@@ -3957,13 +3954,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
3957
3954
return modeRef . TRACKING ;
3958
3955
3959
3956
case 'TRACK_COMPASS' :
3960
- return modeRef . TRACK_COMPASS ;
3957
+ return modeRef . TRACKING_COMPASS ;
3961
3958
3962
3959
case 'TRACKING_GPS' :
3963
3960
return modeRef . TRACKING_GPS ;
3964
3961
3965
3962
case 'TRACK_GPS_NORTH' :
3966
- return modeRef . TRACK_GPS_NORTH ;
3963
+ return modeRef . TRACKING_GPS_NORTH ;
3967
3964
}
3968
3965
}
3969
3966
@@ -4007,10 +4004,10 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
4007
4004
4008
4005
// -------------------------------------------------------------
4009
4006
4010
- _getRegionName ( offlineRegion ) {
4007
+ _getRegionName ( offlineRegion : com . mapbox . mapboxsdk . offline . OfflineRegion ) {
4011
4008
const metadata = offlineRegion . getMetadata ( ) ;
4012
4009
const jsonStr = new java . lang . String ( metadata , 'UTF-8' ) ;
4013
- const jsonObj = new org . json . JSONObject ( jsonStr ) ;
4010
+ const jsonObj = new org . json . JSONObject ( ( jsonStr as any ) as string ) ;
4014
4011
return jsonObj . getString ( 'name' ) ;
4015
4012
}
4016
4013
@@ -4064,15 +4061,15 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
4064
4061
const componentOptionsBuilder = com . mapbox . mapboxsdk . location . LocationComponentOptions . builder ( Application . android . context ) ;
4065
4062
4066
4063
if ( typeof options . elevation != 'undefined' ) {
4067
- componentOptionsBuilder . elevation ( new java . lang . Float ( options . elevation ) ) ;
4064
+ componentOptionsBuilder . elevation ( options . elevation ) ;
4068
4065
}
4069
4066
4070
4067
if ( typeof options . accuracyColor != 'undefined' ) {
4071
4068
componentOptionsBuilder . accuracyColor ( android . graphics . Color . parseColor ( options . accuracyColor ) ) ;
4072
4069
}
4073
4070
4074
4071
if ( typeof options . accuracyAlpha != 'undefined' ) {
4075
- componentOptionsBuilder . accuracyAlpha ( new java . lang . Float ( options . accuracyAlpha ) ) ;
4072
+ componentOptionsBuilder . accuracyAlpha ( options . accuracyAlpha ) ;
4076
4073
}
4077
4074
4078
4075
const componentOptions = componentOptionsBuilder . build ( ) ;
@@ -4142,8 +4139,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
4142
4139
4143
4140
if ( typeof options . clickListener != 'undefined' ) {
4144
4141
this . onLocationClickListener = new com . mapbox . mapboxsdk . location . OnLocationClickListener ( {
4145
- onLocationComponentClick : ( component ) => {
4146
- options . clickListener ( component ) ;
4142
+ onLocationComponentClick : ( ) => {
4143
+ options . clickListener ( ) ;
4147
4144
} ,
4148
4145
} ) ;
4149
4146
0 commit comments