#1929 - accessToken added as XML attribute option. Removed call to raw.txt for access token from MapFragment to test.
This commit is contained in:
@@ -174,6 +174,9 @@ public class MapView extends SurfaceView {
|
|||||||
if (typedArray.getString(R.styleable.MapView_styleUrl) != null) {
|
if (typedArray.getString(R.styleable.MapView_styleUrl) != null) {
|
||||||
setStyleUrl(typedArray.getString(R.styleable.MapView_styleUrl));
|
setStyleUrl(typedArray.getString(R.styleable.MapView_styleUrl));
|
||||||
}
|
}
|
||||||
|
if (typedArray.getString(R.styleable.MapView_accessToken) != null) {
|
||||||
|
setAccessToken(typedArray.getString(R.styleable.MapView_accessToken));
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
typedArray.recycle();
|
typedArray.recycle();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,14 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<attr name="centerLongitude" format="float" />
|
|
||||||
<attr name="centerLatitude" format="float" />
|
|
||||||
<attr name="zoomLevel" format="float" />
|
|
||||||
<attr name="direction" format="float" />
|
|
||||||
<attr name="zoomEnabled" format="boolean" />
|
|
||||||
<attr name="scrollEnabled" format="boolean" />
|
|
||||||
<attr name="rotateEnabled" format="boolean" />
|
|
||||||
<attr name="debugActive" format="boolean" />
|
|
||||||
<attr name="styleUrl" format="string" />
|
|
||||||
|
|
||||||
<declare-styleable name="MapView">
|
<declare-styleable name="MapView">
|
||||||
<attr name="centerLongitude" />
|
<attr name="centerLongitude" format="float" />
|
||||||
<attr name="centerLatitude" />
|
<attr name="centerLatitude" format="float" />
|
||||||
<attr name="zoomLevel" />
|
<attr name="zoomLevel" format="float" />
|
||||||
<attr name="direction" />
|
<attr name="direction" format="float" />
|
||||||
<attr name="zoomEnabled" />
|
<attr name="zoomEnabled" format="boolean" />
|
||||||
<attr name="scrollEnabled" />
|
<attr name="scrollEnabled" format="boolean" />
|
||||||
<attr name="rotateEnabled" />
|
<attr name="rotateEnabled" format="boolean" />
|
||||||
<attr name="debugActive" />
|
<attr name="debugActive" format="boolean" />
|
||||||
<attr name="styleUrl" />
|
<attr name="styleUrl" format="string" />
|
||||||
|
<attr name="accessToken" format="string"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class MapFragment extends Fragment {
|
|||||||
mMap = (MapView) inflater.inflate(R.layout.fragment_main, container, true);
|
mMap = (MapView) inflater.inflate(R.layout.fragment_main, container, true);
|
||||||
|
|
||||||
// Load the access token
|
// Load the access token
|
||||||
|
/*
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(getActivity().getApplicationContext().getResources().openRawResource(R.raw.token)));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(getActivity().getApplicationContext().getResources().openRawResource(R.raw.token)));
|
||||||
String line = reader.readLine();
|
String line = reader.readLine();
|
||||||
@@ -51,6 +52,7 @@ public class MapFragment extends Fragment {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Need to pass on any saved state to the map
|
// Need to pass on any saved state to the map
|
||||||
mMap.onCreate(savedInstanceState);
|
mMap.onCreate(savedInstanceState);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.mapbox.mapboxgl.views.MapView xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.mapbox.mapboxgl.views.MapView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="match_parent" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user