Android Nougat compatibility: onstart/onstop on MapView (#6830)
* introduce onstart/onstop on MapView * update wear module * update fragments * update changeling
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,43 +576,18 @@ 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;
|
||||
|
||||
/**
|
||||
* You must call this method from the parent's {@link Activity#onPause()} or {@link Fragment#onPause()}.
|
||||
*/
|
||||
@UiThread
|
||||
public void onPause() {
|
||||
// Unregister for connectivity changes
|
||||
if (connectivityReceiver != null) {
|
||||
getContext().unregisterReceiver(connectivityReceiver);
|
||||
connectivityReceiver = null;
|
||||
}
|
||||
|
||||
myLocationView.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* You must call this method from the parent's {@link Activity#onResume()} or {@link Fragment#onResume()}.
|
||||
*/
|
||||
@UiThread
|
||||
public void onResume() {
|
||||
// Register for connectivity changes
|
||||
connectivityReceiver = new ConnectivityReceiver();
|
||||
getContext().registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
|
||||
|
||||
nativeMapView.update();
|
||||
myLocationView.onResume();
|
||||
myLocationView.onStart();
|
||||
|
||||
// In case that no style was set or was loaded through MapboxMapOptions
|
||||
if (!styleWasSet) {
|
||||
@@ -617,6 +595,61 @@ public class MapView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()}.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* You must call this method from the parent's {@link Activity#onPause()} or {@link Fragment#onPause()}.
|
||||
*/
|
||||
@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.onStop();
|
||||
}
|
||||
|
||||
/**
|
||||
* You must call this method from the parent's {@link Activity#onDestroy()} or {@link Fragment#onDestroy()}.
|
||||
*/
|
||||
@UiThread
|
||||
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,
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -188,17 +188,29 @@ 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);
|
||||
|
||||
@@ -164,17 +164,29 @@ 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);
|
||||
|
||||
@@ -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,23 +83,35 @@ 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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -76,17 +76,29 @@ 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);
|
||||
|
||||
@@ -88,17 +88,28 @@ 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);
|
||||
|
||||
@@ -124,24 +124,37 @@ 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);
|
||||
|
||||
@@ -100,17 +100,29 @@ 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();
|
||||
|
||||
@@ -160,17 +160,29 @@ 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);
|
||||
|
||||
@@ -99,15 +99,27 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -89,17 +89,29 @@ 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);
|
||||
|
||||
@@ -92,17 +92,29 @@ 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);
|
||||
|
||||
@@ -54,17 +54,29 @@ 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);
|
||||
|
||||
@@ -78,17 +78,29 @@ 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);
|
||||
|
||||
@@ -90,17 +90,29 @@ 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);
|
||||
|
||||
@@ -146,17 +146,29 @@ 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);
|
||||
|
||||
@@ -105,17 +105,29 @@ 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);
|
||||
|
||||
@@ -98,17 +98,29 @@ 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);
|
||||
|
||||
@@ -149,17 +149,29 @@ 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);
|
||||
|
||||
@@ -99,15 +99,27 @@ public class GeocoderActivity extends AppCompatActivity implements OnMapReadyCal
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,17 +64,29 @@ 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);
|
||||
|
||||
@@ -64,25 +64,37 @@ 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);
|
||||
|
||||
@@ -119,17 +119,29 @@ 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);
|
||||
|
||||
@@ -123,22 +123,34 @@ 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);
|
||||
|
||||
@@ -104,17 +104,29 @@ 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);
|
||||
|
||||
@@ -87,17 +87,29 @@ 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);
|
||||
|
||||
@@ -83,6 +83,12 @@ public class MapInDialogActivity extends AppCompatActivity {
|
||||
mapView.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -95,6 +101,12 @@ public class MapInDialogActivity extends AppCompatActivity {
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -58,17 +58,29 @@ 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);
|
||||
|
||||
@@ -55,17 +55,29 @@ 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);
|
||||
|
||||
@@ -60,17 +60,29 @@ 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();
|
||||
|
||||
@@ -146,17 +146,29 @@ 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);
|
||||
|
||||
@@ -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,11 +355,58 @@ 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);
|
||||
|
||||
@@ -128,17 +128,29 @@ 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);
|
||||
|
||||
@@ -101,17 +101,29 @@ 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);
|
||||
|
||||
@@ -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,17 +103,29 @@ 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);
|
||||
|
||||
@@ -67,17 +67,29 @@ 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);
|
||||
|
||||
@@ -81,6 +81,12 @@ public class RealTimeGeoJsonActivity extends AppCompatActivity implements OnMapR
|
||||
handler.postDelayed(runnable, 2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -96,6 +102,7 @@ public class RealTimeGeoJsonActivity extends AppCompatActivity implements OnMapR
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,17 +110,29 @@ 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);
|
||||
|
||||
@@ -38,17 +38,29 @@ 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);
|
||||
|
||||
@@ -58,17 +58,29 @@ 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);
|
||||
|
||||
@@ -131,17 +131,29 @@ 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);
|
||||
|
||||
@@ -127,17 +127,29 @@ 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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -66,17 +66,29 @@ 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);
|
||||
|
||||
@@ -252,17 +252,29 @@ 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);
|
||||
|
||||
@@ -29,17 +29,29 @@ 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();
|
||||
|
||||
Reference in New Issue
Block a user