From 0515b1af842040438d026264f1b6eaa4ac0532b4 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 29 May 2010 10:16:10 +0000 Subject: [PATCH] fix some issues git-svn-id: https://osmand.googlecode.com/svn/trunk@97 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 10 ++++------ .../src/com/osmand/activities/MapActivity.java | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 813f71d50a..5bbfe944fb 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -15,13 +15,14 @@ public class ToDoConstants { // TODO ANDROID // 25. POI search near to map location (show categories & type). Second cut. (implement incremental search) -// 3. Revise osmand UI. Preparing new icons (revise UI 18, 2, ). +// 3. Revise osmand UI. Preparing new icons (revise UI 18, 2, ). Main application icon, back to location icon. // 13. Save point as favorite & introduce favorite points dialog // 14. Show zoom level on map // 24. Implement ResourceManager, load cities/streets/buildings on Low memory (clear previous all addresses cities). // 5. Search for city/streets/buildings -// 15. Investigate interruption of any long running operation & implement where it is needed +// 15. Investigate interruption of any long running operation & implement where it is needed. +// Fix progress information (loading indices). // 21. Implement zooming tile (if tile doesn't exist local, we can zoom in previous tile). // 8. Enable change POI directly on map (requires OSM login) @@ -29,14 +30,11 @@ public class ToDoConstants { // 20. Implement save track/route to gpx (?) // FIXME Bugs Android : - // 0. FIX TODO for partial loading rotated map // 1. When firstly run osmand navigation (from notification bar) show map & go to menu shows desktop. // No chance to close application - // 3. Fix progress information (loading indices) for android version - // 4. Fix when POI selected & enable button backToLocation - // 5. Call ResourceManager.close when it is needed // 6. Understand concept of application where to save/restore global setting. // (for example reset navigate to point, reset link map with location). It should be reset after user call exit. + // Call ResourceManager.close when it is needed. // 8. Introduce activity search by location (unify with existing dialog) // 9. When all features will be ready we can remove show location from context menu diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 3e8952d926..9a86e66162 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -97,11 +97,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat } SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE); - if(prefs != null && prefs.contains(OsmandSettings.LAST_KNOWN_MAP_LAT)){ - LatLon l = OsmandSettings.getLastKnownMapLocation(this); - mapView.setLatLon(l.getLatitude(), l.getLongitude()); - mapView.setZoom(OsmandSettings.getLastKnownMapZoom(this)); - } else { + if(prefs == null || !prefs.contains(OsmandSettings.LAST_KNOWN_MAP_LAT)){ LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); Location location = service.getLastKnownLocation(LocationManager.GPS_PROVIDER); if(location != null){ @@ -126,7 +122,6 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat } }); backToLocation = (ImageButton)findViewById(R.id.BackToLocation); - backToLocation.setVisibility(View.INVISIBLE); backToLocation.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { @@ -278,6 +273,17 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat mapView.setRotate(0); } mapView.setMapPosition(OsmandSettings.getPositionOnMap(this)); + SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE); + if(prefs != null && prefs.contains(OsmandSettings.LAST_KNOWN_MAP_LAT)){ + LatLon l = OsmandSettings.getLastKnownMapLocation(this); + mapView.setLatLon(l.getLatitude(), l.getLongitude()); + mapView.setZoom(OsmandSettings.getLastKnownMapZoom(this)); + } + if(getLastKnownLocation() != null){ + backToLocation.setVisibility(View.VISIBLE); + } else { + backToLocation.setVisibility(View.INVISIBLE); + } if(mapView.getLayers().contains(poiMapLayer) != OsmandSettings.isShowingPoiOverMap(this)){