@@ -46,7 +46,7 @@ import {
4646
4747export { MapboxTraceCategory , MapStyle } ;
4848
49- declare const android , com , java , org : any ;
49+ // declare const android, com, java, org: any;
5050
5151export namespace BundleKludge {
5252 export const bundle = { test : 'test' } ;
@@ -218,7 +218,7 @@ export class MapboxView extends MapboxViewBase {
218218 */
219219 telemetry = false ;
220220 public createNativeView ( ) : Object {
221- // const telemetry = com.mapbox.mapboxsdk.maps.Mapbox.getTelemetry() ;
221+ // const telemetry = com.mapbox.android.telemetry.TelemetryEnabler.updateTelemetryState ;
222222 // if (telemetry != null) {
223223 // telemetry.setUserTelemetryRequestState(telemetry);
224224 // }
@@ -873,13 +873,11 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
873873
874874 // this.gcFix('com.mapbox.mapboxsdk.maps.MapView.OnDidFailLoadingMapListener', this.onDidFailLoadingMapListener);
875875
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+ }
883881
884882 this . _mapboxViewInstance . addOnDidFinishLoadingMapListener ( this . onDidFinishLoadingMapListener ) ;
885883
@@ -1588,7 +1586,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
15881586
15891587 // the create() method of the line manager requires a feature collection.
15901588
1591- const featureCollection = new com . mapbox . geojson . FeatureCollection . fromFeature ( feature ) ;
1589+ const featureCollection = com . mapbox . geojson . FeatureCollection . fromFeature ( feature ) ;
15921590
15931591 // this.gcFix('com.mapbox.geojson.FeatureCollection', featureCollection);
15941592
@@ -1713,7 +1711,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
17131711 // callback for when the style is successfully loaded.
17141712
17151713 this . onDidFinishLoadingStyleListener = new com . mapbox . mapboxsdk . maps . MapView . OnDidFinishLoadingStyleListener ( {
1716- onDidFinishLoadingStyle : ( style ) => {
1714+ onDidFinishLoadingStyle : ( ) => {
17171715 if ( Trace . isEnabled ( ) ) {
17181716 CLog ( CLogTypes . info , 'Mapbox:setMapStyle(): style loaded' ) ;
17191717 }
@@ -1744,7 +1742,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
17441742
17451743 // this.gcFix('com.mapbox.mapboxsdk.plugins.annotation.OnAnnotationClickListener', this.onAnnotationClickListener);
17461744
1747- resolve ( style ) ;
1745+ resolve ( ) ;
17481746 } ,
17491747 } ) ;
17501748
@@ -2384,7 +2382,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
23842382 * Not returning a boolean from the listener function will cause a crash.
23852383 */
23862384
2387- setOnMapClickListener ( listener : ( data : LatLng ) => void , nativeMap ?: MapboxView ) : Promise < void > {
2385+ setOnMapClickListener ( listener : ( data : LatLng ) => boolean , nativeMap ?: MapboxView ) : Promise < void > {
23882386 return new Promise ( ( resolve , reject ) => {
23892387 try {
23902388 if ( ! this . _mapboxMapInstance ) {
@@ -2421,7 +2419,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
24212419
24222420 // ----------------------------------------------------------------------------------
24232421
2424- setOnMapLongClickListener ( listener : ( data : LatLng ) => void , nativeMap ?) : Promise < void > {
2422+ setOnMapLongClickListener ( listener : ( data : LatLng ) => boolean , nativeMap ?) : Promise < void > {
24252423 return new Promise ( ( resolve , reject ) => {
24262424 try {
24272425 if ( ! this . _mapboxMapInstance ) {
@@ -2931,18 +2929,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
29312929 fillExtrusionLayer . setSourceLayer ( 'building' ) ;
29322930 fillExtrusionLayer . setFilter ( com . mapbox . mapboxsdk . style . expressions . Expression . eq ( com . mapbox . mapboxsdk . style . expressions . Expression . get ( 'extrude' ) , 'true' ) ) ;
29332931 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 ) ) ;
29352937 // 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 ) ;
29462939
29472940 this . _mapboxMapInstance . addLayer ( fillExtrusionLayer ) ;
29482941 resolve ( ) ;
@@ -2993,7 +2986,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
29932986
29942987 const geojsonString = JSON . stringify ( options . data ) ;
29952988
2996- const feature : Feature = com . mapbox . geojson . Feature . fromJson ( geojsonString ) ;
2989+ const feature = com . mapbox . geojson . Feature . fromJson ( geojsonString ) ;
29972990
29982991 if ( Trace . isEnabled ( ) ) {
29992992 CLog ( CLogTypes . info , 'Mapbox:addSource(): adding feature' ) ;
@@ -3314,11 +3307,11 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
33143307 } // end of paint section.
33153308
33163309 // now the layout section
3317-
3310+ const Property = com . mapbox . mapboxsdk . style . layers . Property ;
33183311 if ( typeof style . layout == 'undefined' ) {
33193312 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 ) ,
33223315 ] ;
33233316 } else {
33243317 // line cap
@@ -3330,12 +3323,16 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
33303323
33313324 switch ( style . layout [ 'line-cap' ] ) {
33323325 case 'round' :
3333- property = com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_CAP_ROUND ;
3326+ property = Property . LINE_CAP_ROUND ;
33343327
33353328 break ;
33363329
33373330 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 ;
33393336
33403337 break ;
33413338 }
@@ -3350,13 +3347,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
33503347
33513348 switch ( style . layout [ 'line-join' ] ) {
33523349 case 'round' :
3353- property = com . mapbox . mapboxsdk . style . layers . PropertyFactory . LINE_JOIN_ROUND ;
3354-
3350+ property = Property . LINE_JOIN_ROUND ;
33553351 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 ;
33603357 break ;
33613358 }
33623359
@@ -3957,13 +3954,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
39573954 return modeRef . TRACKING ;
39583955
39593956 case 'TRACK_COMPASS' :
3960- return modeRef . TRACK_COMPASS ;
3957+ return modeRef . TRACKING_COMPASS ;
39613958
39623959 case 'TRACKING_GPS' :
39633960 return modeRef . TRACKING_GPS ;
39643961
39653962 case 'TRACK_GPS_NORTH' :
3966- return modeRef . TRACK_GPS_NORTH ;
3963+ return modeRef . TRACKING_GPS_NORTH ;
39673964 }
39683965 }
39693966
@@ -4007,10 +4004,10 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
40074004
40084005 // -------------------------------------------------------------
40094006
4010- _getRegionName ( offlineRegion ) {
4007+ _getRegionName ( offlineRegion : com . mapbox . mapboxsdk . offline . OfflineRegion ) {
40114008 const metadata = offlineRegion . getMetadata ( ) ;
40124009 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 ) ;
40144011 return jsonObj . getString ( 'name' ) ;
40154012 }
40164013
@@ -4064,15 +4061,15 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
40644061 const componentOptionsBuilder = com . mapbox . mapboxsdk . location . LocationComponentOptions . builder ( Application . android . context ) ;
40654062
40664063 if ( typeof options . elevation != 'undefined' ) {
4067- componentOptionsBuilder . elevation ( new java . lang . Float ( options . elevation ) ) ;
4064+ componentOptionsBuilder . elevation ( options . elevation ) ;
40684065 }
40694066
40704067 if ( typeof options . accuracyColor != 'undefined' ) {
40714068 componentOptionsBuilder . accuracyColor ( android . graphics . Color . parseColor ( options . accuracyColor ) ) ;
40724069 }
40734070
40744071 if ( typeof options . accuracyAlpha != 'undefined' ) {
4075- componentOptionsBuilder . accuracyAlpha ( new java . lang . Float ( options . accuracyAlpha ) ) ;
4072+ componentOptionsBuilder . accuracyAlpha ( options . accuracyAlpha ) ;
40764073 }
40774074
40784075 const componentOptions = componentOptionsBuilder . build ( ) ;
@@ -4142,8 +4139,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
41424139
41434140 if ( typeof options . clickListener != 'undefined' ) {
41444141 this . onLocationClickListener = new com . mapbox . mapboxsdk . location . OnLocationClickListener ( {
4145- onLocationComponentClick : ( component ) => {
4146- options . clickListener ( component ) ;
4142+ onLocationComponentClick : ( ) => {
4143+ options . clickListener ( ) ;
41474144 } ,
41484145 } ) ;
41494146
0 commit comments