summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java49
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java37
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java249
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java57
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java18
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/package-info.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/UserLocationView.java10
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/package-info.java4
10 files changed, 407 insertions, 25 deletions
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);
}
+ /**
+ * <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);
}
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;