diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index e2a9f57537..ca51b7608f 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -11,20 +11,24 @@ public class ToDoConstants { // TODO ANDROID // for 0.3 // 68. Implement service to app work with screen offline - // (audio guidance & add new item to status bar & introduce error interval for building) + // (audio guidance & add new item to status bar & introduce error interval for gps building) // for offline service save gpx (combine in one trkseg) - // 71. Implement different mechanism for tiles (see rmaps) + // 71. Implement different mechanism for tiles (big sqlite planet see rmaps) // Improvement : Show stops in the transport route on the map // Improvement : show favorites on the map? + // Improvement : hard to press on the POI/.... // Improvement : show detailed route on the map with turns and show route information directly (like in gmaps) // Improvement : redesign poi selecting (show on map ) // Improvement : progress while loading tiles // Improvement : download with wget // Improvement : cloudmade as map? // Yandex traffic : http://jgo.maps.yandex.net/tiles?l=trf - // BUG add button show my location + // FIXME + // 1. Bug with duplicated turns + // 2. Bug with network location while routing (?) + // 3. TODO options : using trackball as an option // Not clear if it is really needed diff --git a/OsmAnd/res/menu/map_menu.xml b/OsmAnd/res/menu/map_menu.xml index bc10f6b8ee..a848087edd 100644 --- a/OsmAnd/res/menu/map_menu.xml +++ b/OsmAnd/res/menu/map_menu.xml @@ -2,13 +2,14 @@ - + + - + diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index d0552bc58b..4921ea7e9c 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -1,5 +1,6 @@ + Где я? Сеть GPS мин. diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 8564889268..0faccbeb64 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,6 @@ + Where am I? Osmand navigation service Network GPS diff --git a/OsmAnd/src/com/osmand/ResourceManager.java b/OsmAnd/src/com/osmand/ResourceManager.java index 429d4d33c3..bfda9e612a 100644 --- a/OsmAnd/src/com/osmand/ResourceManager.java +++ b/OsmAnd/src/com/osmand/ResourceManager.java @@ -57,7 +57,8 @@ public class ResourceManager { } // it is not good investigated but no more than 64 (satellite images) - protected final int maxImgCacheSize = 64; + // Only 8 MB (from 16 Mb whole mem) available for images : image 64K * 128 = 8 MB (8 bit), 64 - 16 bit, 32 - 128 bit + protected final int maxImgCacheSize = 48; protected Map cacheOfImages = new LinkedHashMap(); protected Map imagesOnFS = new LinkedHashMap() ; @@ -105,6 +106,8 @@ public class ResourceManager { } } else if(f.getName().endsWith(".tile")){ //$NON-NLS-1$ imagesOnFS.put(prefix + f.getName(), Boolean.TRUE); + } else if(f.getName().endsWith(".sqlitedb")){ //$NON-NLS-1$ + // TODO } } @@ -211,7 +214,7 @@ public class ResourceManager { long time = System.currentTimeMillis(); cacheOfImages.put(req.fileToLoad, BitmapFactory.decodeFile(en.getAbsolutePath())); if (log.isDebugEnabled()) { - log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms " + cacheOfImages.size()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } @@ -442,6 +445,7 @@ public class ResourceManager { protected void clearTiles(){ + log.info("Cleaning tiles - size = " + cacheOfImages.size()); //$NON-NLS-1$ ArrayList list = new ArrayList(cacheOfImages.keySet()); // remove first images (as we think they are older) for (int i = 0; i < list.size()/2; i ++) { diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 3a41d6af49..9bbde8246c 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -256,18 +256,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso backToLocation.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { - backToLocation.setVisibility(View.INVISIBLE); - if(!isMapLinkedToLocation()){ - OsmandSettings.setSyncMapToGpsLocation(MapActivity.this, true); - if(locationLayer.getLastKnownLocation() != null){ - Location lastKnownLocation = locationLayer.getLastKnownLocation(); - AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread(); - int fZoom = mapView.getZoom() < 15 ? 15 : mapView.getZoom(); - thread.startMoving(mapView.getLatitude(), mapView.getLongitude(), - lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(), mapView.getZoom(), fZoom, - mapView.getSourceTileSize(), mapView.getRotate(), false); - } - } + backToLocationImpl(); } }); @@ -533,7 +522,9 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso if(LocationProvider.OUT_OF_SERVICE == status){ setLocation(null); } - if (!isRunningOnEmulator() && service.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { + // do not use it in routing + if (!isRunningOnEmulator() && !routingHelper.isFollowingMode() && + service.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { if (!Algoritms.objectEquals(currentLocationProvider, LocationManager.NETWORK_PROVIDER)) { currentLocationProvider = LocationManager.NETWORK_PROVIDER; service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); @@ -775,6 +766,9 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso final Intent settings = new Intent(MapActivity.this, SettingsActivity.class); startActivity(settings); return true; + } else if (item.getItemId() == R.id.map_where_am_i) { + backToLocationImpl(); + return true; } else if (item.getItemId() == R.id.map_show_gps_status) { Intent intent = new Intent(); intent.setComponent(new ComponentName(GPS_STATUS_COMPONENT, GPS_STATUS_ACTIVITY)); @@ -1054,5 +1048,20 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso public void onAccuracyChanged(Sensor sensor, int accuracy) { } + protected void backToLocationImpl() { + backToLocation.setVisibility(View.INVISIBLE); + if(!isMapLinkedToLocation()){ + OsmandSettings.setSyncMapToGpsLocation(MapActivity.this, true); + if(locationLayer.getLastKnownLocation() != null){ + Location lastKnownLocation = locationLayer.getLastKnownLocation(); + AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread(); + int fZoom = mapView.getZoom() < 15 ? 15 : mapView.getZoom(); + thread.startMoving(mapView.getLatitude(), mapView.getLongitude(), + lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(), mapView.getZoom(), fZoom, + mapView.getSourceTileSize(), mapView.getRotate(), false); + } + } + } + } diff --git a/OsmAnd/src/com/osmand/activities/RouteProvider.java b/OsmAnd/src/com/osmand/activities/RouteProvider.java index bdc4aed552..c114742aa0 100644 --- a/OsmAnd/src/com/osmand/activities/RouteProvider.java +++ b/OsmAnd/src/com/osmand/activities/RouteProvider.java @@ -87,17 +87,18 @@ public class RouteProvider { if (locations.get(0).distanceTo(start) > 200) { // add start point locations.add(0, start); + if (directions != null) { + for (RouteDirectionInfo i : directions) { + i.routePointOffset++; + } + RouteDirectionInfo info = new RouteDirectionInfo(); + info.turnType = TurnType.valueOf(TurnType.C); + info.routePointOffset = 0; + info.descriptionRoute = "" ;//getString(ctx, R.string.route_head); //$NON-NLS-1$ + directions.add(0, info); + } } - if (directions != null) { - for (RouteDirectionInfo i : directions) { - i.routePointOffset++; - } - RouteDirectionInfo info = new RouteDirectionInfo(); - info.turnType = TurnType.valueOf(TurnType.C); - info.routePointOffset = 0; - info.descriptionRoute = "" ;//getString(ctx, R.string.route_head); //$NON-NLS-1$ - directions.add(0, info); - } + // check points for duplicates (it is very bad for routing) - cloudmade could return it for (int i = 0; i < locations.size() - 1; ) { if(locations.get(i).distanceTo(locations.get(i+1)) == 0){ @@ -198,7 +199,6 @@ public class RouteProvider { minDistanceForTurn = 12; } - // add start point if needed List directions = new ArrayList(); diff --git a/OsmAnd/src/com/osmand/activities/VoiceRouter.java b/OsmAnd/src/com/osmand/activities/VoiceRouter.java index aa4ed839ba..190e34b71d 100644 --- a/OsmAnd/src/com/osmand/activities/VoiceRouter.java +++ b/OsmAnd/src/com/osmand/activities/VoiceRouter.java @@ -119,8 +119,9 @@ public class VoiceRouter { play.roundAbout(next.turnType.getTurnAngle(), next.turnType.getExitOut()); } else if(next.turnType.getValue().equals(TurnType.TU)){ play.makeUT(); - } else if(next.turnType.getValue().equals(TurnType.C)){ - play.goAhead(); + // do not say it +// } else if(next.turnType.getValue().equals(TurnType.C)){ +// play.goAhead(); } else { isplay = false; } diff --git a/OsmAnd/voice/ru/_config.p b/OsmAnd/voice/ru/_config.p index 3f4931d45a..92ce8e2718 100644 --- a/OsmAnd/voice/ru/_config.p +++ b/OsmAnd/voice/ru/_config.p @@ -43,7 +43,7 @@ bear_left == ['bear_left.ogg']. route_recalc(_Dist) == ['recalc.ogg']. go_ahead(Dist) == ['Drive.ogg', delay_250, D]:- distance(Dist) == D. -go_ahead == ['continue.ogg']. +go_ahead == ['continue.ogg', 'stright.ogg']. %% nth(1, '1st.ogg').