Samples MapsforgeActivity: remember map position (#515)
This commit is contained in:
parent
69ed1fe034
commit
dcad929316
@ -2,6 +2,7 @@
|
|||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2018 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
|
* Copyright 2018 Gustl22
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -204,12 +205,13 @@ public class MapsforgeActivity extends MapActivity {
|
|||||||
mMap.layers().add(mapScaleBarLayer);
|
mMap.layers().add(mapScaleBarLayer);
|
||||||
|
|
||||||
MapInfo info = mTileSource.getMapInfo();
|
MapInfo info = mTileSource.getMapInfo();
|
||||||
|
if (!info.boundingBox.contains(mMap.getMapPosition().getGeoPoint())) {
|
||||||
MapPosition pos = new MapPosition();
|
MapPosition pos = new MapPosition();
|
||||||
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
||||||
mMap.setMapPosition(pos);
|
mMap.setMapPosition(pos);
|
||||||
|
|
||||||
mPrefs.clear();
|
mPrefs.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (requestCode == SELECT_THEME_FILE) {
|
} else if (requestCode == SELECT_THEME_FILE) {
|
||||||
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
|
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user