Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2012-09-06 00:00:13 +02:00
commit c55147aa59
9 changed files with 84 additions and 62 deletions

View file

@ -42,6 +42,12 @@
<!-- obstacle tag="highway" value="traffic_signals" penalty="35", penalty measured in seconds -->
<routingProfile name="car" baseProfile="car" restrictionsAware="true" minDefaultSpeed="45.0" maxDefaultSpeed="130.0"
leftTurn="20" rightTurn="15" roundaboutTurn="20" followSpeedLimitations="true" onewayAware="true">
<!--
<attribute name="useDynamicRoadPrioritising" value="true" />
<attribute name="dynamicRoadPriorityDistance" value="0" />
<attribute name="heuristicCoefficient" value="1.5" />
-->
<road tag="highway" value="motorway" speed="110" priority="1.2" dynamicPriority="1">
<specialization input="avoid_motorway" speed="0"/>
</road>
@ -113,12 +119,11 @@
<avoid tag="motorcycle" value="no"/>
<avoid tag="motorcar" value="no"/>
<avoid tag="toll" value="yes" decreasedPriority="1">
<specialization input="avoid_toll"/>
<specialization input="avoid_toll" />
</avoid>
</routingProfile>
<routingProfile name="bicycle" baseProfile="bicycle" restrictionsAware="true" minDefaultSpeed="7" maxDefaultSpeed="16"
leftTurn="0" rightTurn="0" followSpeedLimitations="false" onewayAware="true">
<!-- <attribute name="relaxNodesIfStartDistSmallCoeff" value="2.5"/> -->

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="show_warnings_title">Mostra els missatges d\'avís…</string>
<string name="map_widget_fluorescent">Rutes amb fluorescència</string>
<string name="map_widget_show_ruler">Mostra el regle</string>
@ -602,15 +602,15 @@
<string name="live_monitoring_interval">Interval de seguiment en viu</string>
<string name="live_monitoring_interval_descr">Interval de seguiment en viu especific</string>
<string name="live_monitoring_url">Adreça web de seguiment en viu</string>
<string name="gpx_monitoring_disabled_warn">Si us plau habilita l'opció \'Enregistrar camí a fitxer GPX\'</string>
<string name="gpx_monitoring_disabled_warn">Si us plau habilita l\'opció \'Enregistrar camí a fitxer GPX\'</string>
<string name="binary_map_download_success">Baixada amb èxit.\n\t\n\tPer usar-ho activar \'Menú\' -&gt; \'Definir vista\' -&gt; \'Font de mapa...\' -&gt; \'Mapes de vectors fora de línia\'.</string>
<string name="pref_overlay">Capa de fons/Cap superposada</string>
<string name="map_version_changed_info">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ó.</string>
<string name="map_version_changed_info">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ó.</string>
<string name="local_index_action_do">Estas a punt de %1$s %2$s element(s). Continuar?</string>
<string name="warning_tile_layer_not_downloadable">L'aplicació no pot descarregar la capa del mapa %1$s, si us plau prova a reinstal·lar-lo.</string>
<string name="warning_tile_layer_not_downloadable">L\'aplicació no pot descarregar la capa del mapa %1$s, si us plau prova a reinstal·lar-lo.</string>
<string name="layer_overlay">Mapa de fons…</string>
<string name="map_overlay">Mapa superposat</string>
<string name="tip_select_destination_point_t">\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\'.
<string name="tip_select_destination_point_t">\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)</string>
<string name="choose_auto_follow_route_descr">Temps fins que la vista es sincronitzi amb la posició actual</string>
<string name="map_underlay">Mapa de fons</string>
@ -618,18 +618,18 @@
<string name="map_overlay_descr">Escull mapa superposat</string>
<string name="tip_location_sharing">Compartir Ubicacio</string>
<string name="preferred_locale_descr">Selecciona la llengua a mostrar</string>
<string name="tip_app_mode_t_v2">\tOsmAnd suporta diferents (personalitzables) perfils d'aplicació per a diferents usos.
<string name="tip_app_mode_t_v2">\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. </string>
<string name="foot">peu</string>
<string name="km">km</string>
<string name="poi_filter_food_shop">Botiga d'aliments</string>
<string name="use_osmand_routing_service">Navegacio d'OsmAnd&gt;20Km</string>
<string name="osmand_net_previously_installed">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.</string>
<string name="poi_filter_food_shop">Botiga d\'aliments</string>
<string name="use_osmand_routing_service">Navegacio d\'OsmAnd&gt;20Km</string>
<string name="osmand_net_previously_installed">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.</string>
<string name="install_selected_build">Vols instal·lar OsmAnd - {0} de {1} {2} MB ?</string>
<string name="gps_status_app_not_found">Aplicació GPS Status no instal·lada. Buscar en el Market?</string>
<string name="filter_existing_indexes">Filtre baixat</string>
<string name="continuous_rendering">Dibuixat continu</string>
<string name="use_high_res_maps">Pantalla d'alta resolució</string>
<string name="use_high_res_maps">Pantalla d\'alta resolució</string>
<string name="transport_search_none">cap</string>
<string name="voice">veu</string>
<string name="error_reading_gpx">Error llegint dedes GPX</string>

View file

@ -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;
}
if(n.length() == 0){
if (n.length() == 0) {
return type;
}
return type + " " + n; //$NON-NLS-1$

View file

@ -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<String,String> 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<String,String>();
m = new HashMap<String, String>();
// 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");

View file

@ -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);
@ -1069,6 +1071,12 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
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();
if(currentMapRotation == OsmandSettings.ROTATE_MAP_NONE){

View file

@ -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<Location>(routingHelper.getCurrentRoute()), false, 1);
}
});
builder.show();
} else {
mgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, ma.getGpsListener());
// stop the animation
stop();
ma.startLocationRequests();
}
}

View file

@ -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.getFloatZoom() + 2 * ZOOM_DELTA);
} else {
activity.changeZoom(view.getZoom() + 1 );
// activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
activity.changeZoom(view.getFloatZoom() + 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);
}
});
}

View file

@ -205,6 +205,8 @@ public class MapInfoLayer extends OsmandMapLayer {
}
if(topText.getShadowColor() != shadowColor) {
topText.setShadowColor(shadowColor);
leftStack.setShadowColor(shadowColor);
rightStack.setShadowColor(shadowColor);
}
}

View file

@ -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);
}
}
}