[android] #3749 - added javadoc
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Do not use this package. Used internally by the SDK.
|
||||
* Do not use this package. Internal use only.
|
||||
*/
|
||||
package com.almeros.android.multitouch.gesturedetectors;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
|
||||
/**
|
||||
* Annotation is a overlay on top of a {@link MapView},
|
||||
* Annotation is an overlay on top of a {@link MapView},
|
||||
* from which {@link Polygon}, {@link Polyline} and {@link Marker} are derived.
|
||||
* <p>
|
||||
* it manages attachment to a map and identification, but does not require
|
||||
@@ -55,10 +55,15 @@ public abstract class Annotation implements Comparable<Annotation> {
|
||||
/**
|
||||
* Do not use this method. Used internally by the SDK.
|
||||
*/
|
||||
public void setMapboxMap(MapboxMap mapView) {
|
||||
this.mapboxMap = mapView;
|
||||
public void setMapboxMap(MapboxMap mapboxMap) {
|
||||
this.mapboxMap = mapboxMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated MapboxMap
|
||||
*
|
||||
* @return The MapboxMap
|
||||
*/
|
||||
protected MapboxMap getMapboxMap() {
|
||||
return mapboxMap;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,14 @@ import android.os.Parcelable;
|
||||
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
|
||||
/**
|
||||
* Abstract builder class for composing custom Marker objects.
|
||||
* <p/>
|
||||
* Extending this class requires implementing Parceable interface.
|
||||
*
|
||||
* @param <U> Type of the marker to be composed
|
||||
* @param <T> Type of the builder to be used for composing a custom Marker
|
||||
*/
|
||||
public abstract class BaseMarkerOptions<U extends Marker, T extends BaseMarkerOptions<U, T>> implements Parcelable {
|
||||
|
||||
protected LatLng position;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains classes to add and manage annotations on your map.
|
||||
* Contains the Mapbox Maps Android Annotation API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.annotations;
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.mapbox.mapboxsdk.constants.MathConstants;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.utils.MathUtils;
|
||||
|
||||
/**
|
||||
* Resembles the position, angle, zoom and tilt of the user's viewpoint.
|
||||
*/
|
||||
public final class CameraPosition implements Parcelable {
|
||||
|
||||
public static final Parcelable.Creator<CameraPosition> CREATOR
|
||||
@@ -28,7 +31,6 @@ public final class CameraPosition implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Direction that the camera is pointing in, in degrees clockwise from north.
|
||||
*/
|
||||
@@ -68,7 +70,7 @@ public final class CameraPosition implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
return hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +117,7 @@ public final class CameraPosition implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds camera position.
|
||||
* Builder for composing {@link CameraPosition} objects.
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
@@ -215,7 +217,6 @@ public final class CameraPosition implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the direction that the camera is pointing in, in degrees clockwise from north.
|
||||
*
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.mapbox.mapboxsdk.camera;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
|
||||
public interface CameraUpdate {
|
||||
/**
|
||||
* Interface definition for camera position changes.
|
||||
*/
|
||||
public interface CameraUpdate {
|
||||
|
||||
CameraPosition getCameraPosition(@NonNull MapboxMap mapboxMap);
|
||||
|
||||
|
||||
@@ -16,13 +16,16 @@ import com.mapbox.mapboxsdk.utils.MathUtils;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Factory for creating {@link CameraUpdate} objects.
|
||||
*/
|
||||
public final class CameraUpdateFactory {
|
||||
|
||||
/**
|
||||
* Returns a CameraUpdate that moves the camera to a specified CameraPosition.
|
||||
*
|
||||
* @param cameraPosition Camera Position to change to
|
||||
* @return CameraUpdate Final Camera Position data
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate newCameraPosition(@NonNull CameraPosition cameraPosition) {
|
||||
return new CameraPositionUpdate(cameraPosition.bearing, cameraPosition.target, cameraPosition.tilt, cameraPosition.zoom);
|
||||
@@ -32,8 +35,8 @@ public final class CameraUpdateFactory {
|
||||
* Returns a CameraUpdate that moves the center of the screen to a latitude and longitude
|
||||
* specified by a LatLng object. This centers the camera on the LatLng object.
|
||||
*
|
||||
* @param latLng
|
||||
* @return
|
||||
* @param latLng Target location to change to
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate newLatLng(@NonNull LatLng latLng) {
|
||||
return new CameraPositionUpdate(-1, latLng, -1, -1);
|
||||
@@ -45,9 +48,9 @@ public final class CameraUpdateFactory {
|
||||
* You can specify padding, in order to inset the bounding box from the map view's edges.
|
||||
* The returned CameraUpdate has a bearing of 0 and a tilt of 0.
|
||||
*
|
||||
* @param bounds
|
||||
* @param padding
|
||||
* @return
|
||||
* @param bounds Bounds to match Camera position with
|
||||
* @param padding Padding added to the bounds
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate newLatLngBounds(@NonNull LatLngBounds bounds, int padding) {
|
||||
return newLatLngBounds(bounds, padding, padding, padding, padding);
|
||||
@@ -60,34 +63,36 @@ public final class CameraUpdateFactory {
|
||||
* You can specify padding, in order to inset the bounding box from the map view's edges.
|
||||
* The returned CameraUpdate has a bearing of 0 and a tilt of 0.
|
||||
*
|
||||
* @param bounds
|
||||
* @param paddingLeft
|
||||
* @param paddingTop
|
||||
* @param paddingRight
|
||||
* @param paddingBottom
|
||||
* @return
|
||||
* @param bounds Bounds to base the Camera position out of
|
||||
* @param paddingLeft Padding left of the bounds
|
||||
* @param paddingTop Padding top of the bounds
|
||||
* @param paddingRight Padding right of the bounds
|
||||
* @param paddingBottom Padding bottom of the bounds
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate newLatLngBounds(@NonNull LatLngBounds bounds, int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
|
||||
return new CameraBoundsUpdate(bounds, paddingLeft, paddingTop, paddingRight, paddingBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CameraUpdate that moves the center of the screen to a latitude and longitude specified by a LatLng object, and moves to the given zoom level.
|
||||
* Returns a CameraUpdate that moves the center of the screen to a latitude and longitude specified by a LatLng object,
|
||||
* and moves to the given zoom level.
|
||||
*
|
||||
* @param latLng
|
||||
* @param zoom
|
||||
* @return
|
||||
* @param latLng Target location to change to
|
||||
* @param zoom Zoom level to change to
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate newLatLngZoom(@NonNull LatLng latLng, float zoom) {
|
||||
return new CameraPositionUpdate(-1, latLng, -1, zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CameraUpdate that scrolls the camera over the map, shifting the center of view by the specified number of pixels in the x and y directions.
|
||||
* Returns a CameraUpdate that scrolls the camera over the map,
|
||||
* shifting the center of view by the specified number of pixels in the x and y directions.
|
||||
*
|
||||
* @param xPixel
|
||||
* @param yPixel
|
||||
* @return
|
||||
* @param xPixel Amount of pixels to scroll to in x direction
|
||||
* @param yPixel Amount of pixels to scroll to in y direction
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate scrollBy(float xPixel, float yPixel) {
|
||||
return new CameraMoveUpdate(xPixel, yPixel);
|
||||
@@ -96,9 +101,9 @@ public final class CameraUpdateFactory {
|
||||
/**
|
||||
* Returns a CameraUpdate that shifts the zoom level of the current camera viewpoint.
|
||||
*
|
||||
* @param amount
|
||||
* @param focus
|
||||
* @return
|
||||
* @param amount Amount of zoom level to change with
|
||||
* @param focus Focus point of zoom
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate zoomBy(float amount, Point focus) {
|
||||
return new ZoomUpdate(amount, focus.x, focus.y);
|
||||
@@ -107,8 +112,8 @@ public final class CameraUpdateFactory {
|
||||
/**
|
||||
* Returns a CameraUpdate that shifts the zoom level of the current camera viewpoint.
|
||||
*
|
||||
* @param amount
|
||||
* @return
|
||||
* @param amount Amount of zoom level to change with
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate zoomBy(float amount) {
|
||||
return new ZoomUpdate(ZoomUpdate.ZOOM_BY, amount);
|
||||
@@ -117,7 +122,7 @@ public final class CameraUpdateFactory {
|
||||
/**
|
||||
* Returns a CameraUpdate that zooms in on the map by moving the viewpoint's height closer to the Earth's surface. The zoom increment is 1.0.
|
||||
*
|
||||
* @return
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate zoomIn() {
|
||||
return new ZoomUpdate(ZoomUpdate.ZOOM_IN);
|
||||
@@ -126,7 +131,7 @@ public final class CameraUpdateFactory {
|
||||
/**
|
||||
* Returns a CameraUpdate that zooms out on the map by moving the viewpoint's height farther away from the Earth's surface. The zoom increment is -1.0.
|
||||
*
|
||||
* @return
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate zoomOut() {
|
||||
return new ZoomUpdate(ZoomUpdate.ZOOM_OUT);
|
||||
@@ -135,8 +140,8 @@ public final class CameraUpdateFactory {
|
||||
/**
|
||||
* Returns a CameraUpdate that moves the camera viewpoint to a particular zoom level.
|
||||
*
|
||||
* @param zoom
|
||||
* @return
|
||||
* @param zoom Zoom level to change to
|
||||
* @return CameraUpdate Final Camera Position
|
||||
*/
|
||||
public static CameraUpdate zoomTo(float zoom) {
|
||||
return new ZoomUpdate(ZoomUpdate.ZOOM_TO, zoom);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains the Camera API classes which are used to control the user's viewpoint of the map.
|
||||
* Contains the Mapbox Maps Android Camera API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.camera;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains multiple map related constants classes.
|
||||
* Contains the Mapbox Maps Android Constant API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.constants;
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mapbox.mapboxsdk.maps.MapView;
|
||||
/**
|
||||
* <p>
|
||||
* A {@code IconBitmapChangedException} is thrown by {@link MapView} when a {@link Marker} is added
|
||||
* that has a {@link Icon} with a {@link Bitmap} that has been modified.
|
||||
* that has a {@link Icon} with a {@link Bitmap} that has been modified since the creation of the Icon.
|
||||
* </p>
|
||||
* You cannot modify a {@code Icon} after it has been added to the map in a {@code Marker}
|
||||
*
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.os.Bundle;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
|
||||
/**
|
||||
* A {@code InvalidAccessTokenException} is thrown by {@link MapView} when there is either no access
|
||||
* A {@code InvalidAccessTokenException} is thrown by {@link com.mapbox.mapboxsdk.maps.MapboxMap} when there is either no access
|
||||
* token set before {@link MapView#onCreate(Bundle)} or an invalid access token is set in {@link MapView#setAccessToken(String)}
|
||||
*
|
||||
* @see MapView#onCreate(Bundle)
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.mapbox.mapboxsdk.exceptions;
|
||||
|
||||
/**
|
||||
* A InvalidLatLngBoundsException is thrown by {@link com.mapbox.mapboxsdk.geometry.LatLngBounds}
|
||||
* when there aren't enough {@link com.mapbox.mapboxsdk.geometry.LatLng} to create a bounds.
|
||||
*/
|
||||
public class InvalidLatLngBoundsException extends RuntimeException {
|
||||
|
||||
public InvalidLatLngBoundsException(int latLngsListSize) {
|
||||
super("Cannot create a LatLngBounds from " + latLngsListSize +" items");
|
||||
super("Cannot create a LatLngBounds from " + latLngsListSize + " items");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mapbox.mapboxsdk.annotations.IconFactory;
|
||||
/**
|
||||
* <p>
|
||||
* A {@code TooManyIconsException} is thrown by {@link IconFactory} when it
|
||||
* cannot create a {@link Icon} because there are already too many.
|
||||
* cannot create a {@link Icon} because there are already too many icons created.
|
||||
* </p>
|
||||
* You should try to reuse Icon objects whenever possible.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains map specific exception classes.
|
||||
* Contains the Mapbox Maps Android Exception API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.exceptions;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An immutable class representing a latitude/longitude aligned rectangle.
|
||||
* A geographical area representing a latitude/longitude aligned rectangle.
|
||||
*/
|
||||
public class LatLngBounds implements Parcelable {
|
||||
|
||||
@@ -132,8 +132,8 @@ public class LatLngBounds implements Parcelable {
|
||||
return new LatLngBounds(maxLat, maxLon, minLat, minLon);
|
||||
}
|
||||
|
||||
public LatLng[] toLatLngs(){
|
||||
return new LatLng[]{new LatLng(mLatNorth,mLonEast),new LatLng(mLatSouth,mLonWest)};
|
||||
public LatLng[] toLatLngs() {
|
||||
return new LatLng[]{new LatLng(mLatNorth, mLonEast), new LatLng(mLatSouth, mLonWest)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,9 +221,9 @@ public class LatLngBounds implements Parcelable {
|
||||
* Returns a new LatLngBounds that is the intersection of this with another LatLngBounds
|
||||
*
|
||||
* @param northLatitude Northern Longitude
|
||||
* @param eastLongitude Eastern Latitude
|
||||
* @param eastLongitude Eastern Latitude
|
||||
* @param southLatitude Southern Longitude
|
||||
* @param westLongitude Western Latitude
|
||||
* @param westLongitude Western Latitude
|
||||
* @return LatLngBounds
|
||||
*/
|
||||
public LatLngBounds intersect(double northLatitude, double eastLongitude, double southLatitude, double westLongitude) {
|
||||
@@ -272,6 +272,9 @@ public class LatLngBounds implements Parcelable {
|
||||
return new LatLngBounds(lonNorth, latEast, lonSouth, latWest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for composing LatLngBounds objects.
|
||||
*/
|
||||
public static final class Builder {
|
||||
|
||||
private List<LatLng> mLatLngList;
|
||||
|
||||
@@ -12,28 +12,54 @@ public class LatLngSpan implements Parcelable {
|
||||
private double mLatitudeSpan;
|
||||
private double mLongitudeSpan;
|
||||
|
||||
public LatLngSpan(@NonNull Parcel in){
|
||||
private LatLngSpan(@NonNull Parcel in) {
|
||||
mLatitudeSpan = in.readDouble();
|
||||
mLongitudeSpan = in.readDouble();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a LatLgnSpan.
|
||||
*
|
||||
* @param latitudeSpan The span used for latitude.
|
||||
* @param longitudeSpan The span used for longitude.
|
||||
*/
|
||||
public LatLngSpan(double latitudeSpan, double longitudeSpan) {
|
||||
mLatitudeSpan = latitudeSpan;
|
||||
mLongitudeSpan = longitudeSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latitude span.
|
||||
*
|
||||
* @return The latitude span.
|
||||
*/
|
||||
public double getLatitudeSpan() {
|
||||
return mLatitudeSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the latitude span.
|
||||
*
|
||||
* @param latitudeSpan The latitude span to set.
|
||||
*/
|
||||
public void setLatitudeSpan(double latitudeSpan) {
|
||||
mLatitudeSpan = latitudeSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns to longitude span.
|
||||
*
|
||||
* @return The longitude span.
|
||||
*/
|
||||
public double getLongitudeSpan() {
|
||||
return mLongitudeSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the longitude span.
|
||||
*
|
||||
* @param longitudeSpan The longitude span to set.
|
||||
*/
|
||||
public void setLongitudeSpan(double longitudeSpan) {
|
||||
mLongitudeSpan = longitudeSpan;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.mapbox.mapboxsdk.geometry;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* ProjectedMeters is a projection of longitude, latitude points in Mercator meters.
|
||||
* <p>
|
||||
@@ -28,26 +26,47 @@ public class ProjectedMeters implements IProjectedMeters, Parcelable {
|
||||
private double northing;
|
||||
private double easting;
|
||||
|
||||
/**
|
||||
* Creates a ProjectedMeters based on projected meters in north and east direction
|
||||
*
|
||||
* @param northing
|
||||
* @param easting
|
||||
*/
|
||||
public ProjectedMeters(double northing, double easting) {
|
||||
this.northing = northing;
|
||||
this.easting = easting;
|
||||
}
|
||||
|
||||
public ProjectedMeters(ProjectedMeters aProjectedMeters) {
|
||||
this.northing = aProjectedMeters.northing;
|
||||
this.easting = aProjectedMeters.easting;
|
||||
/**
|
||||
* Creates a ProjecteMeters based on another set of projected meters.
|
||||
*
|
||||
* @param projectedMeters The projected meters to be based on.
|
||||
*/
|
||||
public ProjectedMeters(ProjectedMeters projectedMeters) {
|
||||
this.northing = projectedMeters.northing;
|
||||
this.easting = projectedMeters.easting;
|
||||
}
|
||||
|
||||
protected ProjectedMeters(Parcel in) {
|
||||
private ProjectedMeters(Parcel in) {
|
||||
northing = in.readDouble();
|
||||
easting = in.readDouble();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projected meters in north direction.
|
||||
*
|
||||
* @return Projected meters in north.
|
||||
*/
|
||||
@Override
|
||||
public double getNorthing() {
|
||||
return northing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projected meters in east direction.
|
||||
*
|
||||
* @return Projected meters in east.
|
||||
*/
|
||||
@Override
|
||||
public double getEasting() {
|
||||
return easting;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains classes related to geometry and map coordinates.
|
||||
* Contains the Mapbox Maps Android Geometry API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.geometry;
|
||||
|
||||
@@ -16,12 +16,12 @@ import javax.net.ssl.SSLException;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
class HTTPRequest implements Callback {
|
||||
|
||||
private static OkHttpClient mClient = new OkHttpClient();
|
||||
private final String LOG_TAG = HTTPRequest.class.getName();
|
||||
|
||||
@@ -39,6 +39,7 @@ class HTTPRequest implements Callback {
|
||||
private Request mRequest;
|
||||
|
||||
private native void nativeOnFailure(int type, String message);
|
||||
|
||||
private native void nativeOnResponse(int code, String etag, String modified, String cacheControl, String expires, byte[] body);
|
||||
|
||||
private HTTPRequest(long nativePtr, String resourceUrl, String userAgent, String etag, String modified) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Do not use this package. Used internally by the SDK.
|
||||
* Do not use this package. Internal use only.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.http;
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package com.mapbox.mapboxsdk.layers;
|
||||
|
||||
public class CustomLayer {
|
||||
|
||||
public String mID;
|
||||
public long mContext;
|
||||
public long mInitializeFunction;
|
||||
public long mRenderFunction;
|
||||
public long mDeinitializeFunction;
|
||||
|
||||
public CustomLayer(String id,
|
||||
long context,
|
||||
long initializeFunction,
|
||||
@@ -13,9 +20,4 @@ public class CustomLayer {
|
||||
this.mDeinitializeFunction = deinitializeFunction;
|
||||
}
|
||||
|
||||
public String mID;
|
||||
public long mContext;
|
||||
public long mInitializeFunction;
|
||||
public long mRenderFunction;
|
||||
public long mDeinitializeFunction;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains classes to add and manage layers of the map.
|
||||
* Do not use this package. Experimental feature.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.layers;
|
||||
|
||||
@@ -17,6 +17,9 @@ import com.mapzen.android.lost.api.LostApiClient;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Manages locational updates. Contains methods to register and unregister location listeners.
|
||||
*/
|
||||
public class LocationServices implements com.mapzen.android.lost.api.LocationListener {
|
||||
|
||||
private static final String TAG = "LocationServices";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains classes that manages the map Location services.
|
||||
* Contains the Mapbox Maps Android Location API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.location;
|
||||
|
||||
@@ -29,6 +29,12 @@ public final class MapFragment extends Fragment {
|
||||
private MapView mMap;
|
||||
private OnMapReadyCallback mOnMapReadyCallback;
|
||||
|
||||
/**
|
||||
* Creates a MapFragment instance
|
||||
*
|
||||
* @param mapboxMapOptions The configuration options to be used.
|
||||
* @return MapFragment created.
|
||||
*/
|
||||
public static MapFragment newInstance(@Nullable MapboxMapOptions mapboxMapOptions) {
|
||||
MapFragment mapFragment = new MapFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -37,6 +43,14 @@ public final class MapFragment extends Fragment {
|
||||
return mapFragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the fragment view hierachy.
|
||||
*
|
||||
* @param inflater Inflater used to inflate content.
|
||||
* @param container The parent layout for the map fragment.
|
||||
* @param savedInstanceState The saved instance state for the map fragment.
|
||||
* @return The view created
|
||||
*/
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
@@ -44,12 +58,21 @@ public final class MapFragment extends Fragment {
|
||||
return mMap = new MapView(inflater.getContext(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment view hierarchy is created.
|
||||
*
|
||||
* @param view The content view of the fragment
|
||||
* @param savedInstanceState THe saved instance state of the framgnt
|
||||
*/
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mMap.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is visible for the users.
|
||||
*/
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@@ -57,43 +80,67 @@ public final class MapFragment extends Fragment {
|
||||
mMap.getMapAsync(mOnMapReadyCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is ready to be interacted with.
|
||||
*/
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mMap.onResume();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is pausing.
|
||||
*/
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mMap.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment state needs to be saved.
|
||||
*
|
||||
* @param outState The saved state
|
||||
*/
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mMap.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is no longer visible for the user.
|
||||
*/
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mMap.onStop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment receives onLowMemory call from the hosting Activity.
|
||||
*/
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mMap.onLowMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is view hiearchy is being destroyed.
|
||||
*/
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
mMap.onDestroy();
|
||||
mMap = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
||||
*
|
||||
* @param onMapReadyCallback The callback to be invoked.
|
||||
*/
|
||||
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
|
||||
mOnMapReadyCallback = onMapReadyCallback;
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ public class MapView extends FrameLayout {
|
||||
getContext().unregisterReceiver(mConnectivityReceiver);
|
||||
mConnectivityReceiver = null;
|
||||
|
||||
mUserLocationView.pause();
|
||||
mUserLocationView.onPause();
|
||||
mNativeMapView.pause();
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ public class MapView extends FrameLayout {
|
||||
|
||||
mNativeMapView.resume();
|
||||
mNativeMapView.update();
|
||||
mUserLocationView.resume();
|
||||
mUserLocationView.onResume();
|
||||
|
||||
if (mStyleUrl == null) {
|
||||
// user has failed to supply a style url
|
||||
|
||||
@@ -330,7 +330,7 @@ public class MapboxMap {
|
||||
//
|
||||
|
||||
/**
|
||||
*
|
||||
* Resets the map view to face north.
|
||||
*/
|
||||
public void resetNorth() {
|
||||
mMapView.resetNorth();
|
||||
@@ -495,6 +495,16 @@ public class MapboxMap {
|
||||
return addMarker((BaseMarkerOptions) markerOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Adds a marker to this map.
|
||||
* </p>
|
||||
* The marker's icon is rendered on the map at the location {@code Marker.position}.
|
||||
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
|
||||
*
|
||||
* @param markerOptions A marker options object that defines how to render the marker.
|
||||
* @return The {@code Marker} that was added to the map.
|
||||
*/
|
||||
@UiThread
|
||||
@NonNull
|
||||
public Marker addMarker(@NonNull BaseMarkerOptions markerOptions) {
|
||||
@@ -1047,7 +1057,9 @@ public class MapboxMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* Returns the current configured content padding on map view.
|
||||
*
|
||||
* @return An array with length 4 in the LTRB order.
|
||||
*/
|
||||
public int[] getPadding() {
|
||||
return new int[]{mMapView.getContentPaddingLeft(),
|
||||
@@ -1265,7 +1277,7 @@ public class MapboxMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback that's invoked when the the My Location dot
|
||||
* Sets a callback that's invoked when the the My Location view
|
||||
* (which signifies the user's location) changes location.
|
||||
*
|
||||
* @param listener The callback that's invoked when the user clicks on a marker.
|
||||
@@ -1312,16 +1324,25 @@ public class MapboxMap {
|
||||
// Custom layer
|
||||
//
|
||||
|
||||
/**
|
||||
* Do not use this method, experimental feature.
|
||||
*/
|
||||
@UiThread
|
||||
public void addCustomLayer(CustomLayer customLayer, String before) {
|
||||
mMapView.addCustomLayer(customLayer, before);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use this method, experimental feature.
|
||||
*/
|
||||
@UiThread
|
||||
public void removeCustomLayer(String id) {
|
||||
mMapView.removeCustomLayer(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use this method, experimental feature.
|
||||
*/
|
||||
@UiThread
|
||||
public void invalidateCustomLayers() {
|
||||
mMapView.invalidateCustomLayers();
|
||||
@@ -1335,6 +1356,9 @@ public class MapboxMap {
|
||||
// Invalidate
|
||||
//
|
||||
|
||||
/**
|
||||
* Triggers an invalidation of the map view.
|
||||
*/
|
||||
public void invalidate() {
|
||||
mMapView.update();
|
||||
}
|
||||
@@ -1501,17 +1525,16 @@ public class MapboxMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface definition for a callback to be invoked when the the My Location dot
|
||||
* (which signifies the user's location) changes location.
|
||||
* Interface definition for a callback to be invoked when the the My Location view changes location.
|
||||
*
|
||||
* @see MapboxMap#setOnMyLocationChangeListener(OnMyLocationChangeListener)
|
||||
*/
|
||||
public interface OnMyLocationChangeListener {
|
||||
/**
|
||||
* Called when the location of the My Location dot has changed
|
||||
* Called when the location of the My Location view has changed
|
||||
* (be it latitude/longitude, bearing or accuracy).
|
||||
*
|
||||
* @param location The current location of the My Location dot The type of map change event.
|
||||
* @param location The current location of the My Location view The type of map change event.
|
||||
*/
|
||||
void onMyLocationChange(@Nullable Location location);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,14 @@ import com.mapbox.mapboxsdk.R;
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
|
||||
/**
|
||||
* Defines configuration MapboxMapMapOptions for a MapboxMap. These options can be used when adding a
|
||||
* map to your application programmatically (as opposed to via XML). If you are using a MapFragment,
|
||||
* you can pass these options in using the static factory method newInstance(MapboxMapOptions).
|
||||
* If you are using a MapView, you can pass these options in using the constructor
|
||||
* MapView(Context, MapboxMapOptions). If you add a map using XML, then you can apply these options
|
||||
* using custom XML tags.
|
||||
*/
|
||||
public class MapboxMapOptions implements Parcelable {
|
||||
|
||||
private static final float DIMENSION_SEVEN_DP = 7f;
|
||||
@@ -50,6 +58,9 @@ public class MapboxMapOptions implements Parcelable {
|
||||
private String style;
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* Creates a new MapboxMapOptions object.
|
||||
*/
|
||||
public MapboxMapOptions() {
|
||||
}
|
||||
|
||||
@@ -84,6 +95,13 @@ public class MapboxMapOptions implements Parcelable {
|
||||
accessToken = in.readString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GoogleMapsOptions from the attribute set
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @param attrs Attributeset containing configuration
|
||||
* @return
|
||||
*/
|
||||
public static MapboxMapOptions createFromAttributes(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
MapboxMapOptions mapboxMapOptions = new MapboxMapOptions();
|
||||
float screenDensity = context.getResources().getDisplayMetrics().density;
|
||||
@@ -133,191 +151,422 @@ public class MapboxMapOptions implements Parcelable {
|
||||
return mapboxMapOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a the initial camera position for the map view.
|
||||
*
|
||||
* @param cameraPosition Inital camera position
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions camera(CameraPosition cameraPosition) {
|
||||
this.cameraPosition = cameraPosition;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the accesstoken associated with a map view.
|
||||
*
|
||||
* @param accessToken Token to be used to access the service
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions accessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the style url associated with a map view.
|
||||
*
|
||||
* @param styleUrl Url to be used to load a style
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions styleUrl(String styleUrl) {
|
||||
style = styleUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the used debug type for a map view.
|
||||
*
|
||||
* @param enabled True is debug is enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions debugActive(boolean enabled) {
|
||||
debugActive = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the used minimum zoom level for a map view.
|
||||
*
|
||||
* @param minZoom Zoom level to be used
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions minZoom(float minZoom) {
|
||||
this.minZoom = minZoom;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the used maximum zoom level for a map view.
|
||||
*
|
||||
* @param maxZoom Zoom level to be used
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions maxZoom(float maxZoom) {
|
||||
this.maxZoom = maxZoom;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the visibility state of a compass for a map view.
|
||||
*
|
||||
* @param enabled True and compass is shown
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions compassEnabled(boolean enabled) {
|
||||
compassEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the gravity state of compass for a map view.
|
||||
*
|
||||
* @param gravity see {@link android.view.Gravity}
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions compassGravity(int gravity) {
|
||||
compassGravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the margin state of compass for a map view
|
||||
*
|
||||
* @param margins 4 long array for LTRB margins
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions compassMargins(int[] margins) {
|
||||
compassMargins = margins;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the visibility state of a logo for a map view.
|
||||
*
|
||||
* @param enabled True and logo is shown
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions logoEnabled(boolean enabled) {
|
||||
logoEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the gravity state of logo for a map view.
|
||||
*
|
||||
* @param gravity see {@link android.view.Gravity}
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions logoGravity(int gravity) {
|
||||
logoGravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the margin state of logo for a map view
|
||||
*
|
||||
* @param margins 4 long array for LTRB margins
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions logoMargins(int[] margins) {
|
||||
logoMargins = margins;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the visibility state of a attribution for a map view.
|
||||
*
|
||||
* @param enabled True and attribution is shown
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions attributionEnabled(boolean enabled) {
|
||||
attributionEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the gravity state of attribution for a map view.
|
||||
*
|
||||
* @param gravity see {@link android.view.Gravity}
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions attributionGravity(int gravity) {
|
||||
attributionGravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the margin state of attribution for a map view
|
||||
*
|
||||
* @param margins 4 long array for LTRB margins
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions attributionMargins(int[] margins) {
|
||||
attributionMargins = margins;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies if the rotate gesture is enabled for a map view.
|
||||
*
|
||||
* @param enabled True and gesture will be enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions rotateGesturesEnabled(boolean enabled) {
|
||||
rotateGesturesEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies if the scroll gesture is enabled for a map view.
|
||||
*
|
||||
* @param enabled True and gesture will be enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions scrollGesturesEnabled(boolean enabled) {
|
||||
scrollGesturesEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies if the tilt gesture is enabled for a map view.
|
||||
*
|
||||
* @param enabled True and gesture will be enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions tiltGesturesEnabled(boolean enabled) {
|
||||
tiltGesturesEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies if the zoom controls are enabled for a map view.
|
||||
*
|
||||
* @param enabled True and gesture will be enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions zoomControlsEnabled(boolean enabled) {
|
||||
zoomControlsEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies if the zoom gesture is enabled for a map view.
|
||||
*
|
||||
* @param enabled True and gesture will be enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions zoomGesturesEnabled(boolean enabled) {
|
||||
zoomGesturesEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies if the user location view is enabled for a map view.
|
||||
*
|
||||
* @param locationEnabled True and gesture will be enabled
|
||||
* @return This
|
||||
*/
|
||||
public MapboxMapOptions locationEnabled(boolean locationEnabled) {
|
||||
this.locationEnabled = locationEnabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured initial camera position for a map view.
|
||||
*
|
||||
* @return CameraPosition to be initially used.
|
||||
*/
|
||||
public CameraPosition getCamera() {
|
||||
return cameraPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured min zoom for a map view.
|
||||
*
|
||||
* @return Mininum zoom level to be used.
|
||||
*/
|
||||
public float getMinZoom() {
|
||||
return minZoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured maximum zoom for a map view.
|
||||
*
|
||||
* @return Maximum zoom to be used.
|
||||
*/
|
||||
public float getMaxZoom() {
|
||||
return maxZoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured visibility state for compass for a map view.
|
||||
*
|
||||
* @return Visibility state of the compass
|
||||
*/
|
||||
public boolean getCompassEnabled() {
|
||||
return compassEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured gravity state for compass for a map view.
|
||||
*
|
||||
* @return Gravity state of the compass
|
||||
*/
|
||||
public int getCompassGravity() {
|
||||
return compassGravity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured margins for compass for a map view.
|
||||
*
|
||||
* @return Margins state of the compass
|
||||
*/
|
||||
public int[] getCompassMargins() {
|
||||
return compassMargins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured visibility state for compass for a map view.
|
||||
*
|
||||
* @return Visibility state of the compass
|
||||
*/
|
||||
public boolean getLogoEnabled() {
|
||||
return logoEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured gravity state for logo for a map view.
|
||||
*
|
||||
* @return Gravity state of the logo
|
||||
*/
|
||||
public int getLogoGravity() {
|
||||
return logoGravity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured margins for logo for a map view.
|
||||
*
|
||||
* @return Margins state of the logo
|
||||
*/
|
||||
public int[] getLogoMargins() {
|
||||
return logoMargins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured access token for a map view.
|
||||
*
|
||||
* @return Access token to be used.
|
||||
*/
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured style url for a map view.
|
||||
*
|
||||
* @return Style url to be used.
|
||||
*/
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured rotate gesture state for a map view.
|
||||
*
|
||||
* @return True indicates gesture is enabled
|
||||
*/
|
||||
public boolean getRotateGesturesEnabled() {
|
||||
return rotateGesturesEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured scroll gesture state for a map view.
|
||||
*
|
||||
* @return True indicates gesture is enabled
|
||||
*/
|
||||
public boolean getScrollGesturesEnabled() {
|
||||
return scrollGesturesEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured tilt gesture state for a map view.
|
||||
*
|
||||
* @return True indicates gesture is enabled
|
||||
*/
|
||||
public boolean getTiltGesturesEnabled() {
|
||||
return tiltGesturesEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured zoom controls state for a map view.
|
||||
*
|
||||
* @return True indicates gesture is enabled
|
||||
*/
|
||||
public boolean getZoomControlsEnabled() {
|
||||
return zoomControlsEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured zoom gesture state for a map view.
|
||||
*
|
||||
* @return True indicates gesture is enabled
|
||||
*/
|
||||
public boolean getZoomGesturesEnabled() {
|
||||
return zoomGesturesEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured visibility state for attribution for a map view.
|
||||
*
|
||||
* @return Visibility state of the attribution
|
||||
*/
|
||||
public boolean getAttributionEnabled() {
|
||||
return attributionEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured gravity state for attribution for a map view.
|
||||
*
|
||||
* @return Gravity state of the logo
|
||||
*/
|
||||
public int getAttributionGravity() {
|
||||
return attributionGravity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured margins for attribution for a map view.
|
||||
*
|
||||
* @return Margins state of the logo
|
||||
*/
|
||||
public int[] getAttributionMargins() {
|
||||
return attributionMargins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured user location view state for a map view.
|
||||
*
|
||||
* @return True and user location will be shown
|
||||
*/
|
||||
public boolean getLocationEnabled() {
|
||||
return locationEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configured debug state for a map view.
|
||||
*
|
||||
* @return True indicates debug is enabled.
|
||||
*/
|
||||
public boolean getDebugActive() {
|
||||
return debugActive;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.mapbox.mapboxsdk.geometry.VisibleRegion;
|
||||
|
||||
/**
|
||||
* A projection is used to translate between on screen location and geographic coordinates on
|
||||
* the surface of the Earth (LatLng). Screen location is in screen pixels (not display pixels)
|
||||
* the surface of the Earth. Screen location is in screen pixels (not display pixels)
|
||||
* with respect to the top left corner of the map (and not necessarily of the whole screen).
|
||||
*/
|
||||
public class Projection {
|
||||
|
||||
@@ -27,15 +27,30 @@ import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
public class SupportMapFragment extends Fragment {
|
||||
|
||||
private MapView mMap;
|
||||
private OnMapReadyCallback mOnMapReadyCallback;
|
||||
|
||||
public static MapFragment newInstance(@Nullable MapboxMapOptions mapboxMapOptions) {
|
||||
MapFragment mapFragment = new MapFragment();
|
||||
/**
|
||||
* Creates a MapFragment instance
|
||||
*
|
||||
* @param mapboxMapOptions The configuration options to be used.
|
||||
* @return MapFragment created.
|
||||
*/
|
||||
public static SupportMapFragment newInstance(@Nullable MapboxMapOptions mapboxMapOptions) {
|
||||
SupportMapFragment mapFragment = new SupportMapFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(MapboxConstants.FRAG_ARG_MAPBOXMAPOPTIONS, mapboxMapOptions);
|
||||
mapFragment.setArguments(bundle);
|
||||
return mapFragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the fragment view hierachy.
|
||||
*
|
||||
* @param inflater Inflater used to inflate content.
|
||||
* @param container The parent layout for the map fragment.
|
||||
* @param savedInstanceState The saved instance state for the map fragment.
|
||||
* @return The view created
|
||||
*/
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
@@ -43,56 +58,90 @@ public class SupportMapFragment extends Fragment {
|
||||
return mMap = new MapView(inflater.getContext(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment view hierarchy is created.
|
||||
*
|
||||
* @param view The content view of the fragment
|
||||
* @param savedInstanceState THe saved instance state of the framgnt
|
||||
*/
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mMap.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is visible for the users.
|
||||
*/
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mMap.onStart();
|
||||
mMap.getMapAsync(mOnMapReadyCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is ready to be interacted with.
|
||||
*/
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mMap.onResume();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is pausing.
|
||||
*/
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mMap.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment state needs to be saved.
|
||||
*
|
||||
* @param outState The saved state
|
||||
*/
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mMap.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is no longer visible for the user.
|
||||
*/
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mMap.onStop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment receives onLowMemory call from the hosting Activity.
|
||||
*/
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mMap.onLowMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the fragment is view hiearchy is being destroyed.
|
||||
*/
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
mMap.onDestroy();
|
||||
mMap = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
||||
*
|
||||
* @param onMapReadyCallback The callback to be invoked.
|
||||
*/
|
||||
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
|
||||
mMap.getMapAsync(onMapReadyCallback);
|
||||
mOnMapReadyCallback = onMapReadyCallback;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.support.annotation.UiThread;
|
||||
|
||||
import com.mapbox.mapboxsdk.constants.MyBearingTracking;
|
||||
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
|
||||
import com.mapbox.mapboxsdk.maps.widgets.UserLocationView;
|
||||
|
||||
/**
|
||||
* Settings for the user location and bearing tracking of a MapboxMap.
|
||||
@@ -93,10 +94,20 @@ public class TrackingSettings {
|
||||
return mMyBearingTrackingMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the tracking modes will be dismissed when a gesture occurs.
|
||||
*
|
||||
* @return True to indicate the tracking modes will be dismissed.
|
||||
*/
|
||||
public boolean isDismissTrackingOnGesture() {
|
||||
return dismissTrackingOnGesture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dismissal of the tracking modes if a gesture occurs.
|
||||
*
|
||||
* @param dismissTrackingOnGesture True to dismiss the tracking modes.
|
||||
*/
|
||||
public void setDismissTrackingOnGesture(boolean dismissTrackingOnGesture) {
|
||||
this.dismissTrackingOnGesture = dismissTrackingOnGesture;
|
||||
validateGesturesForTrackingModes();
|
||||
@@ -118,7 +129,12 @@ public class TrackingSettings {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLocationTrackingDisabled(){
|
||||
/**
|
||||
* Return if location tracking is disabled
|
||||
*
|
||||
* @return True if location tracking is disabled.
|
||||
*/
|
||||
public boolean isLocationTrackingDisabled() {
|
||||
return mMyLocationTrackingMode == MyLocationTracking.TRACKING_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains the Mapbox Maps Android API classes.
|
||||
* Contains the Mapbox Maps Android Maps API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.maps;
|
||||
|
||||
@@ -659,18 +659,12 @@ public final class UserLocationView extends View {
|
||||
mMapboxMap.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from MapView.onPause()
|
||||
*/
|
||||
public void pause() {
|
||||
public void onPause() {
|
||||
mPaused = true;
|
||||
toggleGps(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from MapView.onResume()
|
||||
*/
|
||||
public void resume() {
|
||||
public void onResume() {
|
||||
mPaused = false;
|
||||
if (isEnabled()) {
|
||||
toggleGps(true);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Contains the Mapbox Maps Android Widgets API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.maps.widgets;
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Contains the Mapbox Maps Android Offline API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.offline;
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package is the base package of the Mapbox GL SDK for Android
|
||||
* Contains the Mapbox Maps Android API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains classes that manages the map Telemetry services.
|
||||
* Contains the Mapbox Maps Android Telemetry API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.telemetry;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* This package contains utility classes used by the map.
|
||||
* Contains the Mapbox Maps Android Utility API classes.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.utils;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@@ -11,10 +12,10 @@ import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||
import com.mapbox.mapboxsdk.constants.Style;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.maps.MapFragment;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMapOptions;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.maps.SupportMapFragment;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.ApiAccess;
|
||||
|
||||
public class SupportMapFragmentActivity extends AppCompatActivity {
|
||||
@@ -33,9 +34,9 @@ public class SupportMapFragmentActivity extends AppCompatActivity {
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
MapFragment mapFragment;
|
||||
SupportMapFragment mapFragment;
|
||||
if (savedInstanceState == null) {
|
||||
android.app.FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
|
||||
MapboxMapOptions options = new MapboxMapOptions();
|
||||
options.accessToken(ApiAccess.getToken(this));
|
||||
@@ -58,12 +59,12 @@ public class SupportMapFragmentActivity extends AppCompatActivity {
|
||||
.zoom(9)
|
||||
.build());
|
||||
|
||||
mapFragment = MapFragment.newInstance(options);
|
||||
mapFragment = SupportMapFragment.newInstance(options);
|
||||
|
||||
transaction.add(R.id.fragment_container, mapFragment, "com.mapbox.map");
|
||||
transaction.commit();
|
||||
} else {
|
||||
mapFragment = (MapFragment) getFragmentManager().findFragmentByTag("com.mapbox.map");
|
||||
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentByTag("com.mapbox.map");
|
||||
}
|
||||
|
||||
mapFragment.getMapAsync(new OnMapReadyCallback() {
|
||||
|
||||
Reference in New Issue
Block a user