summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapFragment.java49
1 files changed, 48 insertions, 1 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;
}