From 6f7177702ca16029c2d0e03502056512551c5dbc Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 5 Sep 2012 22:14:25 +0200 Subject: [PATCH 1/6] fix apostrophes --- OsmAnd/res/values-ca/strings.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 7ded5b5bb0..865c17d48e 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -1,4 +1,4 @@ - + Mostra els missatges d\'avís… Rutes amb fluorescència Mostra el regle @@ -602,15 +602,15 @@ Interval de seguiment en viu Interval de seguiment en viu especific Adreça web de seguiment en viu -Si us plau habilita l'opció \'Enregistrar camí a fitxer GPX\' +Si us plau habilita l\'opció \'Enregistrar camí a fitxer GPX\' Baixada amb èxit.\n\t\n\tPer usar-ho activar \'Menú\' -> \'Definir vista\' -> \'Font de mapa...\' -> \'Mapes de vectors fora de línia\'. Capa de fons/Cap superposada -El servidor conte fitxers de mapes que no son compatibles amb l'actual versió de l'aplicació. Per descarregar-los i usar-los si us plau actualitza a l'ultima versió. +El servidor conte fitxers de mapes que no son compatibles amb l\'actual versió de l\'aplicació. Per descarregar-los i usar-los si us plau actualitza a l\'ultima versió. Estas a punt de %1$s %2$s element(s). Continuar? -L'aplicació no pot descarregar la capa del mapa %1$s, si us plau prova a reinstal·lar-lo. +L\'aplicació no pot descarregar la capa del mapa %1$s, si us plau prova a reinstal·lar-lo. Mapa de fons… Mapa superposat -\tPots seleccionar la destinació directament en el mapa (menú contextual ,llavors \'Marcar com a destinació\'), en totes les activitats de certa o per mitja d'una pressió llarga en una entrada de la teva \'Llista de Punts Preferits\'. +\tPots seleccionar la destinació directament en el mapa (menú contextual ,llavors \'Marcar com a destinació\'), en totes les activitats de certa o per mitja d\'una pressió llarga en una entrada de la teva \'Llista de Punts Preferits\'. \n\tLa destinació es marcada com a un disc taronja en el mapa OsmAnd mostra la distancia fins a ella (triangle taronja) Temps fins que la vista es sincronitzi amb la posició actual Mapa de fons @@ -618,18 +618,18 @@ Escull mapa superposat Compartir Ubicacio Selecciona la llengua a mostrar -\tOsmAnd suporta diferents (personalitzables) perfils d'aplicació per a diferents usos. +\tOsmAnd suporta diferents (personalitzables) perfils d\'aplicació per a diferents usos. \n\tPots canviar de perfil amb el boto a la cantonada inferior esquerra de la pantalla de mapa(icona de cotxe,bici o vianant), o quan crees una ruta. peu km -Botiga d'aliments -Navegacio d'OsmAnd>20Km -Hi ha una versió preveia d'OsmAnd instal·lada. Totes les dades offline seran suportades per la nova aplicació .Peró els punts preferits hauran de ser exportats a la versió vella i després importats a la nova. +Botiga d\'aliments +Navegacio d\'OsmAnd>20Km +Hi ha una versió preveia d\'OsmAnd instal·lada. Totes les dades offline seran suportades per la nova aplicació .Peró els punts preferits hauran de ser exportats a la versió vella i després importats a la nova. Vols instal·lar OsmAnd - {0} de {1} {2} MB ? Aplicació GPS Status no instal·lada. Buscar en el Market? Filtre baixat Dibuixat continu -Pantalla d'alta resolució +Pantalla d\'alta resolució cap veu Error llegint dedes GPX From a7d525c02a0358eba463ec71f9e006e22f408676 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 5 Sep 2012 21:28:18 +0200 Subject: [PATCH 2/6] Commit with comments --- DataExtractionOSM/src/net/osmand/router/routing.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/router/routing.xml b/DataExtractionOSM/src/net/osmand/router/routing.xml index 191584d6ce..730cd9a940 100644 --- a/DataExtractionOSM/src/net/osmand/router/routing.xml +++ b/DataExtractionOSM/src/net/osmand/router/routing.xml @@ -42,6 +42,12 @@ + + @@ -113,11 +119,10 @@ - + - - + From 2d44c7933d9181a82d1151044ae8965ee75164c4 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 5 Sep 2012 21:46:35 +0200 Subject: [PATCH 3/6] Fix build and NPE exception --- OsmAnd/src/net/osmand/OsmAndFormatter.java | 14 +++++---- .../src/net/osmand/plus/SpecialPhrases.java | 31 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/OsmAnd/src/net/osmand/OsmAndFormatter.java b/OsmAnd/src/net/osmand/OsmAndFormatter.java index ae6a420afb..a6ae02aaf6 100644 --- a/OsmAnd/src/net/osmand/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/OsmAndFormatter.java @@ -184,19 +184,21 @@ public class OsmAndFormatter { return toPublicString(amenity.getType(), ctx) + " : " + getPoiStringWithoutType(amenity, en); //$NON-NLS-1$ } - public static String getPoiStringWithoutType(Amenity amenity, boolean en){ + public static String getPoiStringWithoutType(Amenity amenity, boolean en) { String type = SpecialPhrases.getSpecialPhrase(amenity.getSubType()); String n = amenity.getName(en); - - if(type == null) type = amenity.getSubType(); - if(n.indexOf(type) != -1){ + + if (type == null) { + type = amenity.getSubType(); + } + if (n.indexOf(type) != -1) { // type is contained in name e.g. // n = "Bakery the Corner" // type = "Bakery" // no need to repeat this - return n; + return n; } - if(n.length() == 0){ + if (n.length() == 0) { return type; } return type + " " + n; //$NON-NLS-1$ diff --git a/OsmAnd/src/net/osmand/plus/SpecialPhrases.java b/OsmAnd/src/net/osmand/plus/SpecialPhrases.java index 65aedd10ff..437cf53bab 100644 --- a/OsmAnd/src/net/osmand/plus/SpecialPhrases.java +++ b/OsmAnd/src/net/osmand/plus/SpecialPhrases.java @@ -8,23 +8,18 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import org.apache.commons.logging.Log; + import net.osmand.Algoritms; +import net.osmand.LogUtil; import android.content.Context; -import android.content.res.AssetManager; public class SpecialPhrases { private static Map m; - - /** - * Check if the language has been set - * @return true if language has been set - */ - public static boolean isLanguageSet(){ - return m!= null; - } + private static final Log log = LogUtil.getLog(SpecialPhrases.class); /** * Use this method to query a special phrase for a certain subtype @@ -34,9 +29,13 @@ public class SpecialPhrases { * @param key the subtype to query * @return the special phrase according to the asked key, or "null" if the key isn't found */ - public static String getSpecialPhrase(String key){ - if (!isLanguageSet()) { - throw new NullPointerException("The language has not been set"); + public static String getSpecialPhrase(String key) { + if (m == null) { + // do not throw exception because OsmAndApplication is not always initiliazed before + // this call + log.warn("The language has not been set for special phrases"); + return null; + } return m.get(key); } @@ -50,13 +49,13 @@ public class SpecialPhrases { */ public static void setLanguage(Context ctx, OsmandSettings settings) throws IOException { String lang = getPreferredLanguage(settings).getLanguage(); - m = new HashMap(); + m = new HashMap(); // The InputStream opens the resourceId and sends it to the buffer InputStream is = null; BufferedReader br = null; - try{ + try { try { - is = ctx.getAssets().open("specialphrases/specialphrases_"+lang+".txt"); + is = ctx.getAssets().open("specialphrases/specialphrases_" + lang + ".txt"); } catch (IOException ex) { // second try: default to English, if this fails, the error is thrown outside is = ctx.getAssets().open("specialphrases/specialphrases_en.txt"); @@ -64,7 +63,7 @@ public class SpecialPhrases { br = new BufferedReader(new InputStreamReader(is)); String readLine = null; - // While the BufferedReader readLine is not null + // While the BufferedReader readLine is not null while ((readLine = br.readLine()) != null) { String[] arr = readLine.split(","); if (arr != null && arr.length == 2) { From da6ea256d1d0933984d9505dff63c5cf962bd0ef Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 5 Sep 2012 22:00:49 +0200 Subject: [PATCH 4/6] Change animation settings --- .../osmand/plus/activities/MapActivity.java | 38 +++++++++++-------- .../osmand/plus/routing/RouteAnimation.java | 9 ++--- .../osmand/plus/views/MapControlsLayer.java | 11 +++--- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 5d8a344fad..90f14d1d07 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -270,18 +270,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe routingHelper.setFinalAndCurrentLocation(settings.getPointToNavigate(), getLastKnownLocation(), routingHelper.getCurrentGPXRoute()); } - LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); - try { - service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, gpsListener); - } catch (IllegalArgumentException e) { - Log.d(LogUtil.TAG, "GPS location provider not available"); //$NON-NLS-1$ - } - // try to always ask for network provide : it is faster way to find location - try { - service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, networkListener); - } catch (IllegalArgumentException e) { - Log.d(LogUtil.TAG, "Network location provider not available"); //$NON-NLS-1$ - } + startLocationRequests(); if (settings != null && settings.isLastKnownMapLocation()) { LatLon l = settings.getLastKnownMapLocation(); @@ -321,6 +310,21 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe mapView.refreshMap(true); } + public void startLocationRequests() { + LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); + try { + service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, gpsListener); + } catch (IllegalArgumentException e) { + Log.d(LogUtil.TAG, "GPS location provider not available"); //$NON-NLS-1$ + } + // try to always ask for network provide : it is faster way to find location + try { + service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, networkListener); + } catch (IllegalArgumentException e) { + Log.d(LogUtil.TAG, "Network location provider not available"); //$NON-NLS-1$ + } + } + private void notRestoreRoutingMode(){ boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get()); updateApplicationModeSettings(); @@ -1045,9 +1049,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe @Override protected void onPause() { super.onPause(); - LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); - service.removeUpdates(gpsListener); - service.removeUpdates(networkListener); + stopLocationRequests(); SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); sensorMgr.unregisterListener(this); @@ -1068,6 +1070,12 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe getMyApplication().getResourceManager().setBusyIndicator(null); OsmandPlugin.onMapActivityPause(this); } + + public void stopLocationRequests() { + LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); + service.removeUpdates(gpsListener); + service.removeUpdates(networkListener); + } public void updateApplicationModeSettings(){ int currentMapRotation = settings.ROTATE_MAP.get(); diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteAnimation.java b/OsmAnd/src/net/osmand/plus/routing/RouteAnimation.java index 15f44d3684..148c1d3914 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteAnimation.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteAnimation.java @@ -29,7 +29,6 @@ public class RouteAnimation { public void startStopRouteAnimation(final RoutingHelper routingHelper, final MapActivity ma) { - final LocationManager mgr = (LocationManager) ma.getSystemService(Context.LOCATION_SERVICE); if (!isRouteAnimating()) { Builder builder = new AlertDialog.Builder(ma); builder.setTitle("Do you want to use existing GPX file?"); @@ -48,7 +47,7 @@ public class RouteAnimation { @Override public boolean processResult(GPXUtilities.GPXFile result) { GPXRouteParams prms = new RouteProvider.GPXRouteParams(result, false, ((OsmandApplication) ma.getApplication()).getSettings()); - mgr.removeUpdates(ma.getGpsListener()); + ma.stopLocationRequests(); startAnimationThread(routingHelper, ma, prms.points, true, speedup.getProgress() + 1); return true; } @@ -60,16 +59,14 @@ public class RouteAnimation { @Override public void onClick(DialogInterface dialog, int which) { - mgr.removeUpdates(ma.getGpsListener()); + ma.stopLocationRequests(); startAnimationThread(routingHelper, ma, new ArrayList(routingHelper.getCurrentRoute()), false, 1); } }); builder.show(); } else { - mgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, ma.getGpsListener()); - // stop the animation - stop(); + ma.startLocationRequests(); } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index b27f731b54..6b373ad01a 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -35,6 +35,8 @@ public class MapControlsLayer extends OsmandMapLayer { private static final int SHOW_ZOOM_LEVEL_MSG_ID = 3; private static final int SHOW_ZOOM_LEVEL_DELAY = 2000; + //private static final float ZOOM_DELTA = 1; + private static final float ZOOM_DELTA = OsmandMapTileView.ZOOM_DELTA_1; private OsmandMapTileView view; @@ -310,11 +312,9 @@ public class MapControlsLayer extends OsmandMapLayer { @Override public void onClick(View v) { if (view.isZooming()) { - activity.changeZoom(view.getZoom() + 2 ); -// activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 ); + activity.changeZoom(view.getZoom() + 2 * ZOOM_DELTA); } else { - activity.changeZoom(view.getZoom() + 1 ); -// activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 ); + activity.changeZoom(view.getZoom() + 1 * ZOOM_DELTA); } } @@ -323,8 +323,7 @@ public class MapControlsLayer extends OsmandMapLayer { zoomOutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - activity.changeZoom(view.getZoom() - 1 ); -// activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 ); + activity.changeZoom(view.getFloatZoom() - 1 * ZOOM_DELTA); } }); } From ab17dbb15fc9954bc01f0eca6d0df5f6a8300320 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 5 Sep 2012 22:15:50 +0200 Subject: [PATCH 5/6] Finalize shadow color concept --- OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java | 2 ++ OsmAnd/src/net/osmand/plus/views/MapStackControl.java | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index 7c9fe1bcc7..b09bd8cb01 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -205,6 +205,8 @@ public class MapInfoLayer extends OsmandMapLayer { } if(topText.getShadowColor() != shadowColor) { topText.setShadowColor(shadowColor); + leftStack.setShadowColor(shadowColor); + rightStack.setShadowColor(shadowColor); } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapStackControl.java b/OsmAnd/src/net/osmand/plus/views/MapStackControl.java index 5387bd5aaf..2dc52bc948 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapStackControl.java +++ b/OsmAnd/src/net/osmand/plus/views/MapStackControl.java @@ -238,4 +238,14 @@ public class MapStackControl extends ViewGroup { } } + public void setShadowColor(int shadowColor) { + for(MapInfoControl c : stackViews) { + c.setShadowColor(shadowColor); + } + for(MapInfoControl c : collapsedViews) { + c.setShadowColor(shadowColor); + } + + } + } \ No newline at end of file From 6c91cce268755ba8369282846b085488c58fde4a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 5 Sep 2012 22:17:26 +0200 Subject: [PATCH 6/6] Fix zoom --- OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 6b373ad01a..b062b6bcb0 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -35,8 +35,8 @@ public class MapControlsLayer extends OsmandMapLayer { private static final int SHOW_ZOOM_LEVEL_MSG_ID = 3; private static final int SHOW_ZOOM_LEVEL_DELAY = 2000; - //private static final float ZOOM_DELTA = 1; - private static final float ZOOM_DELTA = OsmandMapTileView.ZOOM_DELTA_1; + private static final float ZOOM_DELTA = 1; +// private static final float ZOOM_DELTA = OsmandMapTileView.ZOOM_DELTA_1; private OsmandMapTileView view; @@ -312,9 +312,9 @@ public class MapControlsLayer extends OsmandMapLayer { @Override public void onClick(View v) { if (view.isZooming()) { - activity.changeZoom(view.getZoom() + 2 * ZOOM_DELTA); + activity.changeZoom(view.getFloatZoom() + 2 * ZOOM_DELTA); } else { - activity.changeZoom(view.getZoom() + 1 * ZOOM_DELTA); + activity.changeZoom(view.getFloatZoom() + 1 * ZOOM_DELTA); } }