Move style url and spi key to java

Try 565 config then 8888
Remove unused perm
This commit is contained in:
Leith Bade
2014-11-08 11:56:30 +11:00
parent 0ac4247f72
commit 7de5c03cfb
6 changed files with 45 additions and 36 deletions

View File

@@ -5,8 +5,6 @@
<uses-feature android:glEsVersion="0x00020000" />
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> -->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -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,

View File

@@ -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);