Skip to content

Commit

Permalink
Add more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kiryldz committed Mar 22, 2022
1 parent 3cd7be1 commit f26c591
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sdk/src/main/java/com/mapbox/maps/MapView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ open class MapView : FrameLayout, MapPluginProviderDelegate, MapControllable {

/**
* Returns a [MapboxMap] object that can be used to interact with the map.
*
* Note: keeping the reference to an invalid [MapboxMap] instance introduces significant native memory leak,
* see [MapboxMap.isValid] for more details.
*
* @return [MapboxMap] object to interact with the map.
*/
override fun getMapboxMap(): MapboxMap = mapController.getMapboxMap()
Expand Down
10 changes: 9 additions & 1 deletion sdk/src/main/java/com/mapbox/maps/MapboxMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ class MapboxMap :
}

/**
* Get the Style of the map asynchronously.
* Get the [Style] of the map asynchronously.
*
* Note: keeping the reference to an invalid [Style] instance introduces significant native memory leak,
* see [Style.isValid] for more details.
*
* @param onStyleLoaded the callback to be invoked when the style is fully loaded
*/
Expand All @@ -363,6 +366,11 @@ class MapboxMap :

/**
* Get the Style of the map synchronously, will return null is style is not loaded yet.
*
* Note: keeping the reference to an invalid [Style] instance introduces significant native memory leak,
* see [Style.isValid] for more details.
*
* @return currently loaded [Style] object or NULL if it is not loaded.
*/
fun getStyle(): Style? {
checkNativeMap("getStyle")
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/mapbox/maps/StyleObserver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal class StyleObserver(
override fun onStyleLoaded(eventData: StyleLoadedEventData) {
val style = Style(nativeMap, pixelRatio)
// cache loaded style as users may have saved strong reference in their code -
// so we want to mark that style as not valid when MapView will be destroyed
// so we want to mark that style as not valid when MapView is destroyed
loadedStyleList.add(style)
styleLoadedListener.onStyleLoaded(style)

Expand Down

0 comments on commit f26c591

Please sign in to comment.