[android] - expose setStyleJson and getStyleJson

This commit is contained in:
Tobrun Van Nuland
2017-08-07 10:11:13 +02:00
committed by Tobrun
parent 688431c663
commit 1300e89c0b
8 changed files with 165 additions and 33 deletions

View File

@@ -581,7 +581,7 @@ public class MapView extends FrameLayout {
try {
onMapChangedListener.onMapChanged(rawChange);
} catch (RuntimeException err) {
Timber.e("Exception (%s) in MapView.OnMapChangedListener: %s", err.getClass(), err.getMessage());
Timber.e(err, "Exception in MapView.OnMapChangedListener");
}
}
}

View File

@@ -1088,7 +1088,7 @@ public final class MapboxMap {
}
/**
* Returns the map style currently displayed in the map view.
* Returns the map style url currently displayed in the map view.
*
* @return The URL of the map style
*/
@@ -1097,6 +1097,27 @@ public final class MapboxMap {
return nativeMapView.getStyleUrl();
}
/**
* Loads a new map style from a json string.
* <p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
* sent.
* </p>
*/
public void setStyleJson(@NonNull String styleJson) {
nativeMapView.setStyleJson(styleJson);
}
/**
* Returns the map style json currently displayed in the map view.
*
* @return The json of the map style
*/
public String getStyleJson() {
return nativeMapView.getStyleJson();
}
//
// Annotations
//