From d64652f9bef9f1c252d197d3ceed638778540d6f Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 11 Mar 2016 15:18:59 -0500 Subject: [android] #3749 - added javadoc --- .../multitouch/gesturedetectors/package-info.java | 2 +- .../mapbox/mapboxsdk/annotations/Annotation.java | 11 +- .../mapboxsdk/annotations/BaseMarkerOptions.java | 8 + .../mapbox/mapboxsdk/annotations/package-info.java | 2 +- .../mapbox/mapboxsdk/camera/CameraPosition.java | 9 +- .../com/mapbox/mapboxsdk/camera/CameraUpdate.java | 6 +- .../mapboxsdk/camera/CameraUpdateFactory.java | 63 +++--- .../com/mapbox/mapboxsdk/camera/package-info.java | 2 +- .../mapbox/mapboxsdk/constants/package-info.java | 2 +- .../exceptions/IconBitmapChangedException.java | 2 +- .../exceptions/InvalidAccessTokenException.java | 2 +- .../exceptions/InvalidLatLngBoundsException.java | 6 +- .../exceptions/TooManyIconsException.java | 2 +- .../mapbox/mapboxsdk/exceptions/package-info.java | 2 +- .../mapbox/mapboxsdk/geometry/LatLngBounds.java | 13 +- .../com/mapbox/mapboxsdk/geometry/LatLngSpan.java | 28 ++- .../mapbox/mapboxsdk/geometry/ProjectedMeters.java | 31 ++- .../mapbox/mapboxsdk/geometry/package-info.java | 2 +- .../com/mapbox/mapboxsdk/http/HTTPRequest.java | 3 +- .../com/mapbox/mapboxsdk/http/package-info.java | 2 +- .../com/mapbox/mapboxsdk/layers/CustomLayer.java | 12 +- .../com/mapbox/mapboxsdk/layers/package-info.java | 2 +- .../mapboxsdk/location/LocationServices.java | 3 + .../mapbox/mapboxsdk/location/package-info.java | 2 +- .../com/mapbox/mapboxsdk/maps/MapFragment.java | 49 +++- .../java/com/mapbox/mapboxsdk/maps/MapView.java | 4 +- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 37 ++- .../mapbox/mapboxsdk/maps/MapboxMapOptions.java | 249 +++++++++++++++++++++ .../java/com/mapbox/mapboxsdk/maps/Projection.java | 2 +- .../mapbox/mapboxsdk/maps/SupportMapFragment.java | 57 ++++- .../mapbox/mapboxsdk/maps/TrackingSettings.java | 18 +- .../com/mapbox/mapboxsdk/maps/package-info.java | 2 +- .../mapboxsdk/maps/widgets/UserLocationView.java | 10 +- .../mapboxsdk/maps/widgets/package-info.java | 4 + .../com/mapbox/mapboxsdk/offline/package-info.java | 4 + .../java/com/mapbox/mapboxsdk/package-info.java | 2 +- .../mapbox/mapboxsdk/telemetry/package-info.java | 2 +- .../com/mapbox/mapboxsdk/utils/package-info.java | 2 +- .../testapp/SupportMapFragmentActivity.java | 11 +- 39 files changed, 568 insertions(+), 102 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/package-info.java diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java index abc0a11892..cff2f086dc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java index ce6a3ee55f..114e809b9e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java @@ -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. *

