summaryrefslogtreecommitdiff
path: root/android/java/lib/src/main/java
diff options
context:
space:
mode:
authorLeith Bade <leith@leithalweapon.geek.nz>2014-11-08 11:56:30 +1100
committerLeith Bade <leith@leithalweapon.geek.nz>2014-11-08 11:56:30 +1100
commit7de5c03cfbe7ab3af62a642b986fcfae7feb45ee (patch)
tree9abe35a24c3a38d74e456e508feda68e38652ea9 /android/java/lib/src/main/java
parent0ac4247f72b37462813f9ef1c4271108614a3189 (diff)
downloadqtlocation-mapboxgl-7de5c03cfbe7ab3af62a642b986fcfae7feb45ee.tar.gz
Move style url and spi key to java
Try 565 config then 8888 Remove unused perm
Diffstat (limited to 'android/java/lib/src/main/java')
-rw-r--r--android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/MapView.java19
-rw-r--r--android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/NativeMapView.java6
2 files changed, 11 insertions, 14 deletions
diff --git a/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/MapView.java b/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/MapView.java
index 51f627f63d..f76750c5c2 100644
--- a/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/MapView.java
+++ b/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/MapView.java
@@ -57,7 +57,10 @@ public class MapView extends SurfaceView {
private NativeMapView mNativeMapView;
// Used to style the map
- private String mDefaultStyleJSON;
+ private String mStyleUrl;
+
+ // Used to load map tiles
+ private String mApiKey;
// Touch gesture detectors
private GestureDetector mGestureDetector;
@@ -115,18 +118,12 @@ public class MapView extends SurfaceView {
return;
}
- // Load the map style
- try {
- mDefaultStyleJSON = IOUtils.toString(context.getResources()
- // .openRawResource(R.raw.style_leith), Charsets.UTF_8);
- .openRawResource(R.raw.style), Charsets.UTF_8);
- } catch (IOException e) {
- throw new RuntimeException(
- "Couldn't load default style JSON resource", e);
- }
+ // Load the map style and API key
+ mStyleUrl = "https://mapbox.github.io/mapbox-gl-styles/styles/bright-v6.json";
+ mApiKey = "pk.eyJ1IjoibGpiYWRlIiwiYSI6IlJSQ0FEZ2MifQ.7mE4aOegldh3595AG9dxpQ";
// Create the NativeMapView
- mNativeMapView = new NativeMapView(this, mDefaultStyleJSON);
+ mNativeMapView = new NativeMapView(this, mStyleUrl, mApiKey);
// Load the attributes
TypedArray typedArray = context.obtainStyledAttributes(attrs,
diff --git a/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/NativeMapView.java b/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/NativeMapView.java
index bd72846d99..5aa692e2af 100644
--- a/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/NativeMapView.java
+++ b/android/java/lib/src/main/java/com/mapbox/mapboxgl/lib/NativeMapView.java
@@ -37,11 +37,11 @@ class NativeMapView {
// Constructors
//
- public NativeMapView(MapView mapView, String defaultStyleJSON) {
+ public NativeMapView(MapView mapView, String styleUrl, String apiKey) {
mMapView = mapView;
// Create the NativeMapView
- mNativeMapViewPtr = nativeCreate(defaultStyleJSON);
+ mNativeMapViewPtr = nativeCreate(styleUrl, apiKey);
}
//
@@ -359,7 +359,7 @@ class NativeMapView {
super.finalize();
}
- private native long nativeCreate(String defaultStyleJSON);
+ private native long nativeCreate(String styleUrl, String apiKey);
private native void nativeDestroy(long nativeMapViewPtr);