Merge branch 'master' into merge-turn-lanes

Conflicts:
	OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java
This commit is contained in:
Saikrishna Arcot 2014-11-23 11:27:15 -05:00
commit 9ef86bbe56
31 changed files with 407 additions and 187 deletions

View file

@ -533,10 +533,7 @@ public class RouteResultPreparation {
}
private void assignLanesInfo(RouteSegmentResult prevSegm, TurnType t, boolean leftSide) {
int lanes = prevSegm.getObject().getLanes();
if (prevSegm.getObject().getOneway() == 0) {
lanes = countLanes(prevSegm, lanes);
}
int lanes = countLanes(prevSegm);
if (lanes <= 0) {
return;
}
@ -645,10 +642,7 @@ public class RouteResultPreparation {
if (rsSpeakPriority != MAX_SPEAK_PRIORITY || speakPriority == MAX_SPEAK_PRIORITY) {
if ((ex < TURN_DEGREE_MIN || mpi < TURN_DEGREE_MIN) && ex >= 0) {
kl = true;
int lns = attached.getObject().getLanes();
if(attached.getObject().getOneway() == 0) {
lns = countLanes(attached, lns);
}
int lns = countLanes(attached);
if (lns <= 0) {
right += 1;
} else {
@ -657,10 +651,7 @@ public class RouteResultPreparation {
speak = speak || rsSpeakPriority <= speakPriority;
} else if ((ex > -TURN_DEGREE_MIN || mpi < TURN_DEGREE_MIN) && ex <= 0) {
kr = true;
int lns = attached.getObject().getLanes();
if(attached.getObject().getOneway() == 0) {
lns = countLanes(attached, lns);
}
int lns = countLanes(attached);
if (lns <= 0) {
left += 1;
} else {
@ -679,11 +670,8 @@ public class RouteResultPreparation {
} else if(kl && right == 0) {
right = 1;
}
int current = currentSegm.getObject().getLanes();
int current = countLanes(currentSegm);
// attachedRoutes covers all allowed outbound routes at that point except currentSegm.
if (currentSegm.getObject().getOneway() == 0) {
current = countLanes(currentSegm, current);
}
if (current <= 0) {
current = 1;
}
@ -748,17 +736,23 @@ public class RouteResultPreparation {
return t;
}
protected int countLanes(RouteSegmentResult attached, int lns) {
try {
if (attached.isForwardDirection() && attached.getObject().getValue("lanes:forward") != null) {
return Integer.parseInt(attached.getObject().getValue("lanes:forward"));
} else if (!attached.isForwardDirection() && attached.getObject().getValue("lanes:backward") != null) {
return Integer.parseInt(attached.getObject().getValue("lanes:backward"));
protected int countLanes(RouteSegmentResult attached) {
if (attached.getObject().getOneway() == 0) {
try {
if (attached.isForwardDirection() && attached.getObject().getValue("lanes:forward") != null) {
return Integer.parseInt(attached.getObject().getValue("lanes:forward"));
} else if (!attached.isForwardDirection() && attached.getObject().getValue("lanes:backward") != null) {
return Integer.parseInt(attached.getObject().getValue("lanes:backward"));
} else {
return -1;
}
} catch (NumberFormatException e) {
e.printStackTrace();
return -1;
}
} catch (NumberFormatException e) {
e.printStackTrace();
} else {
return attached.getObject().getLanes();
}
return (lns + 1) / 2;
}
protected String getTurnLanesString(RouteSegmentResult segment) {
@ -774,10 +768,7 @@ public class RouteResultPreparation {
}
private TurnType attachTurnLanesData(boolean leftSide, RouteSegmentResult prevSegm, TurnType t) {
int lanes = prevSegm.getObject().getLanes();
if (prevSegm.getObject().getOneway() == 0) {
lanes = countLanes(prevSegm, lanes);
}
int lanes = countLanes(prevSegm);
String turnLanes = getTurnLanesString(prevSegm);
if (turnLanes == null) {
@ -785,19 +776,42 @@ public class RouteResultPreparation {
}
String[] splitLaneOptions = turnLanes.split("\\|", -1);
if (splitLaneOptions.length != lanes) {
// Error in data or missing data
return t;
log.warn("Number of lanes in lanes key (" + lanes + ") does not match number of lanes from turn:lanes key (" + splitLaneOptions.length + "). Errors may occur.");
int leftLanes = 0;
int rightLanes = 0;
boolean processingLeft = true;
for (int i = 0; i < t.getLanes().length; i++) {
if (t.getLanes()[i] == 0) {
if (processingLeft) {
leftLanes++;
} else {
rightLanes++;
}
} else {
processingLeft = false;
}
}
int[] adjustedLanes = new int[lanes + leftLanes + rightLanes];
for (int i = leftLanes; i < leftLanes + lanes; i++) {
adjustedLanes[i] = 1;
}
t.setLanes(adjustedLanes);
}
if (t.getLanes().length != lanes) {
// The turn:lanes don't easily match up to the target road.
// The lanes from prevSegm don't easily match up to the target roads (it's not one-to-one).
List<Integer> sourceLanes = new ArrayList<Integer>();
int outgoingLanesIndex = 0;
int sourceLanesIndex = 0;
while (outgoingLanesIndex < t.getLanes().length && sourceLanesIndex < lanes) {
while (outgoingLanesIndex < t.getLanes().length && sourceLanesIndex < splitLaneOptions.length) {
if (splitLaneOptions[sourceLanesIndex].contains(";")) {
// Two or more allowed turns for this lane
int options = countOccurrences(splitLaneOptions[sourceLanesIndex], ';');

View file

@ -84,6 +84,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:autoLink="web"
android:gravity="center"
android:textSize="18sp" />

View file

@ -84,6 +84,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:autoLink="web"
android:gravity="center"
android:textSize="18sp" />

View file

@ -1934,4 +1934,6 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
<string name="lock_screen_request_explanation">"%1$s necessita aquest permís per la funcionalitat de posar la pantalla en mode d\'estalvi d\'energia."</string>
<string name="wake_on_voice_never">Mai</string>
<string name="advanced_settings">Avançat</string>
<string name="osmo_use_https_descr">Utilitzeu una connexió segura amb el servidor</string>
<string name="osmo_use_https">Utilitzeu https</string>
</resources>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="bidforfix_loading">Nahrávám</string>
<string name="bidforfix_supporters">%1$d sponzorů</string>
<string name="bidforfix_supporters">%1$d Příznivců</string>
<string name="bidforfix_funded">sponzorováno: %d%%</string>
</resources>
</resources>

View file

@ -5,10 +5,10 @@
<string name="poi_mall">Obchodní dům</string>
<string name="poi_beverages">Obchod s nápoji</string>
<string name="poi_butcher">Masna</string>
<string name="poi_deli"/>
<string name="poi_shop_farm"/>
<string name="poi_greengrocer"/>
<string name="poi_seafood"/>
<string name="poi_deli">Delikatesy</string>
<string name="poi_shop_farm">Farmářský obchod</string>
<string name="poi_greengrocer">Zelinářství</string>
<string name="poi_seafood">Obchod mořskými plody</string>
<string name="poi_supermarket">Supermarket</string>
<string name="poi_bookshop">Knihkupectví</string>
<string name="poi_bicycle_shop"/>
@ -23,7 +23,7 @@
<string name="poi_carpet_shop"/>
<string name="poi_chemist_shop">Drogerie</string>
<string name="poi_clothes_shop"/>
<string name="poi_children_clothes_shop"/>
<string name="poi_children_clothes_shop">Dětské oblečení</string>
<string name="poi_shoes">Obuv</string>
<string name="poi_computer_shop"/>
<string name="poi_copyshop"/>
@ -47,7 +47,7 @@
<string name="poi_fire_hydrant">Hydrant</string>
<string name="poi_fire_extinguisher">Hasicí přístroj</string>
<string name="poi_ambulance_station">Ambulance</string>
<string name="poi_ford">Ford</string>
<string name="poi_ford">Brod</string>
<string name="poi_mountain_pass">Horské sedlo</string>
<string name="poi_gate">Brána</string>
<string name="poi_toll_booth">Mýtné</string>
@ -128,7 +128,7 @@
<string name="poi_fort">Pevnost</string>
<string name="poi_fountain">Fontána</string>
<string name="poi_wreck">Vrak lodi</string>
<string name="poi_monument">Monument</string>
<string name="poi_monument">Památník</string>
<string name="poi_zoo">Zoo</string>
<string name="poi_hotel">Hotel</string>
<string name="poi_motel">Motel</string>
@ -194,4 +194,22 @@
<string name="poi_seamark_anchorage">Kotviště</string>
<string name="poi_seamark_dry_dock">Suchý dok</string>
<string name="poi_seamark_harbour">Přístav</string>
<string name="poi_military_barracks">Kasárna</string>
<string name="poi_military_danger_area">Nebezpečná oblast</string>
<string name="poi_confectionery">Cukrárna</string>
<string name="poi_shop_tea">Obchod čajem</string>
<string name="poi_dairy">Mlékárna</string>
<string name="poi_vending_machine">Prodejní automat</string>
<string name="poi_florist">Květinářství</string>
<string name="poi_furniture_shop">Nábytek</string>
<string name="poi_garden_centre">Zahradní centrum</string>
<string name="poi_glaziery_shop">Sklenářství</string>
<string name="poi_hearing_aids_shop">Sluchové pomůcky</string>
<string name="poi_herbalist">Obchod bylinkami</string>
<string name="poi_houseware_shop">Domácí potřeby</string>
<string name="poi_interior_decoration_shop">Dekorace interiéru</string>
<string name="poi_newsagent_shop">Zpravodajská agentura</string>
<string name="poi_stationery_shop">Kancelářské potřeby</string>
<string name="poi_trade_shop">Obchodní místo</string>
</resources>

View file

@ -6,14 +6,14 @@
<string name="poi_mall">Butikscenter</string>
<string name="poi_beverages">Drikkevarebutik</string>
<string name="poi_butcher">Kødmarked</string>
<string name="poi_deli">Delikatesser</string>
<string name="poi_deli">Delikatesse</string>
<string name="poi_shop_farm">Gårdbutik</string>
<string name="poi_greengrocer">Grønthandler</string>
<string name="poi_seafood">Fiskehandler</string>
<string name="poi_confectionery">Konfektureforretning</string>
<string name="poi_ice_cream">Isbar</string>
<string name="poi_supermarket">Supermarked</string>
<string name="poi_shop_tea">Tebutik</string>
<string name="poi_shop_tea">Tehandel</string>
<string name="poi_dairy">Mejeriudsalg</string>
<string name="poi_vending_machine">Automat</string>
@ -53,7 +53,7 @@
<string name="poi_hearing_aids_shop">Høreapparater</string>
<string name="poi_herbalist">Urter</string>
<string name="poi_hifi_shop">HiFi</string>
<string name="poi_houseware_shop">Isenkræmmer</string>
<string name="poi_houseware_shop">Husholdningsartikler</string>
<string name="poi_hunting_shop">Jagtudstyr</string>
<string name="poi_interior_decoration_shop">Boligindretning</string>
<string name="poi_jewelry_shop">Smykkeforretning</string>
@ -62,7 +62,7 @@
<string name="poi_mobile_phone_shop">Mobiltelefoner</string>
<string name="poi_motorcycle_shop">Motorcykler</string>
<string name="poi_musical_instrument_shop">Musikinstrumenter</string>
<string name="poi_newsagent_shop">Kiosk</string>
<string name="poi_newsagent_shop">Nyhedsbureau</string>
<string name="poi_optician_shop">Optiker</string>
<string name="poi_organic_shop">Økologiske fødevarer</string>
<string name="poi_outdoor_shop">Fritidsbeklædning</string>
@ -81,7 +81,7 @@
<string name="poi_vacuum_cleaner_shop">Støvsuger</string>
<string name="poi_variety_store">Fastpris butik</string>
<string name="poi_video_shop">Video</string>
<string name="poi_window_blind_shop">Gardinforretning</string>
<string name="poi_window_blind_shop">Persienner</string>
<string name="poi_department_store">Stormagasin</string>
<string name="poi_electronics_shop">Elektronik</string>
<string name="poi_car_shop">Autohandel</string>
@ -100,7 +100,7 @@
<string name="poi_fire_hose">Brandslange</string>
<string name="poi_fire_water_pond">Branddam</string>
<string name="poi_grit_bin">Grusbeholder</string>
<string name="poi_ambulance_station">Ambulance station</string>
<string name="poi_ambulance_station">Ambulancestation</string>
<string name="poi_ses_station">SES station</string>
<string name="poi_emergency_access_point">Nødstilfælde punkt</string>
@ -118,7 +118,7 @@
<string name="poi_traffic_calming_rumble_strip">Rumlestriber</string>
<string name="poi_traffic_calming_table">Trafikdæmpning, bord</string>
<string name="poi_traffic_calming_choker">Indsnævring</string>
<string name="poi_traffic_signals">Trafiksignaler</string>
<string name="poi_traffic_signals">Trafiksignal</string>
<string name="poi_car_repair">Autoværksted</string>
<string name="poi_service_tyres">Dækservice</string>
@ -136,15 +136,15 @@
<string name="poi_public_transport_platform">Offentlig transport stoppested</string>
<string name="poi_public_transport_platform_bus">Busstoppested</string>
<string name="poi_public_transport_platform_trolleybus">Trolley busstoppested</string>
<string name="poi_bus_stop">Busstoppested</string>
<string name="poi_bus_stop">Busstoppested (forældet)</string>
<string name="poi_public_transport_platform_tram">Sporvognsstoppested</string>
<string name="poi_tram_stop">Sporvognsstoppestedet</string>
<string name="poi_tram_stop">Sporvognsstoppestedet (forældet)</string>
<string name="poi_public_transport_station">Offentlig transport station</string>
<string name="poi_bus_station">Busstation</string>
<string name="poi_bus_station">Busstation (forældet)</string>
<string name="poi_railway_station">Banegård (forældet)</string>
<string name="poi_railway_platform">Perron (forældet)</string>
<string name="poi_railway_halt">Trinbrædt</string>
<string name="poi_subway_entrance">Metro indgang</string>
<string name="poi_railway_halt">Trinbrædt (forældet)</string>
<string name="poi_subway_entrance">Metroindgang</string>
<string name="poi_subway_station">Metrostation</string>
<string name="poi_taxi">Taxaholdeplads</string>
@ -167,7 +167,7 @@
<string name="poi_aerialway_chair_lift">Stolelift</string>
<string name="poi_aerialway_t_bar">T-bar lift</string>
<string name="poi_aerialway_j_bar">J-bar lift</string>
<string name="poi_aerialway_platter">Tallerken lift</string>
<string name="poi_aerialway_platter">Tallerkenlift</string>
<string name="poi_aerialway_mixed_lift">Blandet lift</string>
<string name="poi_aerialway_drag_lift">Træklift</string>
<string name="poi_aerialway_rope_tow">Reblift</string>
@ -189,7 +189,7 @@
<string name="poi_lock_gate">Sluseport</string>
<string name="poi_waterway_turning_point">Vendepunkt på vandet</string>
<string name="poi_weir">Stemmeværk</string>
<string name="poi_dam">Dam</string>
<string name="poi_dam">Dæmning</string>
<string name="poi_water_mill">Vandmølle</string>
<string name="poi_power_substation">Transformerstation</string>
@ -200,7 +200,7 @@
<string name="poi_post_office">Posthus</string>
<string name="poi_post_box">Postkasse</string>
<string name="poi_telephone">Telefon</string>
<string name="poi_communication_tower">Kommunikation tårn</string>
<string name="poi_communication_tower">Kommunikationstårn</string>
<string name="poi_telephone_exchange">Telefoncentral</string>
<string name="poi_recycling">Genbrugsplads</string>
@ -214,7 +214,7 @@
<string name="poi_mineshaft">Mineskakt</string>
<string name="poi_adit">Stoll</string>
<string name="poi_petroleum_well">Oliebrønd</string>
<string name="poi_survey_point">Undersøgelses punkt</string>
<string name="poi_survey_point">Trianguleringspunkt</string>
<string name="poi_windmill">Vindmølle</string>
<string name="poi_quarry">Stenbrud</string>
<string name="poi_vineyard">Vingård</string>
@ -235,7 +235,7 @@
<string name="poi_embassy">Ambassade</string>
<string name="poi_government">Regering</string>
<string name="poi_bailiff">Foged</string>
<string name="poi_prosecutor">Anklagemyndighed</string>
<string name="poi_prosecutor">Anklager</string>
<string name="poi_pension_fund">Pensionskasse</string>
<string name="poi_migration">Migration</string>
<string name="poi_tax_inspection">Skattekontrol</string>
@ -309,7 +309,7 @@
<string name="poi_croquet">Kroket</string>
<string name="poi_cycling">Cykling</string>
<string name="poi_diving">Dykning</string>
<string name="poi_scuba_diving">Dykning</string>
<string name="poi_scuba_diving">Scuba dykning</string>
<string name="poi_dog_racing">Hundevæddeløb</string>
<string name="poi_equestrian">Hestesport</string>
<string name="poi_golf">Golf</string>
@ -329,10 +329,10 @@
<string name="poi_racquet">Ketsjer</string>
<string name="poi_roller_skating">Rulleskøjteløb</string>
<string name="poi_rowing">Roning</string>
<string name="poi_rugby_union">Rugby</string>
<string name="poi_rugby_league">Rugby</string>
<string name="poi_rugby_union">Rugby union</string>
<string name="poi_rugby_league">Rugby league</string>
<string name="poi_shooting">Skydning</string>
<string name="poi_skating">Skøjteløb</string>
<string name="poi_skating">Skating</string>
<string name="poi_skateboard">Skateboard</string>
<string name="poi_skiing">Skiløb</string>
<string name="poi_soccer">Fodbold</string>
@ -346,7 +346,7 @@
<string name="poi_attraction">Turistattraktion</string>
<string name="poi_memorial">Mindesmærke</string>
<string name="poi_artwork">Kunstværk</string>
<string name="poi_archaeological_site">Arkæologiske område</string>
<string name="poi_archaeological_site">Arkæologisk område</string>
<string name="poi_battlefield">Slagmark</string>
<string name="poi_boundary_stone">Grænsesten</string>
<string name="poi_castle">Slot</string>
@ -387,7 +387,7 @@
<string name="poi_travel_agent">Rejsebureau</string>
<string name="poi_viewpoint">Udsigtspunkt</string>
<string name="poi_camp_site">Campingplads</string>
<string name="poi_caravan_site">campingvognsplads</string>
<string name="poi_caravan_site">Campingvognsplads</string>
<string name="poi_picnic_site">Skovtur/rasteplads</string>
<string name="poi_spring">Kilde</string>
<string name="poi_cemetery">Kirkegård</string>
@ -408,7 +408,7 @@
<string name="poi_club_cinema">Filmklub</string>
<string name="poi_club_fan">Fanklub</string>
<string name="poi_club_fishing">Lystfiskerklub</string>
<string name="poi_club_veterans">Veteranklub</string>
<string name="poi_club_veterans">Veteranforening</string>
<string name="poi_club_linux">Linux klub</string>
<string name="poi_club_theatre">Teaterklub</string>
<string name="poi_club_history">Historieklub</string>
@ -417,7 +417,7 @@
<string name="poi_club_nature">Naturklub</string>
<string name="poi_club_photography">Fotoklub</string>
<string name="poi_club_hunting">Jagtklub</string>
<string name="poi_club_shooting">Skytteforeningen</string>
<string name="poi_club_shooting">Skytteforening</string>
<string name="poi_club_tourism">Turistklub</string>
<string name="poi_club_charity">Velgørenhedsklub</string>
@ -493,10 +493,10 @@
<string name="poi_shoemaker">Skomager</string>
<string name="poi_stand_builder">Udstillingsbygger</string>
<string name="poi_stonemason">Stenhugger</string>
<string name="poi_sun_protection_craft">Solbeskyttelse håndværk</string>
<string name="poi_sun_protection_craft">Solafskærmning håndværk</string>
<string name="poi_sweep">Skorstensfejer</string>
<string name="poi_tailor">Skrædder</string>
<string name="poi_tiler">Tagdækker</string>
<string name="poi_tiler">Fliselægger</string>
<string name="poi_tinsmith">Blikkenslager</string>
<string name="poi_upholsterer">Møbelpolstrer</string>
<string name="poi_watchmaker">Urmager</string>
@ -598,4 +598,27 @@
<string name="poi_military_range">Militærsøvelsesområde</string>
<string name="poi_military_naval_base">Militærflådebase</string>
<string name="poi_military_nuclear_explosion_site">Nuklear eksplosion område</string>
</resources>
<string name="poi_city">Storby</string>
<string name="poi_town">By</string>
<string name="poi_village">Landsby</string>
<string name="poi_hamlet">Lille landsby</string>
<string name="poi_isolated_dwelling">Bebyggelse</string>
<string name="poi_suburb">Forstad</string>
<string name="poi_neighbourhood">Kvarter</string>
<string name="poi_locality">Lokalitet</string>
<string name="poi_healthcare_alternative">Alternativ medicin</string>
<string name="poi_audiologist">Audiolog</string>
<string name="poi_blood_bank">Blodbank</string>
<string name="poi_healthcare_centre">Medicinskcenter</string>
<string name="poi_midwife">Jordemoder</string>
<string name="poi_occupational_therapist">Ergoterapeut</string>
<string name="poi_optometrist">Optiker</string>
<string name="poi_physiotherapist">Fysioterapeut</string>
<string name="poi_podiatrist">Ortopæd</string>
<string name="poi_psychotherapist">Psykoterapeut</string>
<string name="poi_healthcare_rehabilitation">Rehabilitering</string>
<string name="poi_speech_therapist">Talepædagog</string>
<string name="poi_healthcare_yes">Medicinsk facilitet</string>
</resources>

View file

@ -2013,4 +2013,5 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="rendering_attr_busRoutes_name">Buslinien</string>
<string name="rendering_category_hide">Ausblenden</string>
<string name="lock_screen_request_explanation">%1$s benötigt diese Berechtigung, um den Bildschirm auszuschalten (Energiesparfunktion).</string>
<string name="advanced_settings">Erweitert</string>
</resources>

View file

@ -1861,4 +1861,6 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
<string name="lock_screen_request_explanation">%1$s a besoin de cette permission pour éteindre l\'écran en mode économie d\'énergie.</string>
<string name="wake_on_voice_never">Jamais</string>
<string name="advanced_settings">Avancé</string>
<string name="osmo_use_https_descr">Utiliser une connexion sécurisée avec le serveur</string>
<string name="osmo_use_https">Utiliser https</string>
</resources>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>

View file

@ -1953,7 +1953,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="save_track_to_gpx_globally">Track maken in GPX-bestand</string>
<string name="save_track_to_gpx_globally_descr">Het registreren van de afgelegde weg in een GPX-bestand kan worden aan- en uitgeschakeld met een knop op het kaartscherm</string>
<string name="save_track_interval_globally">Interval tussen geregistreerde punten</string>
<string name="rendering_attr_publicTransportMode_name">Bus-, trolleybus- en minibuslijnen</string>
<string name="rendering_attr_publicTransportMode_name">Bus-, trolleybus- en pendelbuslijnen</string>
<string name="confirm_every_run">Altijd vragen</string>
<string name="save_global_track_interval_descr">Selecteer de loggings-interval voor de standaard track opname (te starten via de GPX opname widget in het scherm)</string>
<string name="save_global_track_interval">Standaard loggings-interval</string>
@ -1994,7 +1994,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="tip_recent_changes_1_9_t">"Aanpassingen in 1.9: * Verbeterde kaart stijlen met weg-weergave, vervoerslaag en wandelsymbolen * Zoek bezienswaardigheden langs de route * Markeer per route, een weg als onbegaanbaar * Eenvoudiger downloaden en updaten van kaarten * Krijg visuele- en geluidsmelding bij het naderen van een Routepunt * Print reisroute en routebeschrijving * Ondersteuning van voorsorteervakken * Ondersteuning van Android Wear * Veel gebruikersinterface-verbeteringen * Aparte zoomfunctie voor de tekstgrootte op de kaart * Speciale audio meldingen in het geval dat u afwijkt van de route * OsMo inlog functionaliteit * Oplossing van OsMo versie incompatibiliteit "</string>
<string name="rendering_category_routes">Routes</string>
<string name="rendering_category_details">Details</string>
<string name="rendering_attr_trainLightrailRoutes_name">Trein en lightrail lijnen</string>
<string name="rendering_attr_trainLightrailRoutes_name">Trein verbindingen</string>
<string name="rendering_attr_tramRoutes_name">Tramlijnen</string>
<string name="rendering_attr_shareTaxiRoutes_name">Deeltaxi routes</string>
<string name="rendering_attr_trolleybusRoutes_name">Trolleybus lijnen</string>
@ -2006,5 +2006,6 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="impassable_road">Vermijd wegen…</string>
<string name="rendering_category_hide">Verberg</string>
<string name="wake_on_voice_never">Nooit</string>
<string name="lock_screen_request_explanation">%1$s heeft deze permissie nodig om het scherm uit te kunnen schakelen (stroombesparing).</string>
</resources>
<string name="lock_screen_request_explanation">%1$s heeft toestemming nodig om het scherm uit te kunnen schakelen (als onderdeel van de stroombesparende functie).</string>
<string name="advanced_settings">Geavanceerd</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="poi_bakery">Булочная</string>
<string name="poi_alcohol">Винно-водочный магазин</string>
@ -253,19 +253,19 @@
<string name="poi_baby_hatch">Бэби-бокс</string>
<string name="poi_veterinary">Ветеринарная лечебница</string>
<string name="poi_sanatorium">Санаторий</string>
<string name="healthcare_alternative">Альтернативная медицина</string>
<string name="audiologist">Отоларинголог</string>
<string name="blood_bank">Банк крови</string>
<string name="healthcare_centre">Медицинский центр</string>
<string name="midwife">Акушерка</string>
<string name="occupational_therapist">Профессиональный врач</string>
<string name="optometrist">Оптометрист</string>
<string name="physiotherapist">Физиотерапевт</string>
<string name="podiatrist">Ортопед</string>
<string name="psychotherapist">Психотерапевт</string>
<string name="healthcare_rehabilitation">Реабилитация</string>
<string name="speech_therapist">Логопед</string>
<string name="healthcare_yes">Медицинское учреждение</string>
<string name="poi_healthcare_alternative">Альтернативная медицина</string>
<string name="poi_audiologist">Отоларинголог</string>
<string name="poi_blood_bank">Банк крови</string>
<string name="poi_healthcare_centre">Медицинский центр</string>
<string name="poi_midwife">Акушерка</string>
<string name="poi_occupational_therapist">Профессиональный врач</string>
<string name="poi_optometrist">Оптометрист</string>
<string name="poi_physiotherapist">Физиотерапевт</string>
<string name="poi_podiatrist">Ортопед</string>
<string name="poi_psychotherapist">Психотерапевт</string>
<string name="poi_healthcare_rehabilitation">Реабилитация</string>
<string name="poi_speech_therapist">Логопед</string>
<string name="poi_healthcare_yes">Медицинское учреждение</string>
<string name="poi_company">Фирма</string>
<string name="poi_insurance">Страховая компания</string>
@ -341,7 +341,7 @@
<string name="poi_swimming">Плавание</string>
<string name="poi_table_tennis">Пинг-понг</string>
<string name="poi_tennis">Теннис</string>
<string name="poi_toboggan"></string>
<string name="poi_toboggan">Санный спорт</string>
<string name="poi_volleyball">Воллейбол</string>
<string name="poi_museum">Музей</string>
@ -389,7 +389,7 @@
<string name="poi_travel_agent">Турагенство</string>
<string name="poi_viewpoint">Место с хорошим видом</string>
<string name="poi_camp_site">Место для лагеря</string>
<string name="poi_caravan_site"></string>
<string name="poi_caravan_site"/>
<string name="poi_picnic_site">Место для пикника</string>
<string name="poi_spring">Родник</string>
<string name="poi_cemetery">Кладбище</string>
@ -551,47 +551,47 @@
<string name="poi_island">Остров</string>
<string name="poi_islet">Остров (небольшой)</string>
<string name="poi_seamark_anchorage"></string>
<string name="poi_seamark_anchor_berth"></string>
<string name="poi_seamark_beacon"></string>
<string name="poi_seamark_beacon_cardinal"></string>
<string name="poi_seamark_beacon_lateral"></string>
<string name="poi_seamark_beacon_safe_water"></string>
<string name="poi_seamark_beacon_special_purpose"></string>
<string name="poi_seamark_berth"></string>
<string name="poi_seamark_building"></string>
<string name="poi_seamark_bridge"></string>
<string name="poi_seamark_buoy_cardinal"></string>
<string name="poi_seamark_buoy_installation"></string>
<string name="poi_seamark_buoy_isolated_danger"></string>
<string name="poi_seamark_buoy_lateral"></string>
<string name="poi_seamark_buoy_safe_water"></string>
<string name="poi_seamark_buoy_special_purpose"></string>
<string name="poi_seamark_daymark"></string>
<string name="poi_seamark_distance_mark"></string>
<string name="poi_seamark_dry_dock"></string>
<string name="poi_seamark_dyke"></string>
<string name="poi_seamark_floating_dock"></string>
<string name="poi_seamark_fog_signal"></string>
<string name="poi_seamark_harbour_basin"></string>
<string name="poi_seamark_harbour"></string>
<string name="poi_seamark_landmark"></string>
<string name="poi_seamark_light"></string>
<string name="poi_seamark_light_major"></string>
<string name="poi_seamark_light_minor"></string>
<string name="poi_seamark_light_float"></string>
<string name="poi_seamark_light_vessel"></string>
<string name="poi_seamark_mooring"></string>
<string name="poi_seamark_notice"></string>
<string name="poi_seamark_pile"></string>
<string name="poi_seamark_radar_transponder"></string>
<string name="poi_seamark_radio_station"></string>
<string name="poi_seamark_signal_station_traffic"></string>
<string name="poi_seamark_signal_station_warning"></string>
<string name="poi_seamark_small_craft_facility"></string>
<string name="poi_seamark_topmark"></string>
<string name="poi_seamark_rock"></string>
<string name="poi_seamark_wreck"></string>
<string name="poi_seamark_anchorage">Якорная стоянка</string>
<string name="poi_seamark_anchor_berth"/>
<string name="poi_seamark_beacon">Бакен</string>
<string name="poi_seamark_beacon_cardinal"/>
<string name="poi_seamark_beacon_lateral"/>
<string name="poi_seamark_beacon_safe_water"/>
<string name="poi_seamark_beacon_special_purpose"/>
<string name="poi_seamark_berth"/>
<string name="poi_seamark_building"/>
<string name="poi_seamark_bridge"/>
<string name="poi_seamark_buoy_cardinal"/>
<string name="poi_seamark_buoy_installation"/>
<string name="poi_seamark_buoy_isolated_danger"/>
<string name="poi_seamark_buoy_lateral"/>
<string name="poi_seamark_buoy_safe_water"/>
<string name="poi_seamark_buoy_special_purpose">Специальный буй</string>
<string name="poi_seamark_daymark"/>
<string name="poi_seamark_distance_mark"/>
<string name="poi_seamark_dry_dock"/>
<string name="poi_seamark_dyke"/>
<string name="poi_seamark_floating_dock"/>
<string name="poi_seamark_fog_signal">Сигнал при тумане</string>
<string name="poi_seamark_harbour_basin"/>
<string name="poi_seamark_harbour">Гавань</string>
<string name="poi_seamark_landmark"/>
<string name="poi_seamark_light"/>
<string name="poi_seamark_light_major"/>
<string name="poi_seamark_light_minor"/>
<string name="poi_seamark_light_float"/>
<string name="poi_seamark_light_vessel"/>
<string name="poi_seamark_mooring">Причал</string>
<string name="poi_seamark_notice"/>
<string name="poi_seamark_pile"/>
<string name="poi_seamark_radar_transponder"/>
<string name="poi_seamark_radio_station"/>
<string name="poi_seamark_signal_station_traffic"/>
<string name="poi_seamark_signal_station_warning"/>
<string name="poi_seamark_small_craft_facility"/>
<string name="poi_seamark_topmark"/>
<string name="poi_seamark_rock"/>
<string name="poi_seamark_wreck"/>
<string name="poi_military_airfield">Военный аэродром</string>
<string name="poi_military_bunker">Военный бункер</string>
@ -600,4 +600,11 @@
<string name="poi_military_range">Военное стрельбище</string>
<string name="poi_military_naval_base">Военно-морская база</string>
<string name="poi_military_nuclear_explosion_site">Место ядерного взрыва</string>
</resources>
<string name="poi_city">Город</string>
<string name="poi_town">Город</string>
<string name="poi_village">Деревня</string>
<string name="poi_hamlet">Деревня</string>
<string name="poi_isolated_dwelling">Хутор</string>
<string name="poi_locality">Урочище</string>
</resources>

View file

@ -1,5 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="srtm_plugin_description">Плагин позволяет загружать контурные линии и затемнение высот для использования оффлайн (\"Настройки\" → \"Управление файлами карт\" → \"Загрузить\").</string>
<resources>
<string name="osmo_use_https_descr">Использовать безопасное соединение с сервером</string>
<string name="osmo_use_https">Использовать https</string>
<string name="srtm_plugin_description">Плагин позволяет загружать контурные линии и затемнение высот для использования оффлайн (\"Настройки\" → \"Управление файлами карт\" → \"Загрузить\").</string>
<string name="srtm_paid_version_msg">Рассмотрите, пожалуйста, покупку плагина \"Линии высот\" в Google Play, чтобы поддержать последующую разработку.</string>
<string name="srtm_paid_version_title">Линии высот</string>
<string name="av_def_action_video">Запись видео</string>

View file

@ -834,7 +834,7 @@ Si cussigiat de annànghere unu o prus puntos intermedios pro megiorare sas pres
<string name="osmand_accessibility_description">Ammustra sas impostaduras pro funtzionalidades ispetziales pro s\'atzessibilidade.</string>
<string name="extra_settings">Impostaduras avantzadas</string>
<string name="plugins_screen">Plugins</string>
<string name="select_plugin_to_activate">Issèbera unu plugin pro l\'ativare o lu deativare. (Diat pòdere serbire su reaviu de OsmAnd.)</string>
<string name="select_plugin_to_activate">Issèbera unu plugin pro l\'ativare o lu disativare. (Diat pòdere serbire su reaviu de OsmAnd.)</string>
<string name="prefs_plugins_descr">Sos plugins abìlitana funtzionalidades azuntivas e impostaduras avantzadas</string>
<string name="prefs_plugins">Plugins</string>
<string name="debugging_and_development">Isvilupu de OsmAnd</string>
@ -1737,7 +1737,7 @@ Si cussigiat de annànghere unu o prus puntos intermedios pro megiorare sas pres
<string name="traffic_warning_calming">Moderatzione de su tràficu</string>
<string name="traffic_warning_speed_camera">Autovelox</string>
<string name="traffic_warning">Avisu de tràficu</string>
<string name="local_index_description">Ischerta unu elementu esistente pro bìere prus detallios, carca e mantène carcau pro lu deativare o burrare. Datos como in su dispositivu (%1$s lìberos):</string>
<string name="local_index_description">Ischerta unu elementu esistente pro bìere prus detallios, carca e mantène carcau pro lu disativare o burrare. Datos como in su dispositivu (%1$s lìberos):</string>
<string name="text_size_descr">Issèbera sa mannària de su testu in sa mapa.</string>
<string name="text_size">Mannària de su testu</string>
<string name="fav_point_dublicate_message">Amus cambiau su nùmene de su prefèrridu tuo a %1$s pro evitare nùmenes dòpios.</string>

View file

@ -241,6 +241,14 @@
<string name="poi_tax_inspection">Tax inspection</string>
<string name="poi_administrative_office">Administrative office</string>
<string name="poi_customs">Customs</string>
<string name="poi_city">City</string>
<string name="poi_town">Town</string>
<string name="poi_village">Village</string>
<string name="poi_hamlet">Hamlet</string>
<string name="poi_isolated_dwelling">Isolated dwelling</string>
<string name="poi_suburb">Suburb</string>
<string name="poi_neighbourhood">Neighbourhood</string>
<string name="poi_locality">Locality</string>
<string name="poi_pharmacy">Pharmacy</string>
<string name="poi_hospital">Hospital</string>
@ -252,19 +260,19 @@
<string name="poi_baby_hatch">Baby hatch</string>
<string name="poi_veterinary">Veterinary</string>
<string name="poi_sanatorium">Sanatorium</string>
<string name="healthcare_alternative"></string>
<string name="audiologist">Audiologist</string>
<string name="blood_bank">Blood bank</string>
<string name="healthcare_centre"></string>
<string name="midwife">Midwife</string>
<string name="occupational_therapist">Occupational therapist</string>
<string name="optometrist">Optometrist</string>
<string name="physiotherapist">Physiotherapist</string>
<string name="podiatrist">Podiatrist</string>
<string name="psychotherapist">Psychotherapist</string>
<string name="healthcare_rehabilitation">Rehabilitation</string>
<string name="speech_therapist">Speech therapist</string>
<string name="healthcare_yes"></string>
<string name="poi_healthcare_alternative">Alternative medicine</string>
<string name="poi_audiologist">Audiologist</string>
<string name="poi_blood_bank">Blood bank</string>
<string name="poi_healthcare_centre">Medical center</string>
<string name="poi_midwife">Midwife</string>
<string name="poi_occupational_therapist">Occupational therapist</string>
<string name="poi_optometrist">Optometrist</string>
<string name="poi_physiotherapist">Physiotherapist</string>
<string name="poi_podiatrist">Podiatrist</string>
<string name="poi_psychotherapist">Psychotherapist</string>
<string name="poi_healthcare_rehabilitation">Rehabilitation</string>
<string name="poi_speech_therapist">Speech therapist</string>
<string name="poi_healthcare_yes">Medical facility</string>
<string name="poi_company">Company</string>
<string name="poi_insurance">Insurance</string>

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="osmo_use_https_descr">Use secure connection with server</string>
<string name="osmo_use_https">Use https</string>
<string name="advanced_settings">Advanced</string>
<string name="rendering_attr_publicTransportMode_name">Bus, trolleybus, shuttle routes</string>
<string name="rendering_attr_tramTrainRoutes_name">Tram and train routes</string>

View file

@ -158,7 +158,7 @@ public class GLActivity extends Activity {
// Get device display density factor
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
_displayDensityFactor = displayMetrics.densityDpi / 160.0f;
_displayDensityFactor = displayMetrics.density;
_referenceTileSize = (int)(256 * _displayDensityFactor);
_rasterTileSize = Integer.highestOneBit(_referenceTileSize - 1) * 2;
Log.i(TAG, "displayDensityFactor = " + _displayDensityFactor);

View file

@ -57,6 +57,8 @@ public class OsmandSettings {
void addListener(StateChangedListener<T> listener);
void removeListener(StateChangedListener<T> listener);
boolean isSet();
}
private abstract class PreferenceWithListener<T> implements OsmandPreference<T> {
@ -168,6 +170,11 @@ public class OsmandSettings {
set(ApplicationMode.DEFAULT);
};
@Override
public boolean isSet() {
return true;
};
@Override
public boolean set(ApplicationMode val) {
ApplicationMode oldMode = currentMode;
@ -875,6 +882,9 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> OSMO_AUTO_CONNECT = new BooleanPreference("osmo_automatically_connect", false).makeGlobal();
public final CommonPreference<Boolean> OSMO_USE_HTTPS = new BooleanPreference("osmo_use_https",
Build.VERSION.SDK_INT < 14/*Build.VERSION_CODES.ICE_CREAM_SANDWICH*/? false : true).makeGlobal();
public final OsmandPreference<Long> OSMO_LAST_PING = new LongPreference("osmo_last_ping", 0).makeGlobal().cache();
public final OsmandPreference<Boolean> OSMO_AUTO_SEND_LOCATIONS = new BooleanPreference("osmo_automatically_send_locations", false).makeGlobal();

View file

@ -477,6 +477,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
listAdapter.addLocalIndexInfo(info);
}
listAdapter.sortData();
getExpandableListView().setAdapter(listAdapter);
}
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
//hide action bar from downloadindexfragment

View file

@ -33,7 +33,6 @@ public class OsMoControlDevice implements OsMoReactor {
this.plugin = plugin;
this.service = service;
this.tracker = tracker;
service.registerReactor(this);
}
public JSONObject getBatteryLevel() throws JSONException {

View file

@ -26,6 +26,7 @@ import android.text.TextUtils;
public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
private static final String GROUP_NAME = "name";
private static final String ACTIVE = "active";
private static final String GROUP_ID = "group_id";
private static final String EXPIRE_TIME = "expireTime";
private static final String DESCRIPTION = "description";
@ -250,14 +251,14 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
JSONArray arr = new JSONArray(data);
int arrLength = arr.length();
if (arrLength > 0) {
Map<String, OsMoGroup> resivedGroups = new HashMap<String, OsMoGroupsStorage.OsMoGroup>();
Map<String, OsMoGroup> receivedGroups = new HashMap<String, OsMoGroupsStorage.OsMoGroup>();
for (int i = 0; i < arrLength; i++) {
JSONObject o = arr.getJSONObject(i);
OsMoGroup parsedGroup = parseGroup(o);
resivedGroups.put(parsedGroup.getGroupId(), parsedGroup);
receivedGroups.put(parsedGroup.getGroupId(), parsedGroup);
}
storage.mergeGroups(resivedGroups);
storage.mergeGroups(receivedGroups);
storage.save();
}
processed = true;
@ -287,6 +288,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
if (!mid.equals(trackerId)) {
if (toDelete.contains(trackerId)) {
toDelete.remove(trackerId);
OsMoDevice dv = mainGroup.users.get(trackerId);
dv.serverColor = device.userColor;
dv.serverName = device.userName;
} else {
mainGroup.users.put(trackerId, device);
}
@ -357,7 +361,8 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
private OsMoGroup parseGroup(JSONObject obj) throws JSONException {
OsMoGroup groupe = new OsMoGroup();
groupe.enabled = true;
groupe.enabled = !(obj.has(ACTIVE) && ("0".equals(obj.getString(ACTIVE)) ||
"false".equals(obj.getString(ACTIVE))));
groupe.name = obj.optString(GROUP_NAME);
groupe.groupId = obj.getString(GROUP_ID);
groupe.description = obj.optString(DESCRIPTION);
@ -478,7 +483,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
}
points.add(pt);
}
plugin.getSaveGpxTask(gr.groupId + "_points", modify).execute(points.toArray(new WptPt[points.size()]));
if(points.size() > 0) {
plugin.getSaveGpxTask(gr.name + " points", modify, false).execute(points.toArray(new WptPt[points.size()]));
}
}
if(deleteUsers) {
for(OsMoDevice s : toDelete.values()) {

View file

@ -241,8 +241,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
mtd.setVisibility(visible? View.VISIBLE:View.GONE);
if(visible) {
mtd.setText(si.motd);
mtd.setLinksClickable(true);
mtd.setMovementMethod(LinkMovementMethod.getInstance());
}
CompoundButton login = (CompoundButton) header.findViewById(R.id.osmo_login_logoff);
login.setChecked(osMoPlugin.getService().isLoggedIn());
login.setOnCheckedChangeListener(new LoginOnCheckedChangeListener());

View file

@ -1,10 +1,8 @@
package net.osmand.plus.osmo;
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

View file

@ -62,17 +62,18 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
private OsMoPositionLayer olayer;
protected MapActivity mapActivity;
protected OsMoGroupsActivity groupsActivity;
protected OsMoControlDevice deviceControl;
private final static Log log = PlatformUtil.getLog(OsMoPlugin.class);
public OsMoPlugin(final OsmandApplication app) {
this.app = app;
service = new OsMoService(app, this);
tracker = new OsMoTracker(service, app.getSettings().OSMO_SAVE_TRACK_INTERVAL,
app.getSettings().OSMO_AUTO_SEND_LOCATIONS);
new OsMoControlDevice(app, this, service, tracker);
deviceControl = new OsMoControlDevice(app, this, service, tracker);
groups = new OsMoGroups(this, service, tracker, app);
this.app = app;
ApplicationMode.regWidget("osmo_control", (ApplicationMode[])null);
}
@ -85,6 +86,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
return true;
}
public OsMoGroupsActivity getGroupsActivity() {
return groupsActivity;
}
@ -229,8 +231,17 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
if (si != null) {
String uname = si.username;
if (uname != null && uname.length() > 0) {
if (uname.length() > 7 && uname.indexOf(' ') != -1) {
uname = uname.substring(0, uname.indexOf(' '));
if (uname.length() > 7) {
for(int k = 4; k < uname.length(); k++) {
if(!Character.isLetterOrDigit(uname.charAt(k)) &&
uname.charAt(k) != '.' && uname.charAt(k) != '-') {
uname = uname.substring(0, k);
break;
}
}
if(uname.length() > 12) {
uname = uname.substring(0, 12);
}
}
if (uname.length() > 4) {
txt = "";
@ -350,11 +361,11 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
return service;
}
public AsyncTask<WptPt, String, String> getSaveGpxTask(final String name, final long timestamp) {
public AsyncTask<WptPt, String, String> getSaveGpxTask(final String name, final long timestamp, final boolean generateToast) {
return new AsyncTask<WptPt, String, String>() {
protected void onProgressUpdate(String... values) {
if (values != null) {
if (values != null && generateToast) {
String t = "";
for (String s : values) {
t += s + "\n";
@ -381,7 +392,9 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
if (errors == null) {
errors = "";
}
publishProgress(app.getString(R.string.osmo_gpx_points_downloaded, name));
if(generateToast) {
publishProgress(app.getString(R.string.osmo_gpx_points_downloaded, name));
}
}
SelectedGpxFile byPath = app.getSelectedGpxHelper().getSelectedFileByPath(ps.getAbsolutePath());
if (byPath == null || changed) {
@ -396,7 +409,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
@Override
protected void onPostExecute(String result) {
if (result.length() > 0) {
if (result.length() > 0 && generateToast) {
app.showToastMessage(app.getString(R.string.osmo_io_error) + result);
}
}
@ -525,4 +538,8 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
}
}
public boolean useHttps() {
return app.getSettings().OSMO_USE_HTTPS.get();
}
}

View file

@ -8,7 +8,6 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import net.osmand.Location;
import net.osmand.access.AccessibleToast;
import net.osmand.core.jni.ColorARGB;
import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.OsmAndFormatter;
@ -294,6 +293,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
private static String followTrackerId;
private static LatLon followMapLocation;
private static String followDestinationId;
private static LatLon followTargetLocation;
public static void setFollowTrackerId(OsMoDevice d) {
if(d != null) {
@ -322,17 +322,29 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
Location l = device.getLastLocation();
if(sameDestId && l != null) {
TargetPointsHelper targets = map.getMyApplication().getTargetPointsHelper();
RoutingHelper rh = map.getMyApplication().getRoutingHelper();
double dist = 1;
if(rh.isRouteBeingCalculated()) {
dist = 100;
} else if(rh.isRouteCalculated()) {
dist = 30;
}
LatLon lt = new LatLon(l.getLatitude(), l.getLongitude());
final TargetPoint pn = targets.getPointToNavigate();
if(pn == null || MapUtils.getDistance(pn.point, lt) > dist) {
targets.navigateToPoint(lt, true, -1);
LatLon lt = new LatLon(l.getLatitude(), l.getLongitude());
boolean cancelDestinationId = false;
if(followTargetLocation != null ) {
if(pn == null || pn.point == null || !pn.point.equals(lt) ) {
cancelDestinationId = true;
}
}
if(cancelDestinationId) {
followTargetLocation = null;
followDestinationId = null;
} else {
RoutingHelper rh = map.getMyApplication().getRoutingHelper();
double dist = 1;
if (rh.isRouteBeingCalculated()) {
dist = 100;
} else if (rh.isRouteCalculated()) {
dist = 30;
}
if (pn == null || MapUtils.getDistance(pn.point, lt) > dist) {
followTargetLocation = lt;
targets.navigateToPoint(lt, true, -1);
}
}
}

View file

@ -4,11 +4,20 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.RSAPublicKeySpec;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.crypto.Cipher;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -45,6 +54,12 @@ import android.support.v4.app.NotificationCompat;
import android.text.TextUtils;
public class OsMoService implements OsMoReactor {
private static final String HTTP_API_PREPARE = "http://api.osmo.mobi/prepare";
private static final String HTTPS_API_PREPARE = "https://api.osmo.mobi/prepare";
private static final String HTTP_AUTH = "http://api.osmo.mobi/auth";
private static final String HTTPS_AUTH = "https://api.osmo.mobi/auth";
private static final boolean USE_RSA_ENCRYPTION = true;
public static final String REGENERATE_CMD = "TRACKER_REGENERATE_ID";
public static final String SIGN_IN_URL = "http://osmo.mobi/signin?key=";
private OsMoThread thread;
@ -61,6 +76,7 @@ public class OsMoService implements OsMoReactor {
private boolean enabled = false;
private BroadcastReceiver broadcastReceiver;
private Notification notification;
public final static String OSMO_REGISTER_AGAIN = "OSMO_REGISTER_AGAIN"; //$NON-NLS-1$
private final static int SIMPLE_NOTFICATION_ID = 5;
@ -170,7 +186,7 @@ public class OsMoService implements OsMoReactor {
public String registerOsmoDeviceKey() throws IOException {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://api.osmo.mobi/auth");
HttpPost httppost = new HttpPost(plugin.useHttps()? HTTPS_AUTH : HTTP_AUTH);
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
@ -209,6 +225,7 @@ public class OsMoService implements OsMoReactor {
public String token;
public String uid;
public String username;
// after auth
public String protocol = "";
public String groupTrackerId;
@ -217,6 +234,8 @@ public class OsMoService implements OsMoReactor {
public long motdTimestamp;
public String motd = "";
public Cipher clientEncCypher;
public Cipher clientDecCypher;
}
public SessionInfo getCurrentSessionInfo() {
@ -258,12 +277,33 @@ public class OsMoService implements OsMoReactor {
deviceKey = registerOsmoDeviceKey();
}
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://api.osmo.mobi/prepare");
KeyPair getMsgPair = null;
if (plugin.useHttps() && USE_RSA_ENCRYPTION) {
try {
KeyPairGenerator rsaGen = KeyPairGenerator.getInstance("RSA");
getMsgPair = rsaGen.generateKeyPair();
} catch (Exception e1) {
if (thread != null) {
thread.exc("Private key can't be generated", e1);
} else {
e1.printStackTrace();
}
}
}
HttpPost httppost = new HttpPost(plugin.useHttps()? HTTPS_API_PREPARE : HTTP_API_PREPARE);
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("app", Version.getFullVersion(app)));
nameValuePairs.add(new BasicNameValuePair("key", deviceKey));
if(getMsgPair != null && getMsgPair.getPublic() instanceof RSAPublicKey) {
nameValuePairs.add(new BasicNameValuePair("encAlgorithm", "RSA"));
BigInteger modulus = ((RSAPublicKey) getMsgPair.getPublic()).getModulus();
BigInteger pe = ((RSAPublicKey) getMsgPair.getPublic()).getPublicExponent();
nameValuePairs.add(new BasicNameValuePair("encClientPublicKey1", modulus.toString()));
nameValuePairs.add(new BasicNameValuePair("encClientPublicKey2", pe.toString()));
}
if(app.getSettings().OSMO_USER_PWD.get() != null) {
nameValuePairs.add(new BasicNameValuePair("auth", app.getSettings().OSMO_USER_PWD.get()));
}
@ -304,6 +344,23 @@ public class OsMoService implements OsMoReactor {
si.hostName = a.substring(0, i);
si.port = a.substring(i + 1);
si.token = obj.getString("token");
try {
if(getMsgPair != null && obj.has("encServerPublicKey1")) {
si.clientEncCypher = Cipher.getInstance("RSA");
PublicKey pk = KeyFactory.getInstance("RSA").generatePublic(new RSAPublicKeySpec(new BigInteger(obj.getString("encServerPublicKey1")),
new BigInteger(obj.getString("encServerPublicKey2"))));
si.clientEncCypher.init(Cipher.ENCRYPT_MODE, pk);
si.clientDecCypher = Cipher.getInstance("RSA");
si.clientDecCypher.init(Cipher.DECRYPT_MODE, getMsgPair.getPrivate());
}
} catch (Exception e) {
if (thread != null) {
thread.exc("Error exchanging private keys", e);
} else {
e.printStackTrace();
}
}
return si;
} catch (ClientProtocolException e) {
throw new IOException(e);

View file

@ -17,7 +17,11 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import net.osmand.PlatformUtil;
import net.osmand.osm.io.Base64;
import net.osmand.plus.osmo.OsMoService.SessionInfo;
import org.apache.commons.logging.Log;
@ -261,6 +265,15 @@ public class OsMoThread {
while ((i = readCommand.indexOf('\n')) != -1) {
String cmd = readCommand.substring(0, i);
readCommand = readCommand.substring(i + 1);
if(sessionInfo != null && sessionInfo.clientDecCypher != null) {
try {
final byte[] inMsg = android.util.Base64.decode(cmd.getBytes(), android.util.Base64.DEFAULT);
final byte[] byts = sessionInfo.clientDecCypher.doFinal(inMsg);
cmd = new String(byts);
} catch (Exception e) {
exc("Error decrypting", e);
}
}
queueOfMessages.add(cmd.replace("\\n", "\n"));
}
}
@ -449,15 +462,23 @@ public class OsMoThread {
private String prepareCommand(String l) {
StringBuilder res = new StringBuilder(l.length());
for(int i = 0; i < l.length(); i++) {
for (int i = 0; i < l.length(); i++) {
char c = l.charAt(i);
if(c == '\n' || c == '=' || c == '\\') {
res.append('\\');
if (c == '\n' || c == '=' || c == '\\') {
res.append('\\');
}
res.append(c);
}
return res.toString().trim() + "=\n";
String finalCmd = res.toString().trim();
if(sessionInfo != null && sessionInfo.clientEncCypher != null) {
try {
finalCmd = Base64.encode(sessionInfo.clientEncCypher.doFinal(finalCmd.getBytes()));
} catch (Exception e) {
exc("Error encrypting", e);
}
}
return finalCmd + "=\n";
}
public long getLastCommandTime() {

View file

@ -68,6 +68,11 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
showGroupNotifiations.setSummary(R.string.osmo_show_group_notifications_descr);
grp.addPreference(showGroupNotifiations);
CheckBoxPreference useHttps = createCheckBoxPreference(settings.OSMO_USE_HTTPS);
useHttps.setTitle(R.string.osmo_use_https);
useHttps.setSummary(R.string.osmo_use_https_descr);
grp.addPreference(useHttps);
if (OsmandPlugin.isDevelopment()) {
debugPref = new Preference(this);
debugPref.setTitle(R.string.osmo_settings_debug);

View file

@ -93,8 +93,8 @@ public class MapVectorLayer extends BaseMapLayer {
if (mapRenderer != null) {
// opengl renderer
mapRenderer.setTarget(new PointI(tilesRect.getCenter31X(), tilesRect.getCenter31Y()));
mapRenderer.setAzimuth(tilesRect.getRotate());
mapRenderer.setZoom((float) (tilesRect.getZoom() + tilesRect.getZoomScale() + tilesRect.getZoomAnimation()));
mapRenderer.setAzimuth(-tilesRect.getRotate());
mapRenderer.setZoom((float) (tilesRect.getZoom() /*+ tilesRect.getZoomScale() */+ tilesRect.getZoomAnimation()));
} else {
if (!view.isZooming()) {
if (resourceManager.updateRenderedMapNeeded(tilesRect, drawSettings)) {

View file

@ -54,7 +54,6 @@ import android.view.SurfaceView;
import android.view.View;
import android.view.ViewParent;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.Toast;
public class OsmandMapTileView implements IMapDownloaderCallback {

View file

@ -117,7 +117,13 @@ public class NativeQtLibrary {
// DisplayMetrics displayMetrics = new DisplayMetrics();
// act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
DisplayMetrics displayMetrics = app.getResources().getDisplayMetrics();
float displayDensityFactor = displayMetrics.densityDpi / 160.0f;
// TODO getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1))
float scaleCoefficient = displayMetrics.density;
if (Math.min(dm.widthPixels / (dm.density * 160), dm.heightPixels / (dm.density * 160)) > 2.5f) {
// large screen
scaleCoefficient *= 1.5f;
}
float displayDensityFactor = scaleCoefficient;
int referenceTileSize = (int)(256 * displayDensityFactor);
int rasterTileSize = Integer.highestOneBit(referenceTileSize - 1) * 2;
Log.i(NATIVE_TAG, "displayDensityFactor = " + displayDensityFactor +