* it manages attachment to a map and identification, but does not require @@ -55,10 +55,15 @@ public abstract class Annotation implements Comparable { /** * 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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java index 5b1eebdb1b..fe8bf67920 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java @@ -4,6 +4,14 @@ import android.os.Parcelable; import com.mapbox.mapboxsdk.geometry.LatLng; +/** + * Abstract builder class for composing custom Marker objects. + *

+ * Extending this class requires implementing Parceable interface. + * + * @param Type of the marker to be composed + * @param Type of the builder to be used for composing a custom Marker + */ public abstract class BaseMarkerOptions> implements Parcelable { protected LatLng position; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/package-info.java index 64ab895079..1e2dc542fa 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java index 233e8946e7..679a474ae7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java @@ -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 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. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java index c6852624ef..94ee4912ce 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java @@ -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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 93d1cd2e66..acec8f17fb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/package-info.java index c480bdacf5..04ef699c21 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/package-info.java index 75c712074f..165394c03a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/IconBitmapChangedException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/IconBitmapChangedException.java index c66a757098..1be82d6178 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/IconBitmapChangedException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/IconBitmapChangedException.java @@ -9,7 +9,7 @@ import com.mapbox.mapboxsdk.maps.MapView; /** *

* 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. *

* You cannot modify a {@code Icon} after it has been added to the map in a {@code Marker} * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidAccessTokenException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidAccessTokenException.java index 9567708b27..77797ecb4f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidAccessTokenException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidAccessTokenException.java @@ -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) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidLatLngBoundsException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidLatLngBoundsException.java index cf30d6ff26..92feaac64b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidLatLngBoundsException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidLatLngBoundsException.java @@ -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"); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TooManyIconsException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TooManyIconsException.java index 1164b13a1c..4dcdea112c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TooManyIconsException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TooManyIconsException.java @@ -6,7 +6,7 @@ import com.mapbox.mapboxsdk.annotations.IconFactory; /** *

* 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. *

* You should try to reuse Icon objects whenever possible. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/package-info.java index 3b4c3394c9..09ecd55c1d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/package-info.java @@ -1,4 +1,4 @@ /** - * This package contains map specific exception classes. + * Contains the Mapbox Maps Android Exception API classes. */ package com.mapbox.mapboxsdk.exceptions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java index 82258e5b1d..3b63871382 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java @@ -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 mLatLngList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java index 9d4fb163fa..81e52666f6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java index 06a58fe8ad..8887658a3e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java @@ -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. *

@@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/package-info.java index 51d4330735..754af76591 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index 9cffc3c89c..10ab7a5bbb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -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) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/package-info.java index a5dbf30463..09eeda2b75 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/CustomLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/CustomLayer.java index f6fb297dc6..30efd59a6e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/CustomLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/CustomLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/package-info.java index b444050cb6..4c58308c47 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/layers/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java index 2f592a0847..95278ed508 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java @@ -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"; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java index 543cb68324..6b0c9a76c0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java index 205fad9d8e..dd056ff9b7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 23141c94e7..92a815a39c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -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 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 5272eb9a5b..fbeefd6ef6 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 @@ -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); } + /** + *

+ * Adds a marker to this map. + *

+ * 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); } 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 5aff0d6569..941d2f1c60 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 @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java index 0d5745d4c9..9482b1a2f7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java @@ -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 { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java index e56a4f0cdb..9cf946758f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java @@ -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; } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java index 1a1c2407ce..90147929e9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java @@ -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; } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/package-info.java index 3451e0aece..08ddc0bf86 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/UserLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/UserLocationView.java index dcc440dd1c..37a88e2ff3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/UserLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/UserLocationView.java @@ -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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/package-info.java new file mode 100644 index 0000000000..5e8d20f069 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Widgets API classes. + */ +package com.mapbox.mapboxsdk.maps.widgets; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/package-info.java new file mode 100644 index 0000000000..0c8d2ab6dd --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Offline API classes. + */ +package com.mapbox.mapboxsdk.offline; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/package-info.java index 55639afa23..f18c1402d7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/package-info.java index e10f190678..725cf016be 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/package-info.java index f81f9bad6b..9306a5b18a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/package-info.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/package-info.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/SupportMapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/SupportMapFragmentActivity.java index 956a4c1fca..efd4f52890 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/SupportMapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/SupportMapFragmentActivity.java @@ -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() { -- cgit v1.2.1