Skip to content

Commit 87b07ad

Browse files
committed
fix: remaining android-maps-utils 5.1.1 API breaks
Two more spots the compiler hadn't reached yet in the previous fix pass: - GeoJsonPointStyle (Kotlin, android-maps-utils 5.1.1) exposes isDraggable()/setDraggable(), getTitle()/setTitle(), getSnippet()/setSnippet() as plain functions, not var properties, so app-utils-ktx/GeoJSON.kt's `pointStyle.isDraggable = true` style assignments don't compile; switched to explicit setter calls. - KmlContainer.getProperty() now returns String? (nullable); KML.kt passed it straight to Log.i's non-null second parameter, added !! (guarded by the existing hasProperty() check just above it). - The JSONObject-argument GeoJsonLayer constructor is now annotated @throws(JSONException::class) in Kotlin, which surfaces in Java as a checked exception. snippets/app-utils (Java)'s addGeoJsonLayerJsonObject() didn't declare it; added `throws JSONException` to match its sibling method's existing pattern.
1 parent 5b87f73 commit 87b07ad

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

snippets/app-utils-ktx/src/main/java/com/example/app_utils_ktx/GeoJSON.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ internal class GeoJSON {
9191

9292
// [START maps_android_util_geojson_style]
9393
val pointStyle = layer.getDefaultPointStyle()
94-
pointStyle.isDraggable = true
95-
pointStyle.title = "Hello, World!"
96-
pointStyle.snippet = "I am a draggable marker"
94+
pointStyle.setDraggable(true)
95+
pointStyle.setTitle("Hello, World!")
96+
pointStyle.setSnippet("I am a draggable marker")
9797
// [END maps_android_util_geojson_style]
9898

9999
// [START maps_android_util_geojson_style_specific]

snippets/app-utils-ktx/src/main/java/com/example/app_utils_ktx/KML.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ internal class KML {
6868
// [START maps_android_utils_kml_access_properties]
6969
for (container in layer.getContainers()) {
7070
if (container.hasProperty("name")) {
71-
Log.i("KML", container.getProperty("name"))
71+
Log.i("KML", container.getProperty("name")!!)
7272
}
7373
}
7474
// [END maps_android_utils_kml_access_properties]

snippets/app-utils/src/main/java/com/example/app_utils/GeoJSON.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
class GeoJSON {
4242
private GoogleMap map;
4343

44-
private void addGeoJsonLayerJsonObject() {
44+
private void addGeoJsonLayerJsonObject() throws JSONException {
4545
// [START maps_android_util_geojson_add_jsonobject]
4646
JSONObject geoJsonData = // JSONObject containing the GeoJSON data
4747
// [START_EXCLUDE silent]

0 commit comments

Comments
 (0)