Merge branch 'master' of ssh://github.com/osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2014-09-27 12:44:49 +03:00
commit 13153bec28
13 changed files with 127 additions and 137 deletions

View file

@ -45,6 +45,13 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
// geo:34.99,-106.61?q=34.99%2C-106.61 (Treasure Island)
z = GeoParsedPoint.NO_ZOOM;
url = "geo:" + dlat + "," + dlon + "?q=" + dlat + "%2C" + dlon + " (" + name + ")";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
// 0,0?q=34,-106(Treasure Island)
z = GeoParsedPoint.NO_ZOOM;
url = "geo:0,0?q=" + ilat + "," + ilon + " (" + name + ")";
@ -331,7 +338,7 @@ public class GeoPointParserUtil {
* @return {@link GeoParsedPoint}
*/
public static GeoParsedPoint parse(final String scheme, final String uri) {
final URI data = URI.create(uri.replaceAll("\\s+", "+").replaceAll("%20", "+"));
final URI data = URI.create(uri.replaceAll("\\s+", "+").replaceAll("%20", "+").replaceAll("%2C", ","));
if ("http".equals(scheme) || "https".equals(scheme)) {
final String schemeSpecific = data.getSchemeSpecificPart();
@ -469,7 +476,7 @@ public class GeoPointParserUtil {
} else {
// geo:47.6,-122.3
// geo:47.6,-122.3?z=11 (Treasure Island)
final String pattern = "([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:\\?z=(\\d{1,2}))?[\\+]?(?:\\((.*?)\\))?";
final String pattern = "([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:(?:\\?z=(\\d{1,2}))?|(?:\\?q=.*?)?)[\\+]?(?:\\((.*?)\\))?";
final Matcher matcher = Pattern.compile(pattern).matcher(schemeSpecific);
if (matcher.matches()) {
final double lat = Double.valueOf(matcher.group(1));

View file

@ -1839,11 +1839,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="osmo_settings_uuid">Geräte-ID</string>
<string name="osmo_settings_descr">Konfigurieren der Überwachungs-Einstellungen und des persönlichen Überwachungs-Kanals</string>
<string name="osmo_plugin_description">OpenStreetMap erweiterte Live-Überwachung, siehe http://osmo.mobi. Ermöglicht die Verfolgung des eigenen oder anderer Geräten.
Erstellen anonymer Gruppen, teilen des Standortes sowie Kommunizieren untereinander. Es gibt verschiedene Einstellungen für Sitzungs- oder Permanenet-Aufzeichnung.
Anonyme Gruppen sind-zeit-oder funktionslimitiert, ohne Fernkonfiguration oder Gruppen-Adminisrator
Voll funktionsfähige Gruppen müssen auf der Internetseite erstellt werden, auf diese haben nur registrierte Nutzer Zugriff.
</string>
<string name="osmo_plugin_description">"Erweiterte OpenStreetMap-basierte Live-Überwachung, siehe http://osmo.mobi ... Ermöglicht die Positionsdarstellung in von einzelnen Geräten in Echtzeit. Bei anonym erstellten Gruppen sind die Optionen etwas eingeschränkt: Lebensdauer der Gruppe nur für einige Tage, auch ist keine zentrale Steuerung der Gruppe möglich. Es gibt verschiedene Einstellungen für zeitlich begrenzte oder Dauer-Aufzeichnung. Voll funktionsfähige Gruppen müssen auf der genannten Internetseite erstellt werden, auf die Gruppe haben nur registrierte Nutzer Zugriff. "</string>
<string name="osmo_plugin_name">OsMo (Erweiterte Live-Überwachung)</string>
<string name="osmo_settings">OsMo OpenStreetMap-Überwachung</string>
<string name="osmo_io_error">OsMo Verbindungsproblem: </string>
@ -1976,4 +1972,6 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="record_plugin_description">Speichern Sie Ihre Tracks mit einem Klick. Zeigt die Einstellung, wie Strecken aufgezeichnet werden in lokale GPX-Dateien oder online via Web-Service.</string>
<string name="route_descr_destination"/>
<string name="local_index_description">Antippen eines Elements um mehr Details zu erfahren, Tippen und Halten zum Deaktivieren oder Löschen des Elements. Aktuell auf dem Gerät vorhandene Daten (%1$s frei):</string>
</resources>
<string name="text_size_descr">Karten-Schriftgröße festlegen</string>
<string name="text_size">Schriftgröße</string>
</resources>

View file

@ -1937,4 +1937,6 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A
<string name="traffic_warning_speed_camera">Hitrostna kamera</string>
<string name="traffic_warning_calming">Ležeči policaj</string>
<string name="local_index_description">Kliknite katerikoli obstoječi element za ogled podrobnosti, pritisnite in držite za izklop ali izbris. Trenutni podatki na napravi (%1$s prosto):</string>
</resources>
<string name="text_size_descr">Nastavite velikost napisov na zemljevidu.</string>
<string name="text_size">Velikost napisov</string>
</resources>

View file

@ -18,11 +18,11 @@
<string name="map_widget_altitude">Höjd</string>
<string name="map_widget_next_turn">Nästa sväng</string>
<string name="show_warnings_title">Visa larm …</string>
<string name="show_warnings_descr">Konfigurerar trafikvarningar (hastighetsgränser, stopp, vägbulor), varning för hastighetskameror samt körfältsinformation</string>
<string name="show_warnings_descr">Konfigurera trafikvarningar (hastighetsbegränsningar, stopp, vägbulor), varning för fartkameror samt körfältsinformation</string>
<string name="use_compass_navigation_descr">Använd kompassen när ingen riktning upptäcks på annat sätt</string>
<string name="use_compass_navigation">Använd kompass</string>
<string name="avoid_motorway">Undvik motorvägar</string>
<string name="auto_zoom_map_descr">Auto-zooma på kartan beroende på din hastighet (när kartan är synkroniserad med aktuell position)</string>
<string name="auto_zoom_map_descr">Zooma in/ut automatiskt på kartan beroende på din hastighet (när kartan är synkroniserad med aktuell position)</string>
<string name="auto_zoom_map">Automatisk kartzoomning</string>
<string name="tip_recent_changes_0_8_3_t">"Förändringar i 0.8.3:\n\t* Waypoints\n\t* Förbättrad vägvisning\n\t* Inställning för att undvika motorvägar när man bygger en rutt\n\t* Lagt till ytterligare en typ av väg för cyklar till kartan (Cycleway=track)\n\t* Buggfixar "</string>
<string name="snap_to_road_descr">Fäst positionen på vägen under navigering</string>

File diff suppressed because one or more lines are too long

View file

@ -19,6 +19,7 @@ import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.access.AccessibilityMode;
import net.osmand.plus.activities.*;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadIndexFragment;
import net.osmand.plus.api.SQLiteAPI;
import net.osmand.plus.api.SQLiteAPIImpl;
@ -111,7 +112,7 @@ public class OsmandApplication extends Application {
BRouterServiceConnection bRouterServiceConnection;
MapActivity mapActivity;
DownloadIndexFragment downloadActivity;
DownloadActivity downloadActivity;
@Override
public void onCreate() {
@ -879,11 +880,11 @@ public class OsmandApplication extends Application {
this.mapActivity = mapActivity;
}
public void setDownloadActivity(DownloadIndexFragment downloadActivity) {
public void setDownloadActivity(DownloadActivity downloadActivity) {
this.downloadActivity = downloadActivity;
}
public DownloadIndexFragment getDownloadActivity() {
public DownloadActivity getDownloadActivity() {
return downloadActivity;
}
}

View file

@ -30,10 +30,7 @@ import net.osmand.plus.voice.TTSCommandPlayerImpl;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Created by Denis on 08.09.2014.
@ -202,6 +199,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
@Override
protected void onResume() {
super.onResume();
getMyApplication().setDownloadActivity(this);
BasicProgressAsyncTask<?, ?, ?> t = downloadListIndexThread.getCurrentRunningTask();
}
@ -476,4 +474,53 @@ public class DownloadActivity extends SherlockFragmentActivity {
task.execute();
}
public void showDialogToDownloadMaps(Collection<String> maps) {
int count = 0;
int sz = 0;
String s = "";
for (IndexItem i : DownloadActivity.downloadListIndexThread.getCachedIndexFiles()) {
for (String map : maps) {
if ((i.getFileName().equals(map + ".obf.zip") || i.getFileName().equals(map + "_" + IndexConstants.BINARY_MAP_VERSION + ".obf.zip"))
&& i.getType() == DownloadActivityType.NORMAL_FILE) {
final List<DownloadEntry> de = i.createDownloadEntry(getMyApplication(), i.getType(), new ArrayList<DownloadEntry>(1));
for(DownloadEntry d : de ) {
count++;
sz += d.sizeMB;
}
if(s.length() > 0) {
s +=", ";
}
s += i.getVisibleName(getMyApplication(), getMyApplication().getResourceManager().getOsmandRegions());
getEntriesToDownload().put(i, de);
}
}
}
if(count > 0){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
downloadFilesCheckInternet();
}
});
builder.setNegativeButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getEntriesToDownload().clear();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
getEntriesToDownload().clear();
}
});
builder.show();
}
}
}

View file

@ -110,7 +110,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
@Override
public void onResume() {
super.onResume();
getMyApplication().setDownloadActivity(this);
getDownloadActivity().updateProgress(false);
BasicProgressAsyncTask<?, ?, ?> t = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
if(t instanceof DownloadIndexesThread.DownloadIndexesAsyncTask) {
@ -121,55 +120,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
}
}
public void showDialogToDownloadMaps(Collection<String> maps) {
int count = 0;
int sz = 0;
String s = "";
for (IndexItem i : DownloadActivity.downloadListIndexThread.getCachedIndexFiles()) {
for (String map : maps) {
if (i.getFileName().equals(map + ".obf.zip") && i.getType() == DownloadActivityType.NORMAL_FILE) {
final List<DownloadEntry> de = i.createDownloadEntry(getMyApplication(), i.getType(), new ArrayList<DownloadEntry>(1));
for(DownloadEntry d : de ) {
count++;
sz += d.sizeMB;
}
if(s.length() > 0) {
s +=", ";
}
s += i.getVisibleName(getMyApplication(), getMyApplication().getResourceManager().getOsmandRegions());
getDownloadActivity().getEntriesToDownload().put(i, de);
}
}
}
if(count > 0){
Builder builder = new AlertDialog.Builder(getDownloadActivity());
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getDownloadActivity().downloadFilesCheckInternet();
}
});
builder.setNegativeButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getDownloadActivity().getEntriesToDownload().clear();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
getDownloadActivity().getEntriesToDownload().clear();
}
});
builder.show();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == RELOAD_ID) {

View file

@ -60,7 +60,8 @@ public class UpdatesIndexFragment extends SherlockListFragment {
if(listAdapter == null){
return;
}
listAdapter.setIndexFiles(items);
listAdapter = new UpdateIndexAdapter(getDownloadActivity(), R.layout.download_index_list_item, items);
setListAdapter(listAdapter);
}
@Override

View file

@ -229,7 +229,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
}
this.tourPresent = tourPresent;
if(!suggestToDownloadMap.isEmpty()) {
final DownloadIndexFragment da = app.getDownloadActivity();
final DownloadActivity da = app.getDownloadActivity();
if (da != null) {
app.runInUIThread(new Runnable() {
@ -562,7 +562,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
if (osmandSettings.SHOW_POI_OVER_MAP.get()) {
adapter.item(R.string.sherpafy_disable_poi).icons(
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light)
.position(adapter.length() - 1)
.listen(new OnContextMenuClick() {
@Override
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
@ -572,7 +571,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
}).reg();
} else {
adapter.item(R.string.poi).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
.position(adapter.length() - 1)
.listen(new OnContextMenuClick() {
@Override
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
@ -582,19 +580,8 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
}
}).reg();
}
final StageInformation stage = getSelectedStage();
if (stage != null && !isStageVisited(stage.order)) {
adapter.item(R.string.complete_stage)
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
.position(adapter.length() - 1).listen(new OnContextMenuClick() {
@Override
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
markStageAsCompleted(stage);
showCompleteStageFragment(mapActivity, stage, false);
}
}).reg();
}
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light).position(adapter.length() - 1)
//important info
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light)
.listen(new OnContextMenuClick() {
@Override
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
@ -603,7 +590,19 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
mapActivity.startActivity(newIntent);
}
}).reg();
//complete stage
final StageInformation stage = getSelectedStage();
if (stage != null && !isStageVisited(stage.order)) {
adapter.item(R.string.complete_stage)
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
.listen(new OnContextMenuClick() {
@Override
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
markStageAsCompleted(stage);
showCompleteStageFragment(mapActivity, stage, false);
}
}).reg();
}
//share my location
adapter.item(R.string.context_menu_item_share_location).icons(
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() {

View file

@ -37,9 +37,9 @@ public class SherpafyFavoriteFragment extends SherpafyStageInfoFragment {
int k = args.getInt(FAV_PARAM);
if (stage != null) {
fav = (StageFavorite) stage.getFavorites().get(k);
if (getSherlockActivity().getSupportActionBar() != null) {
getSherlockActivity().getSupportActionBar().setTitle(fav.getName());
}
// if (getSherlockActivity().getSupportActionBar() != null) {
// getSherlockActivity().getSupportActionBar().setTitle(fav.getName());
// }
}
}

View file

@ -59,9 +59,9 @@ public class SherpafyFavoritesListFragment extends SherlockListFragment {
@Override
public void onResume() {
super.onResume();
if(tour != null) {
getSherlockActivity().getSupportActionBar().setTitle(tour.getName());
}
// if(tour != null) {
// getSherlockActivity().getSupportActionBar().setTitle(tour.getName());
// }
}
@Override

View file

@ -62,7 +62,9 @@ public class SherpafyStageFragment extends SherlockFragment {
if(tour != null && tour.getStageInformation().size() > k) {
stage = tour.getStageInformation().get(k);
}
getSherlockActivity().getSupportActionBar().setTitle(getString(R.string.tab_stage) + " " + (k+1));
if (stage != null){
getSherlockActivity().getSupportActionBar().setTitle(stage.getName());
}
}