-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
858a11c
to
03a9fa3
Compare
@@ -82,3 +83,6 @@ apply from: "${rootDir}/gradle/gradle-checkstyle.gradle" | |||
apply from: "${rootDir}/gradle/gradle-lint.gradle" | |||
|
|||
|
|||
|
|||
apply plugin: 'kotlin-android' | |||
apply plugin: 'kotlin-android-extensions' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
val point = featureCollection.features()?.find { | ||
it.id() == id | ||
}?.geometry() as Point | ||
draggedMarkerPositionTv.text = String.format("Dragged marker's position: %.4f, %.4f", point.latitude(), point.longitude()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more kotlin friendly way to do string formatting?
|
||
private fun MapboxMap.queryRenderedSymbols(latLng: LatLng, layerId: String): List<Feature> { | ||
return this.queryRenderedFeatures(this.projection.toScreenLocation(latLng), layerId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving these extension functions!
03a9fa3
to
d580765
Compare
I have tried to use |
// Setting up markers icon, source and layer | ||
mapboxMap.addImage(markerImageId, IconFactory.getInstance(this).defaultMarker().bitmap) | ||
mapboxMap.addSource(source) | ||
mapboxMap.addLayer(layer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steps to replicate the issue.
-
Use the API key which has a predefined style with some custom layers created using mapbox studio.
-
Apply the style using setStyleUrl()
-
Try to add this layer in
onStyleLoaded()
callback.
It was throwing a segmentation fault error when I tried this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was caused because I was trying to add the source before the style has loaded. I tried adding source and layer both in onStyleLoaded
callback and its working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad to hear that @iamanvesh! Let us know if you run into any other issues.
Refs #2450.
Adds an example of how to build a class that is responsible for handling dragged symbols and disptaching callbacks with the drag state.
Also, adds Kotlin dependencies to the test app.