diff options
73 files changed, 218 insertions, 267 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index d7a61af7eb..3b4db2e62a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -92,8 +92,6 @@ public final class MapboxMap { // Map configuration setDebugActive(options.getDebugActive()); setApiBaseUrl(options); - setStyleUrl(options); - setStyleJson(options); setPrefetchesTiles(options); } @@ -851,25 +849,6 @@ public final class MapboxMap { }); } - /** - * Loads a new map style from MapboxMapOptions if available. - * - * @param options the object containing the style url - */ - private void setStyleUrl(@NonNull MapboxMapOptions options) { - String style = options.getStyleUrl(); - if (!TextUtils.isEmpty(style)) { - setStyle(new Style.Builder().fromUrl(style)); - } - } - - private void setStyleJson(@NonNull MapboxMapOptions options) { - String styleJson = options.getStyleJson(); - if (!TextUtils.isEmpty(styleJson)) { - setStyle(new Style.Builder().fromJson(styleJson)); - } - } - // // Annotations // @@ -1839,7 +1818,7 @@ public final class MapboxMap { /** * Returns the {@link LocationComponent} that can be used to display user's location on the map. * <p> - * Use {@link LocationComponent#activateLocationComponent(Context)} or any overload to activate the component, + * Use {@link LocationComponent#activateLocationComponent(Context, Style)} or any overload to activate the component, * then, enable it with {@link LocationComponent#setLocationComponentEnabled(boolean)}. * <p> * You can customize the location icon and more with {@link com.mapbox.mapboxsdk.location.LocationComponentOptions}. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index a5a6ede1dd..8c91ad9174 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -77,9 +77,6 @@ public class MapboxMapOptions implements Parcelable { @ColorInt private int foregroundLoadColor; - private String styleUrl; - private String styleJson; - private float pixelRatio; private boolean crossSourceCollisions = true; @@ -122,8 +119,6 @@ public class MapboxMapOptions implements Parcelable { zoomGesturesEnabled = in.readByte() != 0; doubleTapGesturesEnabled = in.readByte() != 0; - styleUrl = in.readString(); - styleJson = in.readString(); apiBaseUrl = in.readString(); textureMode = in.readByte() != 0; translucentTextureSurface = in.readByte() != 0; @@ -149,8 +144,6 @@ public class MapboxMapOptions implements Parcelable { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.mapbox_MapView, 0, 0); try { mapboxMapOptions.camera(new CameraPosition.Builder(typedArray).build()); - mapboxMapOptions.styleUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_styleUrl)); - mapboxMapOptions.styleJson(typedArray.getString(R.styleable.mapbox_MapView_mapbox_styleJson)); mapboxMapOptions.apiBaseUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_apiBaseUrl)); mapboxMapOptions.zoomGesturesEnabled( @@ -267,30 +260,6 @@ public class MapboxMapOptions implements Parcelable { } /** - * Specifies the styleUrl url associated with a map view. - * - * @param styleUrl Url to be used to load a styleUrl - * @return This - */ - @NonNull - public MapboxMapOptions styleUrl(String styleUrl) { - this.styleUrl = styleUrl; - return this; - } - - /** - * Specifies the styleJson associated with a map view. - * - * @param styleJson json to used as style - * @return This - */ - @NonNull - public MapboxMapOptions styleJson(String styleJson) { - this.styleJson = styleJson; - return this; - } - - /** * Specifies the used debug type for a map view. * * @param enabled True is debug is enabled @@ -777,24 +746,6 @@ public class MapboxMapOptions implements Parcelable { } /** - * Get the current configured styleUrl url for a map view. - * - * @return Style url to be used. - */ - public String getStyleUrl() { - return styleUrl; - } - - /** - * Get the current configured styleJson for a map view. - * - * @return Style json to be used. - */ - public String getStyleJson() { - return styleJson; - } - - /** * Get the current configured rotate gesture state for a map view. * * @return True indicates gesture is enabled @@ -972,8 +923,6 @@ public class MapboxMapOptions implements Parcelable { dest.writeByte((byte) (zoomGesturesEnabled ? 1 : 0)); dest.writeByte((byte) (doubleTapGesturesEnabled ? 1 : 0)); - dest.writeString(styleUrl); - dest.writeString(styleJson); dest.writeString(apiBaseUrl); dest.writeByte((byte) (textureMode ? 1 : 0)); dest.writeByte((byte) (translucentTextureSurface ? 1 : 0)); @@ -1061,13 +1010,6 @@ public class MapboxMapOptions implements Parcelable { if (!Arrays.equals(attributionMargins, options.attributionMargins)) { return false; } - if (styleUrl != null ? !styleUrl.equals(options.styleUrl) : options.styleUrl != null) { - return false; - } - - if (styleJson != null ? !styleJson.equals(options.styleJson) : options.styleJson != null) { - return false; - } if (apiBaseUrl != null ? !apiBaseUrl.equals(options.apiBaseUrl) : options.apiBaseUrl != null) { return false; @@ -1122,8 +1064,6 @@ public class MapboxMapOptions implements Parcelable { result = 31 * result + (apiBaseUrl != null ? apiBaseUrl.hashCode() : 0); result = 31 * result + (textureMode ? 1 : 0); result = 31 * result + (translucentTextureSurface ? 1 : 0); - result = 31 * result + (styleUrl != null ? styleUrl.hashCode() : 0); - result = 31 * result + (styleJson != null ? styleJson.hashCode() : 0); result = 31 * result + (prefetchesTiles ? 1 : 0); result = 31 * result + (zMediaOverlay ? 1 : 0); result = 31 * result + (localIdeographFontFamily != null ? localIdeographFontFamily.hashCode() : 0); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml index 6cf4a8db3c..75943e0aa2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml @@ -9,8 +9,6 @@ <!-- Exposed attrs.xml --> <!--Configuration--> - <public name="mapbox_styleUrl" type="attr" /> - <public name="mapbox_styleJson" type="attr" /> <public name="mapbox_apiBaseUrl" type="attr" /> <public name="mapbox_localIdeographFontFamily" type="attr" /> <public name="mapbox_cross_source_collisions" type="attr" /> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml index 8dac565c22..cb1dff80a1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml @@ -3,8 +3,6 @@ <declare-styleable name="mapbox_MapView"> <!--Configuration--> - <attr name="mapbox_styleUrl" format="string"/> - <attr name="mapbox_styleJson" format="string"/> <attr name="mapbox_apiBaseUrl" format="string"/> <attr name="mapbox_localIdeographFontFamily" format="string"/> <attr name="mapbox_cross_source_collisions" format="boolean"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java index 0bec0d4502..f03d1fb15f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java @@ -146,13 +146,6 @@ public class MapboxMapOptionsTest { } @Test - public void testStyleUrl() { - assertEquals(Style.DARK, new MapboxMapOptions().styleUrl(Style.DARK).getStyleUrl()); - assertNotEquals(Style.LIGHT, new MapboxMapOptions().styleUrl(Style.DARK).getStyleUrl()); - assertNull(new MapboxMapOptions().getStyleUrl()); - } - - @Test public void testCamera() { CameraPosition position = new CameraPosition.Builder().build(); assertEquals(new CameraPosition.Builder(position).build(), new MapboxMapOptions().camera(position).getCamera()); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java index 9c0715888a..7e442aa802 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java @@ -77,6 +77,7 @@ public class AnimatedSymbolLayerActivity extends AppCompatActivity { mapView.getMapAsync(map -> { this.mapboxMap = map; map.setStyle(Style.MAPBOX_STREETS, style -> { + this.style = style; setupCars(); animateRandomRoutes(); animateTaxi(); @@ -184,7 +185,7 @@ public class AnimatedSymbolLayerActivity extends AppCompatActivity { } private void updatePassengerSource() { - GeoJsonSource source = mapboxMap.getStyle().getSourceAs(PASSENGER_SOURCE); + GeoJsonSource source = style.getSourceAs(PASSENGER_SOURCE); FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] { Feature.fromGeometry( Point.fromLngLat( @@ -261,7 +262,7 @@ public class AnimatedSymbolLayerActivity extends AppCompatActivity { randomCarSource = new GeoJsonSource(RANDOM_CAR_SOURCE, featuresFromRoutes()); style.addSource(randomCarSource); - mapboxMap.getStyle().addImage(RANDOM_CAR_IMAGE_ID, + style.addImage(RANDOM_CAR_IMAGE_ID, ((BitmapDrawable) getResources().getDrawable(R.drawable.ic_car_top)).getBitmap()); SymbolLayer symbolLayer = new SymbolLayer(RANDOM_CAR_LAYER, RANDOM_CAR_SOURCE); @@ -286,7 +287,7 @@ public class AnimatedSymbolLayerActivity extends AppCompatActivity { ) }); - mapboxMap.getStyle().addImage(PASSENGER, + style.addImage(PASSENGER, ((BitmapDrawable) getResources().getDrawable(R.drawable.icon_burned)).getBitmap()); GeoJsonSource geoJsonSource = new GeoJsonSource(PASSENGER_SOURCE, featureCollection); @@ -312,7 +313,7 @@ public class AnimatedSymbolLayerActivity extends AppCompatActivity { FeatureCollection featureCollection = FeatureCollection.fromFeatures(new Feature[] {feature}); taxi = new Car(feature, passenger, getDuration()); - mapboxMap.getStyle().addImage(TAXI, + style.addImage(TAXI, ((BitmapDrawable) getResources().getDrawable(R.drawable.ic_taxi_top)).getBitmap()); taxiSource = new GeoJsonSource(TAXI_SOURCE, featureCollection); style.addSource(taxiSource); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java index 1c798b1d7a..05337081dc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java @@ -11,13 +11,14 @@ import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; - import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil; +import timber.log.Timber; import java.io.IOException; import java.lang.ref.WeakReference; @@ -26,8 +27,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import timber.log.Timber; - /** * Test activity showcasing adding a large amount of Markers. */ @@ -43,9 +42,14 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView super.onCreate(savedInstanceState); setContentView(R.layout.activity_marker_bulk); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> BulkMarkerActivity.this.mapboxMap = mapboxMap); + mapView.getMapAsync(this::initMap); + } + + private void initMap(MapboxMap mapboxMap) { + this.mapboxMap = mapboxMap; + mapboxMap.setStyle(Style.MAPBOX_STREETS); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java index 0ca56da4f4..fe71020eb2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java @@ -58,7 +58,6 @@ public class PolygonActivity extends AppCompatActivity implements OnMapReadyCall MapboxMapOptions options = new MapboxMapOptions() .attributionTintColor(RED_COLOR) .compassFadesWhenFacingNorth(false) - .styleUrl(Style.MAPBOX_STREETS) .camera(new CameraPosition.Builder() .target(new LatLng(45.520486, -122.673541)) .zoom(12) @@ -77,6 +76,7 @@ public class PolygonActivity extends AppCompatActivity implements OnMapReadyCall @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; + map.setStyle(Style.MAPBOX_STREETS); map.setOnPolygonClickListener(polygon -> Toast.makeText( PolygonActivity.this, diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java index 28a89f4b42..855b686691 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java @@ -13,6 +13,7 @@ import com.mapbox.mapboxsdk.annotations.PolylineOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import java.util.ArrayList; @@ -61,11 +62,11 @@ public class PolylineActivity extends AppCompatActivity { polylineOptions.addAll(getAllPolylines()); } - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { PolylineActivity.this.mapboxMap = mapboxMap; - + mapboxMap.setStyle(Style.SATELLITE_STREETS); mapboxMap.setOnPolylineClickListener(polyline -> Toast.makeText( PolylineActivity.this, "You clicked on polyline with id = " + polyline.getId(), diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java index 62179f151c..5bd59507a9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java @@ -11,6 +11,7 @@ import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import java.text.DecimalFormat; @@ -53,6 +54,8 @@ public class PressForMarkerActivity extends AppCompatActivity { return false; }); + mapboxMap.setStyle(Style.MAPBOX_STREETS); + if (savedInstanceState != null) { markerList = savedInstanceState.getParcelableArrayList(STATE_MARKER_LIST); if (markerList != null) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java index 03630fccbc..48d61abc2a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java @@ -24,6 +24,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -81,6 +82,7 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; + map.setStyle(Style.MAPBOX_STREETS); initFab(); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java index ebad68963f..fe0ab8f26b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java @@ -20,6 +20,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import timber.log.Timber; @@ -44,7 +45,7 @@ public class CameraPositionActivity extends FragmentActivity implements OnMapRea toolbar.setNavigationIcon(R.drawable.ic_ab_back); toolbar.setNavigationOnClickListener(v -> finish()); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); } @@ -52,12 +53,14 @@ public class CameraPositionActivity extends FragmentActivity implements OnMapRea @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; - toggleLogCameraChanges(); + map.setStyle(Style.SATELLITE_STREETS, style -> { + // add a listener to FAB + fab = findViewById(R.id.fab); + fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, R.color.primary)); + fab.setOnClickListener(this); + }); - // add a listener to FAB - fab = (FloatingActionButton) findViewById(R.id.fab); - fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, R.color.primary)); - fab.setOnClickListener(this); + toggleLogCameraChanges(); // listen to long click events to toggle logging camera changes mapboxMap.addOnMapLongClickListener(this); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java index ab73fecbe1..f3bfe768be 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java @@ -40,14 +40,13 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); - mapView.addOnDidFinishLoadingStyleListener(() -> { - Timber.d("Style Loaded"); - }); + mapView.addOnDidFinishLoadingStyleListener(() -> Timber.d("Style Loaded")); } @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; + mapboxMap.setStyle(Style.MAPBOX_STREETS); mapboxMap.setMinZoomPreference(3); mapboxMap.setMaxZoomPreference(5); mapboxMap.addOnMapClickListener(clickListener); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index fe65d7394e..182fb441cd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -15,6 +15,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; @@ -61,6 +62,8 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; + mapboxMap.setStyle(Style.DARK); + UiSettings uiSettings = mapboxMap.getUiSettings(); uiSettings.setLogoEnabled(false); uiSettings.setAttributionEnabled(false); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java index 8803780dea..d7e3b8eccf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java @@ -7,6 +7,7 @@ import android.support.v7.app.AppCompatActivity; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -23,14 +24,16 @@ public class EspressoTestActivity extends AppCompatActivity implements OnMapRead setContentView(R.layout.activity_espresso_test); // Initialize map as normal - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); } @Override - public void onMapReady(@NonNull MapboxMap map) { - mapboxMap = map; + public void onMapReady(@NonNull final MapboxMap map) { + map.setStyle(new Style.Builder().fromUrl("asset://streets.json"), + style -> mapboxMap = map + ); } public MapboxMap getMapboxMap() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java index 1bd7b09a99..f2f22bae9e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java @@ -18,6 +18,7 @@ import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; @@ -70,13 +71,15 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { - QueryRenderedFeaturesPropertiesActivity.this.mapboxMap = mapboxMap; + mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> { + QueryRenderedFeaturesPropertiesActivity.this.mapboxMap = mapboxMap; - // Add custom window adapter - addCustomInfoWindowAdapter(mapboxMap); + // Add custom window adapter + addCustomInfoWindowAdapter(mapboxMap); - // Add a click listener - mapboxMap.addOnMapClickListener(mapClickListener); + // Add a click listener + mapboxMap.addOnMapClickListener(mapClickListener); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java index 125f7bf539..472b9b7d57 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java @@ -44,7 +44,6 @@ public class MapFragmentActivity extends AppCompatActivity implements MapFragmen private MapboxMapOptions createFragmentOptions() { MapboxMapOptions options = new MapboxMapOptions(); - options.styleUrl(Style.OUTDOORS); options.scrollGesturesEnabled(false); options.zoomGesturesEnabled(false); @@ -72,6 +71,7 @@ public class MapFragmentActivity extends AppCompatActivity implements MapFragmen @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; + mapboxMap.setStyle(Style.OUTDOORS); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java index 2305fdf16c..f16f01e2d5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MultiMapActivity.java @@ -1,8 +1,10 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment; import android.os.Bundle; +import android.support.v4.app.FragmentManager; import android.support.v7.app.AppCompatActivity; - +import com.mapbox.mapboxsdk.maps.Style; +import com.mapbox.mapboxsdk.maps.SupportMapFragment; import com.mapbox.mapboxsdk.testapp.R; /** @@ -14,5 +16,16 @@ public class MultiMapActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_multi_map); + + FragmentManager fragmentManager = getSupportFragmentManager(); + initFragmentStyle(fragmentManager, R.id.map1, Style.MAPBOX_STREETS); + initFragmentStyle(fragmentManager, R.id.map2, Style.LIGHT); + initFragmentStyle(fragmentManager, R.id.map3, Style.SATELLITE_STREETS); + initFragmentStyle(fragmentManager, R.id.map4, Style.DARK); + } + + private void initFragmentStyle(FragmentManager fragmentManager, int fragmentId, String styleId) { + ((SupportMapFragment) fragmentManager.findFragmentById(fragmentId)) + .getMapAsync(mapboxMap -> mapboxMap.setStyle(styleId)); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt index c44d544e40..f8f53f9ffd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/NestedViewPagerActivity.kt @@ -16,6 +16,7 @@ import android.widget.TextView import com.mapbox.mapboxsdk.camera.CameraPosition import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.maps.MapboxMapOptions +import com.mapbox.mapboxsdk.maps.OnMapReadyCallback import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.maps.SupportMapFragment import com.mapbox.mapboxsdk.testapp.R @@ -113,26 +114,27 @@ class NestedViewPagerActivity : AppCompatActivity() { options.zoomGesturesEnabled(false) when (position) { 0 -> { - options.styleUrl(Style.MAPBOX_STREETS) options.camera(CameraPosition.Builder().target(LatLng(34.920526, 102.634774)).zoom(3.0).build()) - return SupportMapFragment.newInstance(options) + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } + return fragment } 1 -> { return EmptyFragment.newInstance() } 2 -> { - options.styleUrl(Style.DARK) options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build()) - return SupportMapFragment.newInstance(options) - } + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.DARK) } + return fragment } 3 -> { return EmptyFragment.newInstance() } 4 -> { - options.styleUrl(Style.SATELLITE) options.camera(CameraPosition.Builder().target(LatLng(-25.007786, 133.623852)).zoom(3.0).build()) - return SupportMapFragment.newInstance(options) - } + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) } + return fragment } 5 -> { return EmptyFragment.newInstance() } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java index 30e6fa0565..4baf40d51b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java @@ -45,7 +45,6 @@ public class SupportMapFragmentActivity extends AppCompatActivity implements Map private MapboxMapOptions createFragmentOptions() { MapboxMapOptions options = new MapboxMapOptions(); - options.styleUrl(Style.MAPBOX_STREETS); options.scrollGesturesEnabled(false); options.zoomGesturesEnabled(false); @@ -73,6 +72,7 @@ public class SupportMapFragmentActivity extends AppCompatActivity implements Map @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; + mapboxMap.setStyle(Style.SATELLITE); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java index 826281554d..63c63b690e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java @@ -6,11 +6,10 @@ import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.maps.SupportMapFragment; import com.mapbox.mapboxsdk.testapp.R; @@ -52,19 +51,25 @@ public class ViewPagerActivity extends AppCompatActivity { switch (position) { case 0: - options.styleUrl(Style.MAPBOX_STREETS); options.camera(new CameraPosition.Builder().target(new LatLng(34.920526, 102.634774)).zoom(3).build()); fragment = SupportMapFragment.newInstance(options); + fragment.getMapAsync(mapboxMap -> { + mapboxMap.setStyle(Style.MAPBOX_STREETS); + }); break; case 1: - options.styleUrl(Style.DARK); options.camera(new CameraPosition.Builder().target(new LatLng(62.326440, 92.764913)).zoom(3).build()); fragment = SupportMapFragment.newInstance(options); + fragment.getMapAsync(mapboxMap -> { + mapboxMap.setStyle(Style.DARK); + }); break; case 2: - options.styleUrl(Style.SATELLITE); options.camera(new CameraPosition.Builder().target(new LatLng(-25.007786, 133.623852)).zoom(3).build()); fragment = SupportMapFragment.newInstance(options); + fragment.getMapAsync(mapboxMap -> { + mapboxMap.setStyle(Style.SATELLITE); + }); break; } return fragment; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java index d37b876c84..71757c84a8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java @@ -5,9 +5,9 @@ import android.os.Bundle; import android.support.v4.print.PrintHelper; import android.support.v7.app.AppCompatActivity; import android.view.View; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -25,18 +25,23 @@ public class PrintActivity extends AppCompatActivity implements MapboxMap.Snapsh mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> PrintActivity.this.mapboxMap = mapboxMap); + mapView.getMapAsync(this::initMap); final View fab = findViewById(R.id.fab); if (fab != null) { fab.setOnClickListener(view -> { - if (mapboxMap.getStyle() != null) { + if (mapboxMap != null && mapboxMap.getStyle() != null) { mapboxMap.snapshot(PrintActivity.this); } }); } } + private void initMap(MapboxMap mapboxMap) { + this.mapboxMap = mapboxMap; + mapboxMap.setStyle(Style.MAPBOX_STREETS); + } + @Override public void onSnapshotReady(Bitmap snapshot) { PrintHelper photoPrinter = new PrintHelper(this); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java index 95bb0d2324..5baa214698 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java @@ -13,6 +13,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import java.text.DecimalFormat; @@ -63,8 +64,10 @@ public class InfoWindowActivity extends AppCompatActivity @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; - addMarkers(); - addInfoWindowListeners(); + mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> { + addMarkers(); + addInfoWindowListeners(); + }); } private void addMarkers() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java index d8dea0e3b5..5140a969d2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java @@ -12,6 +12,7 @@ import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.model.annotations.CityStateMarker; import com.mapbox.mapboxsdk.testapp.model.annotations.CityStateMarkerOptions; @@ -30,12 +31,14 @@ public class InfoWindowAdapterActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_infowindow_adapter); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { mapboxMap = map; - addMarkers(); - addCustomInfoWindowAdapter(); + map.setStyle(Style.MAPBOX_STREETS, style -> { + addMarkers(); + addCustomInfoWindowAdapter(); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java index 7937f94ecc..ea827dc4cd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java @@ -80,7 +80,6 @@ public class LocationMapChangeActivity extends AppCompatActivity implements OnMa @SuppressLint("MissingPermission") private void activateLocationComponent(@NonNull Style style) { LocationComponent locationComponent = mapboxMap.getLocationComponent(); - locationComponent.onStart(); locationComponent.activateLocationComponent(this, style); locationComponent.setLocationComponentEnabled(true); locationComponent.setRenderMode(RenderMode.COMPASS); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java index a00a0784ca..068aa487d2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java @@ -12,7 +12,6 @@ import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Toast; - import com.mapbox.android.core.location.LocationEngineRequest; import com.mapbox.android.core.permissions.PermissionsListener; import com.mapbox.android.core.permissions.PermissionsManager; @@ -123,7 +122,7 @@ public class LocationModesActivity extends AppCompatActivity implements OnMapRea public void onMapReady(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; - mapboxMap.getStyle(style -> { + mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> { int[] padding; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { padding = new int[] {0, 750, 0, 0}; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java index 81d56905fa..d2ecf406f3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java @@ -15,14 +15,13 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.utils.MapFragmentUtils; @@ -131,8 +130,10 @@ public class BottomSheetActivity extends AppCompatActivity { public static MainMapFragment newInstance(int mapCounter) { MainMapFragment mapFragment = new MainMapFragment(); + Bundle bundle = new Bundle(); + bundle.putInt("mapcounter", mapCounter); + mapFragment.setArguments(bundle); MapboxMapOptions mapboxMapOptions = new MapboxMapOptions(); - mapboxMapOptions.styleUrl(STYLES[Math.min(Math.max(mapCounter, 0), STYLES.length - 1)]); mapFragment.setArguments(MapFragmentUtils.createFragmentArgs(mapboxMapOptions)); return mapFragment; } @@ -154,6 +155,11 @@ public class BottomSheetActivity extends AppCompatActivity { @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.760545, -122.436055), 15)); + mapboxMap.setStyle( + new Style.Builder().fromUrl( + STYLES[Math.min(Math.max(getArguments().getInt("mapcounter"), 0), STYLES.length - 1)] + ) + ); } @Override @@ -207,7 +213,6 @@ public class BottomSheetActivity extends AppCompatActivity { BottomSheetFragment mapFragment = new BottomSheetFragment(); MapboxMapOptions mapboxMapOptions = new MapboxMapOptions(); mapboxMapOptions.renderSurfaceOnTop(true); - mapboxMapOptions.styleUrl(Style.LIGHT); mapFragment.setArguments(MapFragmentUtils.createFragmentArgs(mapboxMapOptions)); return mapFragment; } @@ -229,6 +234,7 @@ public class BottomSheetActivity extends AppCompatActivity { @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.760545, -122.436055), 15)); + mapboxMap.setStyle(Style.LIGHT); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java index 12a821cbc6..88ab62a2ee 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java @@ -98,9 +98,7 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa } protected MapboxMapOptions setupMapboxMapOptions() { - MapboxMapOptions mapboxMapOptions = new MapboxMapOptions(); - mapboxMapOptions.styleUrl(Style.MAPBOX_STREETS); - return mapboxMapOptions; + return new MapboxMapOptions(); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java index 9f27a8e47c..e8327a38bd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java @@ -9,14 +9,13 @@ import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; - import android.widget.Toast; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.utils.MapFragmentUtils; @@ -41,7 +40,6 @@ public class DoubleMapActivity extends AppCompatActivity { if (savedInstanceState == null) { MapboxMapOptions options = new MapboxMapOptions(); - options.styleUrl(Style.DARK); options.camera(new CameraPosition.Builder() .target(MACHU_PICCHU) .zoom(ZOOM_IN) @@ -77,6 +75,7 @@ public class DoubleMapActivity extends AppCompatActivity { // MapView large mapView = new MapView(view.getContext(), MapFragmentUtils.resolveArgs(view.getContext(), getArguments())); mapView.onCreate(savedInstanceState); + mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS)); ((ViewGroup) view.findViewById(R.id.container)).addView(mapView, 0); // MapView mini @@ -99,7 +98,7 @@ public class DoubleMapActivity extends AppCompatActivity { mapboxMap.addOnMapClickListener(point -> { // test if we can open 2 activities after each other - Toast.makeText(mapViewMini.getContext(), "Creating a new Activity instance",Toast.LENGTH_SHORT).show(); + Toast.makeText(mapViewMini.getContext(), "Creating a new Activity instance", Toast.LENGTH_SHORT).show(); startActivity(new Intent(mapViewMini.getContext(), DoubleMapActivity.class)); return false; @@ -150,7 +149,7 @@ public class DoubleMapActivity extends AppCompatActivity { } @Override - public void onSaveInstanceState(Bundle outState) { + public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); mapViewMini.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java index 04b5fb379a..5e6e828856 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LatLngBoundsForCameraActivity.java @@ -14,6 +14,7 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -42,6 +43,7 @@ public class LatLngBoundsForCameraActivity extends AppCompatActivity implements @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; + mapboxMap.setStyle(Style.SATELLITE_STREETS); mapboxMap.setLatLngBoundsForCameraTarget(ICELAND_BOUNDS); mapboxMap.setMinZoomPreference(2); showBoundsArea(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LocalGlyphActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LocalGlyphActivity.java index 10db6a97c6..5abf1846b9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LocalGlyphActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/LocalGlyphActivity.java @@ -6,6 +6,7 @@ import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -23,6 +24,7 @@ public class LocalGlyphActivity extends AppCompatActivity { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { + mapboxMap.setStyle(Style.MAPBOX_STREETS); // Set initial position to Suzhou mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java index ce00c9d18f..56104e801b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java @@ -11,8 +11,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; - import com.mapbox.mapboxsdk.maps.MapView; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -28,7 +28,7 @@ public class MapInDialogActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map_in_dialog); - Button button = (Button) findViewById(R.id.button_open_dialog); + Button button = findViewById(R.id.button_open_dialog); button.setOnClickListener(view -> { FragmentManager fm = getSupportFragmentManager(); MapDialogFragment editNameDialogFragment = MapDialogFragment.newInstance("Map Dialog"); @@ -60,8 +60,9 @@ public class MapInDialogActivity extends AppCompatActivity { public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - mapView = (MapView) view.findViewById(R.id.mapView); + mapView = view.findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); + mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.OUTDOORS)); } @NonNull @@ -69,6 +70,7 @@ public class MapInDialogActivity extends AppCompatActivity { public Dialog onCreateDialog(Bundle savedInstanceState) { return new Dialog(getActivity(), getTheme()) { boolean destroyed = false; + @Override public void dismiss() { if (mapView != null && !destroyed) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java index 73453a748b..688ba46f94 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java @@ -11,6 +11,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; @@ -33,6 +34,7 @@ public class MapPaddingActivity extends AppCompatActivity { mapView.getMapAsync(mapboxMap -> { MapPaddingActivity.this.mapboxMap = mapboxMap; + mapboxMap.setStyle(Style.MAPBOX_STREETS); int paddingLeft = (int) getResources().getDimension(R.dimen.map_padding_left); int paddingBottom = (int) getResources().getDimension(R.dimen.map_padding_bottom); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt index d35c977df0..9989d1b137 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt @@ -9,6 +9,8 @@ import android.view.LayoutInflater import android.view.ViewGroup import android.widget.TextView import com.mapbox.mapboxsdk.maps.MapView +import com.mapbox.mapboxsdk.maps.OnMapReadyCallback +import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.R import kotlinx.android.synthetic.main.activity_recyclerview.* @@ -65,6 +67,7 @@ class RecyclerViewActivity : AppCompatActivity() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return if (viewType == TYPE_MAP) { val mapView = inflater.inflate(R.layout.item_map, parent, false) as MapView + mapView.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } mapHolder = MapHolder(mapView, savedInstanceState) return mapHolder as MapHolder } else { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java index c5d7dfbef7..567da3f959 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VisibilityChangeActivity.java @@ -9,6 +9,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -26,10 +27,11 @@ public class VisibilityChangeActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map_visibility); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { mapboxMap = map; + mapboxMap.setStyle(Style.MAPBOX_STREETS); mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(55.754020, 37.620948), 12), 9000); }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java index 4dd0d4ec0c..2b2b90b606 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java @@ -14,6 +14,7 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; @@ -48,7 +49,7 @@ public class CustomSpriteActivity extends AppCompatActivity { mapView.getMapAsync(map -> { mapboxMap = map; - map.getStyle(style -> { + map.setStyle(Style.MAPBOX_STREETS, style -> { final FloatingActionButton fab = findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(CustomSpriteActivity.this, R.color.primary)); fab.setOnClickListener(new View.OnClickListener() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java index b872d022e3..847a2b53c6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java @@ -2,9 +2,9 @@ package com.mapbox.mapboxsdk.testapp.activity.style; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -23,7 +23,11 @@ public class FillExtrusionStyleTestActivity extends AppCompatActivity { // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> FillExtrusionStyleTestActivity.this.mapboxMap = mapboxMap); + mapView.getMapAsync(mapboxMap -> + mapboxMap.setStyle(new Style.Builder().fromUrl(Style.MAPBOX_STREETS), + style -> FillExtrusionStyleTestActivity.this.mapboxMap = mapboxMap + ) + ); } public MapboxMap getMapboxMap() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java index d06f3e1644..41e419c0bc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java @@ -95,7 +95,7 @@ public class GridSourceActivity extends AppCompatActivity implements OnMapReadyC super.onCreate(savedInstanceState); setContentView(R.layout.activity_grid_source); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java index 072378d8b9..b65248ceae 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java @@ -28,7 +28,7 @@ public class HillshadeLayerActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fill_extrusion_layer); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { mapboxMap = map; @@ -37,7 +37,7 @@ public class HillshadeLayerActivity extends AppCompatActivity { HillshadeLayer hillshadeLayer = new HillshadeLayer(LAYER_ID, SOURCE_ID); mapboxMap.setStyle(new Style.Builder() .fromUrl(Style.MAPBOX_STREETS) - .withLayer(hillshadeLayer) + .withLayerBelow(hillshadeLayer, LAYER_BELOW_ID) .withSource(rasterDemSource) ); }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java index 2d91fb8219..d5b115380e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java @@ -7,12 +7,12 @@ import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.widget.Toast; - import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; +import timber.log.Timber; import java.io.BufferedWriter; import java.io.File; @@ -20,8 +20,6 @@ import java.io.FileWriter; import java.io.IOException; import java.lang.ref.WeakReference; -import timber.log.Timber; - /** * Test activity showcasing how to use a file:// resource for the style.json and how to use MapboxMap#setStyleJson. */ @@ -35,18 +33,19 @@ public class StyleFileActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_style_file); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { mapboxMap = map; - - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_file); - fab.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); - fab.setOnClickListener(view -> new CreateStyleFileTask(view.getContext(), mapboxMap).execute()); - - FloatingActionButton fabStyleJson = (FloatingActionButton) findViewById(R.id.fab_style_json); - fabStyleJson.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); - fabStyleJson.setOnClickListener(view -> new LoadStyleFileTask(view.getContext(), mapboxMap).execute()); + mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> { + FloatingActionButton fab = findViewById(R.id.fab_file); + fab.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); + fab.setOnClickListener(view -> new CreateStyleFileTask(view.getContext(), mapboxMap).execute()); + + FloatingActionButton fabStyleJson = findViewById(R.id.fab_style_json); + fabStyleJson.setColorFilter(ContextCompat.getColor(StyleFileActivity.this, R.color.primary)); + fabStyleJson.setOnClickListener(view -> new LoadStyleFileTask(view.getContext(), mapboxMap).execute()); + }); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java index c6c512a473..498dc6c0d0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java @@ -19,6 +19,7 @@ import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; @@ -89,8 +90,10 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; - addSymbolClickListener(); - new LoadDataTask(this).execute(); + map.setStyle(Style.OUTDOORS, style -> { + addSymbolClickListener(); + new LoadDataTask(SymbolGeneratorActivity.this).execute(); + }); } private void addSymbolClickListener() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewTransparentBackgroundActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewTransparentBackgroundActivity.java index 3a62e39173..77acba6e4c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewTransparentBackgroundActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewTransparentBackgroundActivity.java @@ -4,19 +4,18 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.ViewGroup; import android.widget.ImageView; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; +import timber.log.Timber; import java.io.IOException; -import timber.log.Timber; - /** * Example showcasing how to create a TextureView with a transparent background. */ @@ -40,21 +39,26 @@ public class TextureViewTransparentBackgroundActivity extends AppCompatActivity } private void setupMapView(Bundle savedInstanceState) { + MapboxMapOptions mapboxMapOptions = new MapboxMapOptions(); + mapboxMapOptions.translucentTextureSurface(true); + mapboxMapOptions.textureMode(true); + mapboxMapOptions.camera(new CameraPosition.Builder() + .zoom(2) + .target(new LatLng(48.507879, 8.363795)) + .build() + ); + + mapView = new MapView(this, mapboxMapOptions); + mapView.onCreate(savedInstanceState); + mapView.getMapAsync(this::initMap); + ((ViewGroup) findViewById(R.id.coordinator_layout)).addView(mapView); + } + + private void initMap(MapboxMap mapboxMap) { try { - MapboxMapOptions mapboxMapOptions = new MapboxMapOptions(); - mapboxMapOptions.styleJson(ResourceUtils.readRawResource(this, R.raw.no_bg_style)); - mapboxMapOptions.translucentTextureSurface(true); - mapboxMapOptions.textureMode(true); - mapboxMapOptions.camera(new CameraPosition.Builder() - .zoom(2) - .target(new LatLng(48.507879, 8.363795)) - .build() + mapboxMap.setStyle( + new Style.Builder().fromJson(ResourceUtils.readRawResource(this, R.raw.no_bg_style)) ); - - mapView = new MapView(this, mapboxMapOptions); - mapView.onCreate(savedInstanceState); - mapView.getMapAsync(map -> mapboxMap = map); - ((ViewGroup) findViewById(R.id.coordinator_layout)).addView(mapView); } catch (IOException exception) { Timber.e(exception); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_sprite.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_sprite.xml index 00dc67ebed..ff8070dfcd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_sprite.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_sprite.xml @@ -12,8 +12,7 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="52.519003" app:mapbox_cameraTargetLng="13.400972" - app:mapbox_cameraZoom="16" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="16"/> <android.support.design.widget.FloatingActionButton android:id="@id/fab" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml index 26b40b9ab6..3ced7c8e2f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml @@ -11,7 +11,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="41.9567" app:mapbox_cameraTargetLng="-78.6430" - app:mapbox_cameraZoom="5" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="5"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_marker.xml index 252af714e7..a8dbefc1b2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_marker.xml @@ -12,7 +12,6 @@ android:layout_height="wrap_content" app:mapbox_cameraTargetLat="38.90962" app:mapbox_cameraTargetLng="-77.04341" - app:mapbox_cameraZoom="15" - app:mapbox_styleUrl="@string/mapbox_style_light"/> + app:mapbox_cameraZoom="15"/> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml index c8752df1bf..70141250d1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml @@ -9,8 +9,7 @@ app:mapbox_cameraTargetLat="40.7135" app:mapbox_cameraTargetLng="-74.0066" app:mapbox_cameraTilt="45" - app:mapbox_cameraZoom="15" - app:mapbox_styleUrl="@string/mapbox_style_dark"/> + app:mapbox_cameraZoom="15"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fabLightPosition" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animator.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animator.xml index cb14aab91f..c4c1d0e681 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animator.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animator.xml @@ -12,8 +12,7 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="37.787947" app:mapbox_cameraTargetLng="-122.407432" - app:mapbox_cameraZoom="11" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="11"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml index bafafb9546..28bdaf7b2a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_position.xml @@ -18,8 +18,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="?android:attr/actionBarSize" - app:mapbox_uiAttributionTintColor="@color/redAccent" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_uiAttributionTintColor="@color/redAccent"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_circle_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_circle_layer.xml index 5ac55e75e2..2bc4ff7edf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_circle_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_circle_layer.xml @@ -11,8 +11,7 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="1.350057" app:mapbox_cameraTargetLng="103.849218" - app:mapbox_cameraZoom="10" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="10"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab_route" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml index be84b7b61b..e4b66c2981 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_espresso_test.xml @@ -10,7 +10,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/toolbar" - app:mapbox_styleUrl="asset://streets.json" app:mapbox_cameraZoom="1"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_extrusion_test.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_extrusion_test.xml index d9a10871b5..2f14d5b94e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_extrusion_test.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_extrusion_test.xml @@ -12,7 +12,6 @@ app:mapbox_cameraTargetLat="40.7135" app:mapbox_cameraTargetLng="-74.0066" app:mapbox_cameraTilt="45" - app:mapbox_cameraZoom="15" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="15"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_grid_source.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_grid_source.xml index 26b40b9ab6..3ced7c8e2f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_grid_source.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_grid_source.xml @@ -11,7 +11,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="41.9567" app:mapbox_cameraTargetLng="-78.6430" - app:mapbox_cameraZoom="5" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="5"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_hillshade_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_hillshade_layer.xml index a2410c547c..9f48c08097 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_hillshade_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_hillshade_layer.xml @@ -11,7 +11,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="52.090710" app:mapbox_cameraTargetLng="5.121125" - app:mapbox_cameraZoom="10" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="10"/> </RelativeLayout>
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml index 3339341f6e..ad8be71793 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml @@ -12,7 +12,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="38.897705003219784" app:mapbox_cameraTargetLng="-77.03655168667463" - app:mapbox_cameraZoom="15" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="15"/> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml index abb41c05c4..970e77114b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml @@ -12,7 +12,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="47.798202" app:mapbox_cameraTargetLng="7.573781" - app:mapbox_cameraZoom="4" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="4"/> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_local_glyph.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_local_glyph.xml index 1c59fe4ba6..856dd24752 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_local_glyph.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_local_glyph.xml @@ -12,7 +12,6 @@ android:id="@id/mapView" android:layout_width="match_parent" android:layout_height="match_parent" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" app:mapbox_localIdeographFontFamily="Droid Sans" /> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_location_layer_mode.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_location_layer_mode.xml index 243792e063..e23d876e3a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_location_layer_mode.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_location_layer_mode.xml @@ -14,7 +14,6 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" app:mapbox_uiAttribution="false" /> <LinearLayout diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_padding.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_padding.xml index 42547f10a5..97319f7c56 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_padding.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_padding.xml @@ -4,7 +4,6 @@ <com.mapbox.mapboxsdk.maps.MapView android:id="@id/mapView" android:layout_width="match_parent" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" android:layout_height="match_parent"/> <View diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_visibility.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_visibility.xml index a80b464789..fe58537813 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_visibility.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_visibility.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/viewParent" android:layout_width="match_parent" android:layout_height="match_parent" @@ -12,7 +12,6 @@ android:id="@id/mapView" android:layout_width="match_parent" android:layout_height="match_parent" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" android:visibility="invisible"/> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml index eae79f631d..e2c07c6fd8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml @@ -12,7 +12,6 @@ android:layout_below="@id/toolbar" app:mapbox_cameraTargetLat="38.87031" app:mapbox_cameraTargetLng="-77.00897" - app:mapbox_cameraZoom="10" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="10"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_maxmin_zoom.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_maxmin_zoom.xml index 4428100e41..c9df5a8574 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_maxmin_zoom.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_maxmin_zoom.xml @@ -11,7 +11,6 @@ android:layout_height="wrap_content" app:mapbox_cameraTargetLat="-1.063510" app:mapbox_cameraTargetLng=" 32.895425" - app:mapbox_cameraZoom="4" - app:mapbox_styleUrl="@string/mapbox_style_satellite_streets"/> + app:mapbox_cameraZoom="4"/> -</RelativeLayout> +</RelativeLayout>
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml index 51442894e1..1f856bcd94 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml @@ -23,8 +23,7 @@ android:layout_weight="0.5" mapbox:mapbox_cameraTargetLat="38.913187" mapbox:mapbox_cameraTargetLng="-77.032546" - mapbox:mapbox_cameraZoom="12" - mapbox:mapbox_styleUrl="mapbox://styles/mapbox/streets-v10" /> + mapbox:mapbox_cameraZoom="12" /> <!-- SF --> <fragment @@ -35,8 +34,7 @@ android:layout_weight="0.5" mapbox:mapbox_cameraTargetLat="37.775732" mapbox:mapbox_cameraTargetLng="-122.413985" - mapbox:mapbox_cameraZoom="13" - mapbox:mapbox_styleUrl="mapbox://styles/mapbox/outdoors-v10" /> + mapbox:mapbox_cameraZoom="13"/> </LinearLayout> <LinearLayout @@ -55,8 +53,7 @@ android:layout_weight="0.5" mapbox:mapbox_cameraTargetLat="12.97913" mapbox:mapbox_cameraTargetLng="77.59188" - mapbox:mapbox_cameraZoom="14" - mapbox:mapbox_styleUrl="mapbox://styles/mapbox/light-v9" /> + mapbox:mapbox_cameraZoom="14" /> <!-- Ayacucho --> <fragment @@ -67,7 +64,6 @@ android:layout_weight="0.5" mapbox:mapbox_cameraTargetLat="-13.155980" mapbox:mapbox_cameraTargetLng="-74.217134" - mapbox:mapbox_cameraZoom="15" - mapbox:mapbox_styleUrl="mapbox://styles/mapbox/dark-v9" /> + mapbox:mapbox_cameraZoom="15" /> </LinearLayout> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_polyline.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_polyline.xml index 3f8c384b3f..9bcfd0300e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_polyline.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_polyline.xml @@ -12,7 +12,6 @@ app:mapbox_uiAttributionTintColor="@android:color/holo_green_dark" app:mapbox_cameraTargetLat="47.798202" app:mapbox_cameraTargetLng="7.573781" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" app:mapbox_cameraZoom="4" /> <android.support.design.widget.FloatingActionButton diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_press_for_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_press_for_marker.xml index c2098b0f5b..88e27e1de1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_press_for_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_press_for_marker.xml @@ -13,7 +13,6 @@ app:mapbox_cameraTargetLat="45.1855569" app:mapbox_cameraTargetLng="5.7215506" app:mapbox_cameraZoom="11" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" app:mapbox_uiAttributionGravity="top|end" app:mapbox_uiLogoGravity="top|end" app:mapbox_uiLogoMarginRight="28dp"/> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_print.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_print.xml index 71f1586603..3ff8caea70 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_print.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_print.xml @@ -18,7 +18,6 @@ android:layout_gravity="end|bottom" android:layout_margin="@dimen/fab_margin" android:src="@drawable/ic_print" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" app:backgroundTint="@color/accent"/> </android.support.design.widget.CoordinatorLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_query_features_point.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_query_features_point.xml index 6978ae871d..66750dc47e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_query_features_point.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_query_features_point.xml @@ -11,7 +11,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="52.0907" app:mapbox_cameraTargetLng="5.1214" - app:mapbox_cameraZoom="16" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="16"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_restricted_bounds.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_restricted_bounds.xml index e17807201b..bea754c161 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_restricted_bounds.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_restricted_bounds.xml @@ -12,7 +12,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="64.840048" app:mapbox_cameraTargetLng="-18.910457" - app:mapbox_cameraZoom="4" - app:mapbox_styleUrl="@string/mapbox_style_satellite_streets"/> + app:mapbox_cameraZoom="4"/> </android.support.design.widget.CoordinatorLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_scroll_by.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_scroll_by.xml index cfbd07ce39..fea40d55a3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_scroll_by.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_scroll_by.xml @@ -86,7 +86,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="37.176546" app:mapbox_cameraTargetLng="-3.599007" - app:mapbox_styleUrl="@string/mapbox_style_dark" app:mapbox_cameraZoom="15" /> <android.support.design.widget.FloatingActionButton diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_style_file.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_style_file.xml index 83150be4bf..0261131df5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_style_file.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_style_file.xml @@ -11,8 +11,7 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="52.519003" app:mapbox_cameraTargetLng="13.400972" - app:mapbox_cameraZoom="16" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="16"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab_style_json" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_symbol_generator.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_symbol_generator.xml index ffcdddce57..0fa030fa1c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_symbol_generator.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_symbol_generator.xml @@ -1,15 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> <com.mapbox.mapboxsdk.maps.MapView android:id="@id/mapView" android:layout_width="match_parent" - android:layout_height="match_parent" - app:mapbox_styleUrl="@string/mapbox_style_outdoors"/> + android:layout_height="match_parent"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_zoom_symbol_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_zoom_symbol_layer.xml index 0bb59451ab..90fe634e7a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_zoom_symbol_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_zoom_symbol_layer.xml @@ -11,7 +11,6 @@ android:layout_height="match_parent" app:mapbox_cameraTargetLat="40.730648" app:mapbox_cameraTargetLng="-73.993619" - app:mapbox_cameraZoom="11" - app:mapbox_styleUrl="@string/mapbox_style_light"/> + app:mapbox_cameraZoom="11"/> </RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml index b8ea3d847e..c2e3270eb3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml @@ -11,7 +11,6 @@ android:layout_height="match_parent" mapbox:mapbox_cameraTargetLat="47.6077" mapbox:mapbox_cameraTargetLng="-122.3421" - mapbox:mapbox_cameraZoom="11" - mapbox:mapbox_styleUrl="mapbox://styles/mapbox/streets-v10" /> + mapbox:mapbox_cameraZoom="11"/> </LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml index c4c17a25ff..3224b73477 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml @@ -8,5 +8,4 @@ app:mapbox_cameraTargetLat="45.38301927899065" app:mapbox_cameraTargetLng="8.63525390625" app:mapbox_renderTextureMode="true" - app:mapbox_cameraZoom="7" - app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> + app:mapbox_cameraZoom="7"/> |