diff --git a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/CircleRadiusActivity.java b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/CircleRadiusActivity.java
index 9d6a94049..1948f2def 100644
--- a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/CircleRadiusActivity.java
+++ b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/CircleRadiusActivity.java
@@ -4,25 +4,27 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
-import com.mapbox.mapboxandroiddemo.R;
+import com.mapbox.mapboxandroiddemo.R;
import com.mapbox.mapboxsdk.Mapbox;
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.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.sources.VectorSource;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleOpacity;
import static com.mapbox.mapboxsdk.style.expressions.Expression.exponential;
import static com.mapbox.mapboxsdk.style.expressions.Expression.get;
import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate;
import static com.mapbox.mapboxsdk.style.expressions.Expression.stop;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleOpacity;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius;
+/**
+ * Set the radii of a CircleLayer's circles based on a data property.
+ */
public class CircleRadiusActivity extends AppCompatActivity {
private MapView mapView;
@@ -37,13 +39,13 @@ protected void onCreate(Bundle savedInstanceState) {
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
-
mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() {
@Override
public void onStyleLoaded(@NonNull Style style) {
// replace examples.8mj5l1r9 with the map ID for the tileset
// you created by uploading data to your Mapbox account
style.addSource(new VectorSource("trees-source", "mapbox://examples.8mj5l1r9"));
+
CircleLayer circleLayer = new CircleLayer("trees-style", "trees-source");
// replace street-trees-DC-9gvg5l with the name of your source layer
circleLayer.setSourceLayer("street-trees-DC-9gvg5l");
@@ -65,7 +67,6 @@ public void onStyleLoaded(@NonNull Style style) {
});
}
-
// Add the mapView's own lifecycle methods to the activity's lifecycle methods
@Override
public void onStart() {
diff --git a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/location/LocationChangeListeningActivity.java b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/location/LocationChangeListeningActivity.java
index 17775a8c5..90dab71a9 100644
--- a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/location/LocationChangeListeningActivity.java
+++ b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/location/LocationChangeListeningActivity.java
@@ -1,52 +1,49 @@
package com.mapbox.mapboxandroiddemo.examples.location;
-import com.mapbox.mapboxandroiddemo.R;
import android.annotation.SuppressLint;
import android.location.Location;
-import android.util.Log;
-import android.widget.Toast;
-import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.annotation.NonNull;
-// Classes needed to initialize the map
-import com.mapbox.mapboxsdk.Mapbox;
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
-import com.mapbox.mapboxsdk.maps.Style;
-// Classes needed to handle location permissions
-import com.mapbox.android.core.permissions.PermissionsListener;
-import com.mapbox.android.core.permissions.PermissionsManager;
-import java.util.List;
-// Classes needed to add the location engine
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.widget.Toast;
+
import com.mapbox.android.core.location.LocationEngine;
import com.mapbox.android.core.location.LocationEngineCallback;
import com.mapbox.android.core.location.LocationEngineProvider;
import com.mapbox.android.core.location.LocationEngineRequest;
import com.mapbox.android.core.location.LocationEngineResult;
-import java.lang.ref.WeakReference;
-// Classes needed to add the location component
+import com.mapbox.android.core.permissions.PermissionsListener;
+import com.mapbox.android.core.permissions.PermissionsManager;
+import com.mapbox.mapboxandroiddemo.R;
+import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.location.LocationComponent;
import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions;
import com.mapbox.mapboxsdk.location.modes.CameraMode;
import com.mapbox.mapboxsdk.location.modes.RenderMode;
+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 java.lang.ref.WeakReference;
+import java.util.List;
+
/**
- * Use the Mapbox Core Library to listen to device location updates
+ * Use the Mapbox Core Library to receive updates when the device changes location.
*/
public class LocationChangeListeningActivity extends AppCompatActivity implements
OnMapReadyCallback, PermissionsListener {
- // Variables needed to initialize a map
+
+ private static final long DEFAULT_INTERVAL_IN_MILLISECONDS = 1000L;
+ private static final long DEFAULT_MAX_WAIT_TIME = DEFAULT_INTERVAL_IN_MILLISECONDS * 5;
private MapboxMap mapboxMap;
private MapView mapView;
- // Variables needed to handle location permissions
private PermissionsManager permissionsManager;
- // Variables needed to add the location engine
private LocationEngine locationEngine;
- private long DEFAULT_INTERVAL_IN_MILLISECONDS = 1000L;
- private long DEFAULT_MAX_WAIT_TIME = DEFAULT_INTERVAL_IN_MILLISECONDS * 5;
- // Variables needed to listen to location updates
- private LocationChangeListeningActivityLocationCallback callback = new LocationChangeListeningActivityLocationCallback(this);
+ private LocationChangeListeningActivityLocationCallback callback =
+ new LocationChangeListeningActivityLocationCallback(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -69,12 +66,11 @@ public void onMapReady(@NonNull final MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
mapboxMap.setStyle(Style.TRAFFIC_NIGHT,
- new Style.OnStyleLoaded() {
- @Override
- public void onStyleLoaded(@NonNull Style style) {
- enableLocationComponent(style);
- }
- });
+ new Style.OnStyleLoaded() {
+ @Override public void onStyleLoaded(@NonNull Style style) {
+ enableLocationComponent(style);
+ }
+ });
}
/**
@@ -129,13 +125,15 @@ private void initLocationEngine() {
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
+ @NonNull int[] grantResults) {
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public void onExplanationNeeded(List permissionsToExplain) {
- Toast.makeText(this, R.string.user_location_permission_explanation, Toast.LENGTH_LONG).show();
+ Toast.makeText(this, R.string.user_location_permission_explanation,
+ Toast.LENGTH_LONG).show();
}
@Override
@@ -177,7 +175,8 @@ public void onSuccess(LocationEngineResult result) {
// Create a Toast which displays the new location's coordinates
Toast.makeText(activity, String.format(activity.getString(R.string.new_location),
- String.valueOf(result.getLastLocation().getLatitude()), String.valueOf(result.getLastLocation().getLongitude())),
+ String.valueOf(result.getLastLocation().getLatitude()),
+ String.valueOf(result.getLastLocation().getLongitude())),
Toast.LENGTH_SHORT).show();
// Pass the new location to the Maps SDK's LocationComponent
@@ -188,7 +187,7 @@ public void onSuccess(LocationEngineResult result) {
}
/**
- * The LocationEngineCallback interface's method which fires when the device's location can not be captured
+ * The LocationEngineCallback interface's method which fires when the device's location can't be captured
*
* @param exception the exception message
*/
diff --git a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/RuntimeStylingActivity.java b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/RuntimeStylingActivity.java
index 7d808dc71..78bb451b9 100644
--- a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/RuntimeStylingActivity.java
+++ b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/RuntimeStylingActivity.java
@@ -1,27 +1,26 @@
package com.mapbox.mapboxandroiddemo.examples.styles;
-import com.mapbox.mapboxandroiddemo.R;
+import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
-import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import com.mapbox.mapboxandroiddemo.R;
import com.mapbox.mapboxsdk.Mapbox;
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.layers.Layer;
-
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
-import android.graphics.Color;
-import android.view.View;
-
+/**
+ * Change various properties of a map based on user interaction and other runtime situations.
+ */
public class RuntimeStylingActivity extends AppCompatActivity {
private MapView mapView;
- private FloatingActionButton changeMapPropertiesFab;
private Layer waterLayer;
@Override
@@ -31,7 +30,6 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_styles_runtime_styling);
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
- changeMapPropertiesFab = findViewById(R.id.floatingActionButton);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
@@ -39,9 +37,9 @@ public void onMapReady(@NonNull final MapboxMap mapboxMap) {
@Override
public void onStyleLoaded(@NonNull final Style style) {
waterLayer = style.getLayer("water");
- changeMapPropertiesFab.setOnClickListener(new View.OnClickListener() {
+ findViewById(R.id.floatingActionButton).setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(View view) {
if (waterLayer != null) {
waterLayer.setProperties(PropertyFactory.fillColor(Color.parseColor("#023689"))
);
diff --git a/MapboxAndroidDemo/src/main/res/layout/activity_styles_runtime_styling.xml b/MapboxAndroidDemo/src/main/res/layout/activity_styles_runtime_styling.xml
index f72f0ffab..b9d476293 100644
--- a/MapboxAndroidDemo/src/main/res/layout/activity_styles_runtime_styling.xml
+++ b/MapboxAndroidDemo/src/main/res/layout/activity_styles_runtime_styling.xml
@@ -1,6 +1,7 @@
Use multiple expressions to convert and visualize data.
View satellite photos and click to outline an area of land.
Change SymbolLayer icons based on the camera\'s zoom level.
- Set the circle radius of features in a circle layer based on a data property.
+ Set the radii of a circle layer\'s circles based on a data property.
Create a default marker with an InfoWindow.
Draw a polyline by parsing a GeoJSON file with the Mapbox Maps SDK.
Tap on various polygons to "select" them and toggle their colors.
@@ -103,7 +103,7 @@
Use the LocationComponent to display a user\'s location on a map fragment.
Use LocationComponent options to customize the user location information.
Use LocationComponent camera options to customize map camera behavior.
- Display a Mapbox map on an Android device and receive updates on the current device location.
+ Receive updates when the device changes location.
Using the polylines utility, simplify a polyline which reduces the amount of coordinates making up the polyline depending on tolerance.
Match raw GPS points to the map so they aligns with the roads/pathways.
Send and share a map snapshot image.
diff --git a/MapboxAndroidDemo/src/main/res/values/titles_strings.xml b/MapboxAndroidDemo/src/main/res/values/titles_strings.xml
index 623df7e79..893aa7924 100644
--- a/MapboxAndroidDemo/src/main/res/values/titles_strings.xml
+++ b/MapboxAndroidDemo/src/main/res/values/titles_strings.xml
@@ -34,7 +34,7 @@
Text anchor position
Style with missing icon
Variable label placement
- Style features at runtime
+ Button interaction styling
Use GeoJSON data to set extrusion height
Display 3D building height based on vector data
Adjust light location and color