Add style string resources

Use _ in public resources ids
Make visibility attributes enums
Make attrs public
Remove info window margin public value
Reformat XML code
Test app uses XML map properties for InfoWindow activities
Fixes #2703
This commit is contained in:
Leith Bade
2015-10-22 11:16:39 +11:00
parent 2daa5f14a8
commit 729a793b0e
15 changed files with 161 additions and 109 deletions

View File

@@ -34,9 +34,6 @@ public class InfoWindowActivity extends AppCompatActivity {
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setAccessToken(ApiAccess.getToken(this));
mMapView.onCreate(savedInstanceState);
mMapView.setStyle(Style.MAPBOX_STREETS);
mMapView.setCenterCoordinate(new LatLng(38.897705003219784, -77.03655168667463));
mMapView.setZoomLevel(15);
mMapView.addMarker(new MarkerOptions()
.title("Intersection")

View File

@@ -37,7 +37,6 @@ public class InfoWindowAdapterActivity extends AppCompatActivity {
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setAccessToken(ApiAccess.getToken(this));
mMapView.onCreate(savedInstanceState);
mMapView.setStyle(Style.MAPBOX_STREETS);
mMapView.setInfoWindowAdapter(new MapView.InfoWindowAdapter() {
private int tenDp = (int) getResources().getDimension(R.dimen.attr_margin);
@@ -59,9 +58,6 @@ public class InfoWindowAdapterActivity extends AppCompatActivity {
mMapView.addMarker(generateMarker("Vatican City", 41.902916, 12.453389, "#009688"));
mMapView.addMarker(generateMarker("San Marino", 43.942360, 12.457777, "#795548"));
mMapView.addMarker(generateMarker("Liechtenstein", 47.166000, 9.555373, "#FF5722"));
mMapView.setCenterCoordinate(new LatLng(47.798202, 7.573781));
mMapView.setZoomLevel(4);
}
private MarkerOptions generateMarker(String title, double lat, double lng, String color) {

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@@ -10,11 +11,15 @@
android:layout_height="wrap_content"
android:background="@color/primary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<com.mapbox.mapboxsdk.views.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
app:style_url="@string/style_mapbox_streets"
app:center_latitude="38.897705003219784"
app:center_longitude="-77.03655168667463"
app:zoom_level="15" />
</LinearLayout>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@@ -10,11 +11,15 @@
android:layout_height="wrap_content"
android:background="@color/primary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<com.mapbox.mapboxsdk.views.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
app:style_url="@string/style_mapbox_streets"
app:center_latitude="47.798202"
app:center_longitude="7.573781"
app:zoom_level="4" />
</LinearLayout>