Skip to content

Commit c682e62

Browse files
committed
Clean up saved map center state
1 parent 465cf93 commit c682e62

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

app/src/main/java/org/nitri/opentopo/MapFragment.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
207207
mMapView.getOverlays().add(this.mCompassOverlay);
208208
mMapView.getOverlays().add(this.mScaleBarOverlay);
209209

210-
if (mMapCenterState != null) {
211-
mMapView.getController().setCenter(mMapCenterState);
212-
}
213-
214210
mMapView.addMapListener(new DelayedMapListener(mDragListener));
215211

216212
mCopyRightView = view.findViewById(R.id.copyrightView);
@@ -255,8 +251,10 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
255251
} else {
256252
mCurrentLocation = mLocationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
257253
}
254+
258255
if (mMapCenterState != null) {
259256
mMapView.getController().setCenter(mMapCenterState);
257+
mMapCenterState = null; // We're done with the old state
260258
} else if (mCurrentLocation != null) {
261259
mMapView.getController().setCenter(new GeoPoint(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()));
262260
}

0 commit comments

Comments
 (0)