Skip to content

Commit 5284618

Browse files
authored
Expose experimental styleGlyphURL (#2782)
* Expose experimental styleGlyphURL * PR fixes * Try another Samsung * Try another Samsung * Revert FB device * Remove broken Firebase device * Try another Pixel * Revert all FB devices again
1 parent 7a2610d commit 5284618

File tree

9 files changed

+109
-8
lines changed

9 files changed

+109
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Mapbox welcomes participation and contributions from everyone.
44

55
# main
66
## Features ✨ and improvements 🏁
7+
* Introduce experimental `getStyleGlyphURL` / `setStyleGlyphURL` functions for `MapboxMap` and `Style`.
78
* Introduce `OnClusterClickListener` and `OnClusterLongClickListener` for `CircleAnnotationManager` and `PointAnnotationManager`. These callbacks receive the clicked cluster represented by a `ClusterFeature`.
89
* [compose] Deprecate all `Annotation` and `AnnotationGroup` composables that take `onClick` parameter. Now all annotation interactions could be set with appropriate `AnnotationInteractionsState` or `AnnotationGroupInteractionsState` stored in `AnnotationGroupState`.
910
* [compose] Introduce `AnnotationInteractionsState` and `AnnotationGroupInteractionsState` states that allow to set callbacks for annotation interactions via `onClicked()` and `onLongClicked()`.`PointAnnotationGroupInteractionsState` and `CircleAnnotationGroupInteractionsState` also provide ability to set callbacks for interactions with clusters via `onClusterClicked` and `onClusterLongClicked`.

LICENSE.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
264264

265265
===========================================================================
266266

267+
Mapbox Maps Android uses portions of the Cronet.
268+
269+
License: [Chromium and built-in dependencies](https://storage.cloud.google.com/chromium-cronet/android/119.0.6045.31/Release/cronet/LICENSE)
270+
271+
===========================================================================
272+
267273
Mapbox Maps Android uses portions of the Experimental annotation.
268274

269275
URL: [https://developer.android.com/jetpack/androidx/releases/annotation#1.3.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.3.0)
@@ -420,6 +426,30 @@ License: [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENS
420426

421427
===========================================================================
422428

429+
Mapbox Maps Android uses portions of the play-services-base.
430+
431+
License: [Android Software Development Kit License](https://developer.android.com/studio/terms.html)
432+
433+
===========================================================================
434+
435+
Mapbox Maps Android uses portions of the play-services-basement.
436+
437+
License: [Android Software Development Kit License](https://developer.android.com/studio/terms.html)
438+
439+
===========================================================================
440+
441+
Mapbox Maps Android uses portions of the play-services-cronet.
442+
443+
License: [Android Software Development Kit License](https://developer.android.com/studio/terms.html)
444+
445+
===========================================================================
446+
447+
Mapbox Maps Android uses portions of the play-services-tasks.
448+
449+
License: [Android Software Development Kit License](https://developer.android.com/studio/terms.html)
450+
451+
===========================================================================
452+
423453
Mapbox Maps Android uses portions of the Saved State.
424454

425455
URL: [https://developer.android.com/jetpack/androidx/releases/savedstate#1.2.0](https://developer.android.com/jetpack/androidx/releases/savedstate#1.2.0)
@@ -444,13 +474,13 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
444474

445475
===========================================================================
446476

447-
### MapboxCoreMaps,11.7.0,Mapbox ToS,Mapbox,https://www.mapbox.com/
477+
### MapboxCoreMaps,11.8.0-SNAPSHOT,Mapbox ToS,Mapbox,https://www.mapbox.com/
448478

449479
```
450-
Mapbox Core Maps version 10.0
480+
Mapbox Core Maps version 11.0
451481
Mapbox Core Maps SDK
452482
453-
Copyright (c) 2021 Mapbox
483+
Copyright (c) 2024 Mapbox
454484
455485
All rights reserved.
456486
@@ -1183,7 +1213,7 @@ DEALINGS IN THE SOFTWARE.
11831213

11841214
---
11851215

1186-
### vector-tile,1.0.4,ISC,Mapbox,https://github.com/mapbox/vector-tile
1216+
### vector-tile-internal,1.0.4,ISC,Mapbox,https://github.com/mapbox/vector-tile-internal
11871217

11881218
```
11891219
Copyright (c) 2016, Mapbox
@@ -1767,7 +1797,7 @@ For more information, please see
17671797

17681798
---
17691799

1770-
### mapbox-base-internal,dev,BSD-3-Clause,Mapbox,https://github.com/mapbox/mapbox-base-internal
1800+
### mapbox-base-internal,dev,BSD-3-Clause,Mapbox,https://www.mapbox.com/
17711801

17721802
```
17731803
Copyright (c) MapBox
@@ -2067,7 +2097,7 @@ DEALINGS IN THE SOFTWARE.
20672097

20682098
---
20692099

2070-
### mapbox-common,dev,Mapbox ToS,Mapbox,https://github.com/mapbox/mapbox-sdk-common
2100+
### mapbox-common,dev,Mapbox ToS,Mapbox,https://www.mapbox.com/
20712101

20722102
```
20732103
Mapbox Common SDK

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ japicmp = "0.4.1"
3434
# Dependencies
3535

3636
# GlNative and Common are used by the convention plugin
37-
mapboxGlNative = "11.7.0"
38-
mapboxCommon = "24.7.0"
37+
mapboxGlNative = "11.8.0-SNAPSHOT.1007T0604Z.9abe2f8"
38+
mapboxCommon = "24.8.0-SNAPSHOT.1007T0604Z.9abe2f8"
3939

4040
mapboxBase = "0.11.0"
4141
mapboxGestures = "0.8.0"

sdk-base/api/Release/metalava.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ package com.mapbox.maps {
152152
method public final float getPixelRatio();
153153
method @CallSuper @MainThread public com.mapbox.maps.StylePropertyValue getStyleAtmosphereProperty(String property);
154154
method @CallSuper @MainThread public com.mapbox.maps.CameraOptions getStyleDefaultCamera();
155+
method @CallSuper @MainThread @com.mapbox.maps.MapboxExperimental public String getStyleGlyphURL();
155156
method @CallSuper @MainThread public com.mapbox.maps.Image? getStyleImage(String imageId);
156157
method @CallSuper @MainThread public com.mapbox.bindgen.Expected<java.lang.String,java.util.HashMap<java.lang.String,com.mapbox.maps.StylePropertyValue>> getStyleImportConfigProperties(String importId);
157158
method @CallSuper @MainThread public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.maps.StylePropertyValue> getStyleImportConfigProperty(String importId, String config);
@@ -192,6 +193,7 @@ package com.mapbox.maps {
192193
method @CallSuper @MainThread public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomGeometrySourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, java.util.List<com.mapbox.geojson.Feature> featureCollection);
193194
method @CallSuper @MainThread @com.mapbox.maps.MapboxExperimental public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomRasterSourceTileData(String sourceId, java.util.List<com.mapbox.maps.CustomRasterSourceTileData> tiles);
194195
method @AnyThread @CallSuper public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleGeoJSONSourceData(String sourceId, String dataId, com.mapbox.maps.GeoJSONSourceData data);
196+
method @CallSuper @MainThread @com.mapbox.maps.MapboxExperimental public void setStyleGlyphURL(String url);
195197
method @CallSuper @MainThread public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleImportConfigProperties(String importId, java.util.HashMap<java.lang.String,com.mapbox.bindgen.Value> configs);
196198
method @CallSuper @MainThread public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleImportConfigProperty(String importId, String config, com.mapbox.bindgen.Value value);
197199
method @CallSuper @MainThread public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleLayerProperties(String layerId, com.mapbox.bindgen.Value properties);

sdk-base/api/sdk-base.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public class com/mapbox/maps/MapboxStyleManager {
175175
public final fun getPixelRatio ()F
176176
public fun getStyleAtmosphereProperty (Ljava/lang/String;)Lcom/mapbox/maps/StylePropertyValue;
177177
public fun getStyleDefaultCamera ()Lcom/mapbox/maps/CameraOptions;
178+
public fun getStyleGlyphURL ()Ljava/lang/String;
178179
public fun getStyleImage (Ljava/lang/String;)Lcom/mapbox/maps/Image;
179180
public fun getStyleImportConfigProperties (Ljava/lang/String;)Lcom/mapbox/bindgen/Expected;
180181
public fun getStyleImportConfigProperty (Ljava/lang/String;Ljava/lang/String;)Lcom/mapbox/bindgen/Expected;
@@ -215,6 +216,7 @@ public class com/mapbox/maps/MapboxStyleManager {
215216
public fun setStyleCustomGeometrySourceTileData (Ljava/lang/String;Lcom/mapbox/maps/CanonicalTileID;Ljava/util/List;)Lcom/mapbox/bindgen/Expected;
216217
public fun setStyleCustomRasterSourceTileData (Ljava/lang/String;Ljava/util/List;)Lcom/mapbox/bindgen/Expected;
217218
public fun setStyleGeoJSONSourceData (Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/GeoJSONSourceData;)Lcom/mapbox/bindgen/Expected;
219+
public fun setStyleGlyphURL (Ljava/lang/String;)V
218220
public fun setStyleImportConfigProperties (Ljava/lang/String;Ljava/util/HashMap;)Lcom/mapbox/bindgen/Expected;
219221
public fun setStyleImportConfigProperty (Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/bindgen/Value;)Lcom/mapbox/bindgen/Expected;
220222
public fun setStyleLayerProperties (Ljava/lang/String;Lcom/mapbox/bindgen/Value;)Lcom/mapbox/bindgen/Expected;

sdk-base/src/main/java/com/mapbox/maps/MapboxStyleManager.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,32 @@ open class MapboxStyleManager @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
115115
return styleManager.styleSources
116116
}
117117

118+
/**
119+
* Get the glyph URL of the current style in use.
120+
*
121+
* @return A string containing a glyph URI.
122+
*/
123+
@MapboxExperimental
124+
@CallSuper
125+
@MainThread
126+
open fun getStyleGlyphURL(): String {
127+
ThreadChecker.throwIfNotMainThread()
128+
return styleManager.styleGlyphURL
129+
}
130+
131+
/**
132+
* Load the style glyphs from a provided URL.
133+
*
134+
* @param url URL where the glyphs should be loaded from.
135+
*/
136+
@MapboxExperimental
137+
@CallSuper
138+
@MainThread
139+
open fun setStyleGlyphURL(url: String) {
140+
ThreadChecker.throwIfNotMainThread()
141+
styleManager.styleGlyphURL = url
142+
}
143+
118144
/**
119145
* Returns the map style's transition options. By default, the style parser will attempt
120146
* to read the style default transition options, if any, fallback-ing to an immediate transition

sdk/api/sdk.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ public final class com/mapbox/maps/Style : com/mapbox/maps/MapboxStyleManager {
491491
public fun addStyleSource (Ljava/lang/String;Lcom/mapbox/bindgen/Value;)Lcom/mapbox/bindgen/Expected;
492492
public fun getStyleAtmosphereProperty (Ljava/lang/String;)Lcom/mapbox/maps/StylePropertyValue;
493493
public fun getStyleDefaultCamera ()Lcom/mapbox/maps/CameraOptions;
494+
public fun getStyleGlyphURL ()Ljava/lang/String;
494495
public fun getStyleImage (Ljava/lang/String;)Lcom/mapbox/maps/Image;
495496
public fun getStyleImportConfigProperties (Ljava/lang/String;)Lcom/mapbox/bindgen/Expected;
496497
public fun getStyleImportConfigProperty (Ljava/lang/String;Ljava/lang/String;)Lcom/mapbox/bindgen/Expected;
@@ -530,6 +531,7 @@ public final class com/mapbox/maps/Style : com/mapbox/maps/MapboxStyleManager {
530531
public fun setStyleCustomGeometrySourceTileData (Ljava/lang/String;Lcom/mapbox/maps/CanonicalTileID;Ljava/util/List;)Lcom/mapbox/bindgen/Expected;
531532
public fun setStyleCustomRasterSourceTileData (Ljava/lang/String;Ljava/util/List;)Lcom/mapbox/bindgen/Expected;
532533
public fun setStyleGeoJSONSourceData (Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/GeoJSONSourceData;)Lcom/mapbox/bindgen/Expected;
534+
public fun setStyleGlyphURL (Ljava/lang/String;)V
533535
public fun setStyleImportConfigProperties (Ljava/lang/String;Ljava/util/HashMap;)Lcom/mapbox/bindgen/Expected;
534536
public fun setStyleImportConfigProperty (Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/bindgen/Value;)Lcom/mapbox/bindgen/Expected;
535537
public fun setStyleLayerProperties (Ljava/lang/String;Lcom/mapbox/bindgen/Value;)Lcom/mapbox/bindgen/Expected;

sdk/src/main/java/com/mapbox/maps/Style.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,28 @@ class Style internal constructor(
10441044
return super.styleLayers
10451045
}
10461046

1047+
/**
1048+
* Get the glyph URL of the current style in use.
1049+
*
1050+
* @return A string containing a glyph URI.
1051+
*/
1052+
@MapboxExperimental
1053+
override fun getStyleGlyphURL(): String {
1054+
checkNativeStyle("getStyleGlyphURL")
1055+
return super.getStyleGlyphURL()
1056+
}
1057+
1058+
/**
1059+
* Load the style glyphs from a provided URL.
1060+
*
1061+
* @param url URL where the glyphs should be loaded from.
1062+
*/
1063+
@MapboxExperimental
1064+
override fun setStyleGlyphURL(url: String) {
1065+
checkNativeStyle("setStyleGlyphURL")
1066+
super.setStyleGlyphURL(url)
1067+
}
1068+
10471069
/**
10481070
* Gets style source parameters.
10491071
* In order to convert returned value to a json string please take a look at [Value.toJson].

sdk/src/test/java/com/mapbox/maps/StyleTest.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.graphics.Bitmap
44
import com.mapbox.bindgen.DataRef
55
import com.mapbox.bindgen.Value
66
import com.mapbox.geojson.Feature
7+
import com.mapbox.verifyOnce
78
import io.mockk.Runs
89
import io.mockk.every
910
import io.mockk.just
@@ -13,6 +14,7 @@ import io.mockk.spyk
1314
import io.mockk.unmockkStatic
1415
import io.mockk.verify
1516
import org.junit.After
17+
import org.junit.Assert.assertEquals
1618
import org.junit.Assert.assertFalse
1719
import org.junit.Assert.assertTrue
1820
import org.junit.Before
@@ -620,4 +622,18 @@ class StyleTest {
620622
style.setStyleCustomRasterSourceTileData(sourceId, tileData)
621623
verify { styleManager.setStyleCustomRasterSourceTileData(sourceId, tileData) }
622624
}
625+
626+
@Test
627+
fun getStyleGlyphURL() {
628+
every { styleManager.styleGlyphURL } returns "url"
629+
val url = style.getStyleGlyphURL()
630+
verifyOnce { styleManager.styleGlyphURL }
631+
assertEquals("url", url)
632+
}
633+
634+
@Test
635+
fun setStyleGlyphURL() {
636+
style.setStyleGlyphURL("url")
637+
verifyOnce { styleManager.styleGlyphURL = "url" }
638+
}
623639
}

0 commit comments

Comments
 (0)