diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-10-31 13:17:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 13:17:56 +0100 |
commit | ccc3964270e32145b050d97bf4c678941a5c6092 (patch) | |
tree | 7c917036dbe4c542d5bd42a6e997dcec78d6f8e7 /platform | |
parent | 38ee3408c224194054f7e4941a22dfd8b65f0d6f (diff) | |
download | qtlocation-mapboxgl-ccc3964270e32145b050d97bf4c678941a5c6092.tar.gz |
Android Nougat compatibility: onstart/onstop on MapView (#6830)
* introduce onstart/onstop on MapView
* update wear module
* update fragments
* update changeling
Diffstat (limited to 'platform')
53 files changed, 742 insertions, 182 deletions
diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 836e1da7ae..0030a0d125 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -2,6 +2,10 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started. +## 5.0.0 - TBA + +* Support for Android Nougat [#5910](5910-move-listener-logic-for-nougat) & [#6390](https://github.com/mapbox/mapbox-gl-native/pull/6390) + ## 4.2.0-beta.3 - September 21, 2016 Mapbox Android 4.2.0-beta.3 contains all 4.2.0-beta.2 changes and adds: 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 4fade484b4..9991f1d51a 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 @@ -23,7 +23,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * <li> You can unregister a {@link LocationListener} with {@link #removeLocationListener(LocationListener)}.</li> * </ul> * <p> - * Note: If registering a listener in your Activity.onResume() implementation, you should unregister it in Activity.onPause(). + * Note: If registering a listener in your Activity.onStart() implementation, you should unregister it in Activity.onStop(). * (You won't receive location updates when paused, and this will cut down on unnecessary system overhead). * Do not unregister in Activity.onSaveInstanceState(), because this won't be called if the user moves back in the history stack. * </p> 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 22f42c1d51..ba92926d2f 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 @@ -159,6 +159,7 @@ public final class MapFragment extends Fragment { @Override public void onStart() { super.onStart(); + map.onStart(); map.getMapAsync(onMapReadyCallback); } @@ -197,6 +198,7 @@ public final class MapFragment extends Fragment { @Override public void onStop() { super.onStop(); + map.onStop(); } /** 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 af0eacb378..ee2e32697e 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 @@ -160,6 +160,9 @@ public class MapView extends FrameLayout { private List<OnMapReadyCallback> onMapReadyCallbackList; private SnapshotRequest snapshotRequest; + private boolean onStartCalled; + private boolean onStopCalled; + @UiThread public MapView(@NonNull Context context) { super(context); @@ -573,16 +576,35 @@ public class MapView extends FrameLayout { } /** - * You must call this method from the parent's {@link Activity#onDestroy()} or {@link Fragment#onDestroy()}. + * You must call this method from the parent's {@link Activity#onStart()} or {@link Fragment#onStart()} */ @UiThread - public void onDestroy() { - destroyed = true; - nativeMapView.terminateContext(); - nativeMapView.terminateDisplay(); - nativeMapView.destroySurface(); - nativeMapView.destroy(); - nativeMapView = null; + public void onStart() { + onStartCalled = true; + + // Register for connectivity changes + connectivityReceiver = new ConnectivityReceiver(); + getContext().registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); + + nativeMapView.update(); + myLocationView.onStart(); + + // In case that no style was set or was loaded through MapboxMapOptions + if (!styleWasSet) { + setStyleUrl(styleUrl); + } + } + + /** + * You must call this method from the parent's {@link Activity#onResume()} or {@link Fragment#onResume()}. + */ + @UiThread + public void onResume() { + if (!onStartCalled) { + // TODO: 26/10/16, can be removed after 5.0.0 release + throw new IllegalStateException("MapView#onStart() was not called. " + + "You must call this method from the parent's {@link Activity#onStart()} or {@link Fragment#onStart()}."); + } } /** @@ -590,33 +612,44 @@ public class MapView extends FrameLayout { */ @UiThread public void onPause() { + // replaced by onStop in v5.0.0, keep around for future development + } + + /** + * You must call this method from the parent's {@link Activity#onStop()} or {@link Fragment#onStop()}. + */ + @UiThread + public void onStop() { + onStopCalled = true; + // Unregister for connectivity changes if (connectivityReceiver != null) { getContext().unregisterReceiver(connectivityReceiver); connectivityReceiver = null; } - myLocationView.onPause(); + myLocationView.onStop(); } /** - * You must call this method from the parent's {@link Activity#onResume()} or {@link Fragment#onResume()}. + * You must call this method from the parent's {@link Activity#onDestroy()} or {@link Fragment#onDestroy()}. */ @UiThread - public void onResume() { - // Register for connectivity changes - connectivityReceiver = new ConnectivityReceiver(); - getContext().registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); - - nativeMapView.update(); - myLocationView.onResume(); - - // In case that no style was set or was loaded through MapboxMapOptions - if (!styleWasSet) { - setStyleUrl(styleUrl); + public void onDestroy() { + if (!onStopCalled) { + // TODO: 26/10/16, can be removed after 5.0.0 release + throw new IllegalStateException("MapView#onStop() was not called. " + + "You must call this method from the parent's {@link Activity#onStop()} or {@link Fragment#onStop()}."); } - } + destroyed = true; + nativeMapView.terminateContext(); + nativeMapView.terminateDisplay(); + nativeMapView.destroySurface(); + nativeMapView.destroy(); + nativeMapView = null; + } + void setFocalPoint(PointF focalPoint) { if (focalPoint == null) { // resetting focal point, 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 72674c3bc9..31c2ffff14 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 @@ -167,6 +167,7 @@ public class SupportMapFragment extends Fragment { @Override public void onStart() { super.onStart(); + map.onStart(); map.getMapAsync(onMapReadyCallback); } @@ -205,6 +206,7 @@ public class SupportMapFragment extends Fragment { @Override public void onStop() { super.onStop(); + map.onStop(); } /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java index 45e0c4903e..36860b1cef 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java @@ -321,7 +321,7 @@ public class MyLocationView extends View { setBearing(position.bearing); } - public void onResume() { + public void onStart() { if (myBearingTrackingMode == MyBearingTracking.COMPASS) { compassListener.onResume(); } @@ -330,7 +330,7 @@ public class MyLocationView extends View { } } - public void onPause() { + public void onStop() { compassListener.onPause(); toggleGps(false); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java index 811a87c0ad..770494844f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java @@ -128,6 +128,11 @@ public class AddRemoveMarkerActivity extends AppCompatActivity { Log.d(MapboxConstants.TAG, "showHighThresholdMarker() " + activeMarker.getId()); } + @Override + protected void onStart() { + super.onStart(); + mapView.onStart(); + } @Override protected void onResume() { @@ -137,8 +142,14 @@ public class AddRemoveMarkerActivity extends AppCompatActivity { @Override protected void onPause() { - mapView.onPause(); super.onPause(); + mapView.onPause(); + } + + @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java index 569d5298a4..b732d5a066 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java @@ -188,18 +188,30 @@ public class AnimatedMarkerActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java index 148207bab9..2b84763dcd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java @@ -164,18 +164,30 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java index 3c3399168a..ed6cec7df0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/DynamicMarkerChangeActivity.java @@ -13,8 +13,6 @@ import android.view.View; import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -85,24 +83,36 @@ public class DynamicMarkerChangeActivity extends AppCompatActivity { marker.setPosition(first ? LAT_LNG_CHELSEA : LAT_LNG_ARSENAL); marker.setIcon(iconFactory.fromResource(first ? R.drawable.ic_chelsea : R.drawable.ic_arsenal)); marker.setTitle(first - ? getString(R.string.dynamic_marker_chelsea_title) : getString(R.string.dynamic_marker_arsenal_title)); + ? getString(R.string.dynamic_marker_chelsea_title) : getString(R.string.dynamic_marker_arsenal_title)); marker.setSnippet(first - ? getString(R.string.dynamic_marker_chelsea_snippet) : getString(R.string.dynamic_marker_arsenal_snippet)); + ? getString(R.string.dynamic_marker_chelsea_snippet) : getString(R.string.dynamic_marker_arsenal_snippet)); } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java index fe20b75a8d..81e7097eb3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java @@ -183,6 +183,7 @@ public class MarkerViewActivity extends AppCompatActivity { @Override protected void onStart() { super.onStart(); + mapView.onStart(); loopMarkerMove(); } @@ -193,6 +194,7 @@ public class MarkerViewActivity extends AppCompatActivity { @Override protected void onStop() { super.onStop(); + mapView.onStop(); locationUpdateHandler.removeCallbacks(moveMarkerRunnable); rotateUpdateHandler.removeCallbacks(rotateMarkerRunnable); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java index e4a3b3b2cb..befa63cca0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewScaleActivity.java @@ -76,18 +76,30 @@ public class MarkerViewScaleActivity extends AppCompatActivity implements OnMapR } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java index dd80b2ba5a..7b056fde29 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolygonActivity.java @@ -88,18 +88,29 @@ public class PolygonActivity extends AppCompatActivity implements OnMapReadyCall } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java index dabac927d9..7841242fff 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PolylineActivity.java @@ -124,25 +124,38 @@ public class PolylineActivity extends AppCompatActivity { public List<PolylineOptions> getRandomLine() { final List<PolylineOptions> randomLines = getAllPolylines(); Collections.shuffle(randomLines); - return new ArrayList<PolylineOptions>() {{ - add(randomLines.get(0)); - } + return new ArrayList<PolylineOptions>() { + { + add(randomLines.get(0)); + } }; } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java index f5030ba649..cdb69d572b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/PressForMarkerActivity.java @@ -100,18 +100,30 @@ public class PressForMarkerActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java index 91f2a2d69b..244759713e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java @@ -160,18 +160,30 @@ public class CameraAnimationTypeActivity extends AppCompatActivity implements On } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java index 925244b4a4..eb289d7d4b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java @@ -99,18 +99,30 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe } @Override - public void onPause() { - super.onPause(); - mapView.onPause(); + protected void onStart() { + super.onStart(); + mapView.onStart(); } @Override - public void onResume() { + protected void onResume() { super.onResume(); mapView.onResume(); } @Override + protected void onPause() { + super.onPause(); + mapView.onPause(); + } + + @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java index 311991d0d1..ed5f761ab4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java @@ -89,18 +89,30 @@ public class LatLngBoundsActivity extends AppCompatActivity implements OnMapRead } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java index 740efd5536..38186b0318 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java @@ -92,18 +92,30 @@ public class ManualZoomActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java index 9fcdfa3880..ca72db598a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java @@ -54,18 +54,30 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index e3dc849ce0..6466537e39 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -78,18 +78,30 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java index a1aced6eaa..778ab0ad04 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/customlayer/CustomLayerActivity.java @@ -90,18 +90,30 @@ public class CustomLayerActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java index 6d5d63dbf7..3db32cc883 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/directions/DirectionsActivity.java @@ -146,18 +146,30 @@ public class DirectionsActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java index f9a067daf0..a2ac43960f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java @@ -105,18 +105,30 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java index 1e8f91857b..4a24ff964f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java @@ -98,18 +98,30 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java index 8abf638d16..184811f222 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java @@ -149,18 +149,30 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java index baa020fe95..df3f9e0851 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/geocoding/GeocoderActivity.java @@ -99,18 +99,30 @@ public class GeocoderActivity extends AppCompatActivity implements OnMapReadyCal } @Override - public void onPause() { - super.onPause(); - mapView.onPause(); + protected void onStart() { + super.onStart(); + mapView.onStart(); } @Override - public void onResume() { + protected void onResume() { super.onResume(); mapView.onResume(); } @Override + protected void onPause() { + super.onPause(); + mapView.onPause(); + } + + @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java index 18353003d1..6f3e556242 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/PrintActivity.java @@ -64,18 +64,30 @@ public class PrintActivity extends AppCompatActivity implements MapboxMap.Snapsh } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java index ab4188fd52..2da0e19a23 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java @@ -64,26 +64,38 @@ public class SnapshotActivity extends AppCompatActivity implements OnMapReadyCal ImageView snapshotView = (ImageView) findViewById(R.id.imageView); snapshotView.setImageBitmap(snapshot); Toast.makeText( - SnapshotActivity.this, - String.format("Snapshot taken in %d ms", duration), - Toast.LENGTH_LONG).show(); + SnapshotActivity.this, + String.format("Snapshot taken in %d ms", duration), + Toast.LENGTH_LONG).show(); } }); } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java index cf522d7f39..8942f69b90 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java @@ -119,18 +119,30 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java index 113c46c3e5..e8e207e180 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowActivity.java @@ -123,23 +123,35 @@ public class InfoWindowActivity extends AppCompatActivity customMarker = mapboxMap.addMarker(new MarkerOptions() .title("Custom Marker") .snippet(new DecimalFormat("#.#####").format(point.getLatitude()) + ", " - + new DecimalFormat("#.#####").format(point.getLongitude())) + + new DecimalFormat("#.#####").format(point.getLongitude())) .position(point)); } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java index 8066dbc60e..0c4c4de763 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/InfoWindowAdapterActivity.java @@ -104,18 +104,30 @@ public class InfoWindowAdapterActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java index 377d5d18f0..d80a68f68d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java @@ -87,18 +87,30 @@ public class DebugModeActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java index 3df236f43c..b80ef348e2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java @@ -84,6 +84,12 @@ public class MapInDialogActivity extends AppCompatActivity { } @Override + public void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override public void onResume() { super.onResume(); mapView.onResume(); @@ -96,6 +102,12 @@ public class MapInDialogActivity extends AppCompatActivity { } @Override + public void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onDestroy() { super.onDestroy(); mapView.onDestroy(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java index 114262220a..d127e03126 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapPaddingActivity.java @@ -58,18 +58,30 @@ public class MapPaddingActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java index 43b4264661..875e53d5bb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SurfaceViewMediaControlActivity.java @@ -55,18 +55,30 @@ public class SurfaceViewMediaControlActivity extends AppCompatActivity implement } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VideoViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VideoViewActivity.java index 96637fae87..d114ae1b70 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VideoViewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/VideoViewActivity.java @@ -60,18 +60,30 @@ public class VideoViewActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java index a40ec0534c..65ce23133f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/CarDrivingActivity.java @@ -146,18 +146,30 @@ public class CarDrivingActivity extends AppCompatActivity implements MapboxMap.O } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java index be5498babb..8993c72046 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/navigation/LocationPickerActivity.java @@ -94,12 +94,12 @@ public class LocationPickerActivity extends AppCompatActivity { //Add user marker mapboxMap.getMarkerViewManager().addMarkerViewAdapter( - new PulseMarkerViewAdapter(LocationPickerActivity.this)); + new PulseMarkerViewAdapter(LocationPickerActivity.this)); userMarker = createCustomUserMarker(new LatLng(0, 0)); //Fix the focal point to the center of the map PointF focalPoint = new PointF( - (mapView.getX() + mapView.getWidth() / 2), (mapView.getY() + mapView.getHeight() / 2)); + (mapView.getX() + mapView.getWidth() / 2), (mapView.getY() + mapView.getHeight() / 2)); mapboxMap.getUiSettings().setFocalPoint(focalPoint); //Track camera updates to animate the user location views @@ -108,47 +108,6 @@ public class LocationPickerActivity extends AppCompatActivity { }); } - @Override - public void onResume() { - super.onResume(); - mapView.onResume(); - - //Check permissions - if (arePermissionsGranted()) { - mapView.getMapAsync(new OnMapReadyCallback() { - - @Override - public void onMapReady(final MapboxMap mapboxMap) { - //Get the user's location - final LocationServices locationServices = LocationServices.getLocationServices(getApplicationContext()); - - Location location = locationServices.getLastLocation(); - if (location != null) { - zoomInOn(location); - userMarker.setPosition(new LatLng(location)); - } else { - final ProgressDialog loadingDialog = ProgressDialog.show( - LocationPickerActivity.this, "Loading", "Getting user location", false); - locationServices.addLocationListener(new LocationListener() { - @Override - public void onLocationChanged(@Nullable Location location) { - //Move the camera to the user - if (location != null) { - zoomInOn(location); - userMarker.setPosition(new LatLng(location)); - locationServices.removeLocationListener(this); - loadingDialog.hide(); - } - } - }); - } - - locationServices.toggleGPS(true); - } - }); - } - } - private void zoomInOn(Location location) { //Move the camera to the user if (location != null) { @@ -276,7 +235,7 @@ public class LocationPickerActivity extends AppCompatActivity { dropPinView = new ImageView(this); dropPinView.setImageResource(R.drawable.ic_droppin_24dp); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); params.bottomMargin = (int) (12 * density); dropPinView.setLayoutParams(params); @@ -384,11 +343,11 @@ public class LocationPickerActivity extends AppCompatActivity { private boolean arePermissionsGranted() { if (Build.VERSION.SDK_INT >= 23 - && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED - && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED + && checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { Log.i(TAG, "Requesting permissions"); ActivityCompat.requestPermissions(this, new String[]{ - Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSIONS); + Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSIONS); return false; } Log.i(TAG, "Permissions already granted"); @@ -396,12 +355,59 @@ public class LocationPickerActivity extends AppCompatActivity { } @Override - public void onPause() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + + //Check permissions + if (arePermissionsGranted()) { + mapView.getMapAsync(new OnMapReadyCallback() { + + @Override + public void onMapReady(final MapboxMap mapboxMap) { + //Get the user's location + final LocationServices locationServices = LocationServices.getLocationServices(getApplicationContext()); + + Location location = locationServices.getLastLocation(); + if (location != null) { + zoomInOn(location); + userMarker.setPosition(new LatLng(location)); + } else { + final ProgressDialog loadingDialog = ProgressDialog.show( + LocationPickerActivity.this, "Loading", "Getting user location", false); + locationServices.addLocationListener(new LocationListener() { + @Override + public void onLocationChanged(@Nullable Location location) { + //Move the camera to the user + if (location != null) { + zoomInOn(location); + userMarker.setPosition(new LatLng(location)); + locationServices.removeLocationListener(this); + loadingDialog.hide(); + } + } + }); + } + + locationServices.toggleGPS(true); + } + }); + } + } + + @Override + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java index e9dd9dc5f4..78acde38be 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java @@ -128,18 +128,30 @@ public class OfflineActivity extends AppCompatActivity } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java index 44380ae5b5..e7b00e2a7c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java @@ -101,18 +101,30 @@ public class CircleLayerActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java index 69108c6e1b..bdd3963e85 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java @@ -1,13 +1,10 @@ package com.mapbox.mapboxsdk.testapp.activity.style; -import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; -import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; @@ -16,27 +13,19 @@ import android.view.MenuItem; import android.view.View; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; -import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; import com.mapbox.services.commons.geojson.Point; import com.mapbox.services.commons.models.Position; -import java.net.MalformedURLException; -import java.net.URL; - -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; /** @@ -114,18 +103,30 @@ public class CustomSpriteActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java index 9d13ee165d..f1f0d82bd1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java @@ -67,18 +67,30 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java index debd44fb1f..1743b5e8e7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java @@ -82,6 +82,12 @@ public class RealTimeGeoJsonActivity extends AppCompatActivity implements OnMapR } @Override + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override public void onResume() { super.onResume(); mapView.onResume(); @@ -96,6 +102,7 @@ public class RealTimeGeoJsonActivity extends AppCompatActivity implements OnMapR @Override protected void onStop() { super.onStop(); + mapView.onStop(); handler.removeCallbacks(runnable); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index efe82ee9a6..47f112489b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -110,18 +110,30 @@ public class RuntimeStyleActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java index 6f04852ca1..879945d290 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java @@ -38,18 +38,30 @@ public class RuntimeStyleTestActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java index 83378148ae..711ccab257 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java @@ -58,18 +58,30 @@ public class RuntimeStyleTimingTestActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java index aa739be229..d4cecf4db4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java @@ -131,18 +131,30 @@ public class StyleFileActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java index 301636611c..4a9e472cc8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java @@ -127,18 +127,30 @@ public class MyLocationDrawableActivity extends AppCompatActivity implements Loc } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java index 929c2f0b75..77cba30372 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java @@ -127,6 +127,7 @@ public class MyLocationTintActivity extends AppCompatActivity implements Locatio @Override protected void onStart() { super.onStart(); + mapView.onStart(); LocationServices.getLocationServices(this).addLocationListener(this); } @@ -146,6 +147,7 @@ public class MyLocationTintActivity extends AppCompatActivity implements Locatio protected void onStop() { super.onStop(); LocationServices.getLocationServices(this).removeLocationListener(this); + mapView.onStop(); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java index c2498223a2..1c8f739bdd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationToggleActivity.java @@ -66,18 +66,30 @@ public class MyLocationToggleActivity extends AppCompatActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java index 2c923a3ba9..50d2eb841a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java @@ -252,18 +252,30 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/activity/SimpleMapViewActivity.java b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/activity/SimpleMapViewActivity.java index d6f3ccd410..b24b626fe6 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/activity/SimpleMapViewActivity.java +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/activity/SimpleMapViewActivity.java @@ -29,18 +29,30 @@ public class SimpleMapViewActivity extends WearableActivity { } @Override - public void onResume() { + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { super.onResume(); mapView.onResume(); } @Override - public void onPause() { + protected void onPause() { super.onPause(); mapView.onPause(); } @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); |