[android] - harden activation/deactivation of underlying ref counting components
This commit is contained in:
@@ -89,6 +89,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
private MapKeyListener mapKeyListener;
|
||||
@Nullable
|
||||
private Bundle savedInstanceState;
|
||||
private boolean isActivated;
|
||||
|
||||
@UiThread
|
||||
public MapView(@NonNull Context context) {
|
||||
@@ -345,8 +346,11 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
*/
|
||||
@UiThread
|
||||
public void onStart() {
|
||||
ConnectivityReceiver.instance(getContext()).activate();
|
||||
FileSource.getInstance(getContext()).activate();
|
||||
if (!isActivated) {
|
||||
ConnectivityReceiver.instance(getContext()).activate();
|
||||
FileSource.getInstance(getContext()).activate();
|
||||
isActivated = true;
|
||||
}
|
||||
if (mapboxMap != null) {
|
||||
mapboxMap.onStart();
|
||||
}
|
||||
@@ -391,8 +395,11 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
mapRenderer.onStop();
|
||||
}
|
||||
|
||||
ConnectivityReceiver.instance(getContext()).deactivate();
|
||||
FileSource.getInstance(getContext()).deactivate();
|
||||
if (isActivated) {
|
||||
ConnectivityReceiver.instance(getContext()).deactivate();
|
||||
FileSource.getInstance(getContext()).deactivate();
|
||||
isActivated = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user