From ee6619550cdb412c7383c465ed46c5d0f65ef6ce Mon Sep 17 00:00:00 2001 From: Fabien Carrion Date: Sun, 1 Jul 2012 19:27:32 -0500 Subject: [PATCH 1/3] Take off the layer class all the net edition of bugs --- .../net/osmand/plus/osmedit/OsmBugsLayer.java | 56 ++-------------- .../plus/osmedit/OsmBugsRemoteUtil.java | 66 +++++++++++++++++++ .../net/osmand/plus/osmedit/OsmBugsUtil.java | 10 +++ 3 files changed, 81 insertions(+), 51 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index f92853d370..9764dc68e9 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -7,7 +7,6 @@ import java.io.InputStreamReader; import java.io.Serializable; import java.net.URL; import java.net.URLConnection; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -54,6 +53,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider private final static int startZoom = 8; private final int SEARCH_LIMIT = 100; + private OsmBugsRemoteUtil osmbugsUtil; private OsmandMapTileView view; private Handler handlerToLoop; @@ -83,7 +83,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider public OsmBugsLayer(MapActivity activity){ this.activity = activity; - + this.osmbugsUtil = new OsmBugsRemoteUtil(); } @Override @@ -254,52 +254,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider cRightLongitude = 0; } - public boolean createNewBug(double latitude, double longitude, String text, String authorName){ - StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/addPOIexec?"); //$NON-NLS-1$ - b.append("lat=").append(latitude); //$NON-NLS-1$ - b.append("&lon=").append(longitude); //$NON-NLS-1$ - text = text + " [" + authorName + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$ - b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$ - return editingPOI(b.toString(), "creating bug"); //$NON-NLS-1$ - } - - public boolean addingComment(long id, String text, String authorName){ - StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/editPOIexec?"); //$NON-NLS-1$ - b.append("id=").append(id); //$NON-NLS-1$ - text = text + " [" + authorName + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$ - b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$ - return editingPOI(b.toString(), "adding comment"); //$NON-NLS-1$ - } - - public boolean closingBug(long id){ - StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/closePOIexec?"); //$NON-NLS-1$ - b.append("id=").append(id); //$NON-NLS-1$ - return editingPOI(b.toString(),"closing bug"); //$NON-NLS-1$ - } - - - private boolean editingPOI(String urlStr, String debugAction){ - try { - log.debug("Action " + debugAction + " " + urlStr); //$NON-NLS-1$ //$NON-NLS-2$ - URL url = new URL(urlStr); - URLConnection connection = url.openConnection(); - BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); - while(reader.readLine() != null){ - } - log.debug("Action " + debugAction + " successfull"); //$NON-NLS-1$ //$NON-NLS-2$ - return true; - } catch (IOException e) { - log.error("Error " +debugAction, e); //$NON-NLS-1$ - } catch (RuntimeException e) { - log.error("Error "+debugAction, e); //$NON-NLS-1$ - } - return false; - } protected List loadingBugs(double topLatitude, double leftLongitude, double bottomLatitude,double rightLongitude){ List bugs = new ArrayList(); @@ -367,7 +321,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider String author = ((EditText)openBug.findViewById(R.id.AuthorName)).getText().toString(); // do not set name as author it is ridiculous in that case ((OsmandApplication) activity.getApplication()).getSettings().USER_OSM_BUG_NAME.set(author); - boolean bug = createNewBug(latitude, longitude, text, author); + boolean bug = osmbugsUtil.createNewBug(latitude, longitude, text, author); if (bug) { AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_success), Toast.LENGTH_LONG).show(); clearCache(); @@ -406,7 +360,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString(); String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString(); ((OsmandApplication) OsmBugsLayer.this.activity.getApplication()).getSettings().USER_OSM_BUG_NAME.set(author); - boolean added = addingComment(bug.getId(), text, author); + boolean added = osmbugsUtil.addingComment(bug.getId(), text, author); if (added) { AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show(); clearCache(); @@ -438,7 +392,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider @Override public void onClick(DialogInterface dialog, int which) { OpenStreetBug bug = (OpenStreetBug) args.getSerializable(KEY_BUG); - boolean closed = closingBug(bug.getId()); + boolean closed = osmbugsUtil.closingBug(bug.getId()); if (closed) { AccessibleToast.makeText(activity, activity.getString(R.string.osb_close_dialog_success), Toast.LENGTH_LONG).show(); clearCache(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java new file mode 100644 index 0000000000..7a05683ca5 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java @@ -0,0 +1,66 @@ +package net.osmand.plus.osmedit; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; + +import net.osmand.LogUtil; + +import org.apache.commons.logging.Log; + +public class OsmBugsRemoteUtil implements OsmBugsUtil { + + private static final Log log = LogUtil.getLog(OsmBugsRemoteUtil.class); + + private final static String SITE_API = "http://openstreetbugs.schokokeks.org/api/0.1/"; //$NON-NLS-1$ + + public boolean createNewBug(double latitude, double longitude, String text, String authorName){ + StringBuilder b = new StringBuilder(); + b.append(SITE_API).append("addPOIexec?"); //$NON-NLS-1$ + b.append("lat=").append(latitude); //$NON-NLS-1$ + b.append("&lon=").append(longitude); //$NON-NLS-1$ + text = text + " [" + authorName + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$ + b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$ + return editingPOI(b.toString(), "creating bug"); //$NON-NLS-1$ + } + + public boolean addingComment(long id, String text, String authorName){ + StringBuilder b = new StringBuilder(); + b.append(SITE_API).append("editPOIexec?"); //$NON-NLS-1$ + b.append("id=").append(id); //$NON-NLS-1$ + text = text + " [" + authorName + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$ + b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$ + return editingPOI(b.toString(), "adding comment"); //$NON-NLS-1$ + } + + public boolean closingBug(long id){ + StringBuilder b = new StringBuilder(); + b.append(SITE_API).append("closePOIexec?"); //$NON-NLS-1$ + b.append("id=").append(id); //$NON-NLS-1$ + return editingPOI(b.toString(),"closing bug"); //$NON-NLS-1$ + } + + private boolean editingPOI(String urlStr, String debugAction){ + try { + log.debug("Action " + debugAction + " " + urlStr); //$NON-NLS-1$ //$NON-NLS-2$ + URL url = new URL(urlStr); + URLConnection connection = url.openConnection(); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + while(reader.readLine() != null){ + } + log.debug("Action " + debugAction + " successfull"); //$NON-NLS-1$ //$NON-NLS-2$ + return true; + } catch (IOException e) { + log.error("Error " +debugAction, e); //$NON-NLS-1$ + } catch (RuntimeException e) { + log.error("Error "+debugAction, e); //$NON-NLS-1$ + } + return false; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java new file mode 100644 index 0000000000..467e0e4f1a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java @@ -0,0 +1,10 @@ +package net.osmand.plus.osmedit; + +public interface OsmBugsUtil { + + public boolean createNewBug(double latitude, double longitude, String text, String authorName); + + public boolean addingComment(long id, String text, String authorName); + + public boolean closingBug(long id); +} From ca36a331907536442076496c9fbf13b7204be06e Mon Sep 17 00:00:00 2001 From: Fabien Carrion Date: Sun, 1 Jul 2012 19:33:03 -0500 Subject: [PATCH 2/3] Make a local db to keep change locally --- OsmAnd/res/values-bs/strings.xml | 4 +- OsmAnd/res/values-cs/strings.xml | 4 +- OsmAnd/res/values-de/strings.xml | 4 +- OsmAnd/res/values-es/strings.xml | 4 +- OsmAnd/res/values-eu/strings.xml | 4 +- OsmAnd/res/values-fr/strings.xml | 4 +- OsmAnd/res/values-hi/strings.xml | 4 +- OsmAnd/res/values-hu/strings.xml | 4 +- OsmAnd/res/values-hy/strings.xml | 4 +- OsmAnd/res/values-id/strings.xml | 4 +- OsmAnd/res/values-it/strings.xml | 4 +- OsmAnd/res/values-ka/strings.xml | 4 +- OsmAnd/res/values-ko/strings.xml | 4 +- OsmAnd/res/values-lv/strings.xml | 4 +- OsmAnd/res/values-mr/strings.xml | 4 +- OsmAnd/res/values-nl/strings.xml | 4 +- OsmAnd/res/values-pl/strings.xml | 4 +- OsmAnd/res/values-pt/strings.xml | 4 +- OsmAnd/res/values-ru/strings.xml | 4 +- OsmAnd/res/values-sk/strings.xml | 4 +- OsmAnd/res/values-uk/strings.xml | 4 +- OsmAnd/res/values/strings.xml | 4 +- .../src/net/osmand/plus/OsmandSettings.java | 4 +- .../plus/osmedit/EditingPOIActivity.java | 2 +- .../osmand/plus/osmedit/OsmBugsDbHelper.java | 137 ++++++++++++++++++ .../net/osmand/plus/osmedit/OsmBugsLayer.java | 10 +- .../osmand/plus/osmedit/OsmBugsLocalUtil.java | 48 ++++++ .../plus/osmedit/OsmBugsRemoteUtil.java | 14 ++ .../net/osmand/plus/osmedit/OsmBugsUtil.java | 2 + .../osmand/plus/osmedit/OsmEditingPlugin.java | 4 +- .../net/osmand/plus/osmedit/OsmbugsPoint.java | 87 +++++++++++ 31 files changed, 345 insertions(+), 51 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java diff --git a/OsmAnd/res/values-bs/strings.xml b/OsmAnd/res/values-bs/strings.xml index b652c76c3f..63f3d92f09 100644 --- a/OsmAnd/res/values-bs/strings.xml +++ b/OsmAnd/res/values-bs/strings.xml @@ -155,8 +155,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 6f486f81eb..f1a42f77b0 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -73,8 +73,8 @@ Usnadnění Fluorescentní barvy Použít fluorescentní barvy pro zobrazení cest a tras - Offline editace POI - Vždy používat offline editaci POI + Offline editace + Vždy používat offline editaci "Změny ve verzi 0.7.1 : \n\t- offline editace POI \n\t- přímý přenos pozice - pravidelně posílá souřadnice na webový server (návod jak nastavit vlastní webovou služby je v HowTo článcích) \n\t- Zobrazení momentálně zaznamenávané trasy \n\t- Detekce směru pohybu: indikace a hlášení \'Otočte se zpět\' v případě pohybu směrem od cíle nebo po minutí odbočky \n\t- Obnovené hlasové hlášení \'Přepočítávám cestu\' \n\t- Optická indikace blížící se odbočky během 100m pomocí změny barvy šipky \n\t- Zobrazení aktuálnosti offline dat u deaktivovaných souborů (sekce Download) pomocí tmavě zelené a tmavě modré \n\t- Další změny \n\nSledujte také stránky české podpory osmand.cz " Změny POI bodů v aplikaci nemají vliv na zobrazení stažených map, změny se ukládají do lokálního souboru. Odesílám POI… diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 09fe05a7b4..2d398d160d 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -113,8 +113,8 @@ Zu wenig Prozess-Speicher zum Anzeigen des gewählten Gebietes Fluoreszierende Overlays Fluoreszierende Anzeige von Tracks und Routen - Offline-POI-Bearbeitung - Immer Offline-POI-Bearbeitung verwenden + Offline-Bearbeitung + Immer Offline-Bearbeitung verwenden "Änderungen in 0.7.1 : \n\t- Offline POI-Bearbeitung \n\t- Live-Tracking Option: Koordinaten periodisch an einen Web-Service schicken (Setup-Anleitung für eigenen Web-Service in den HowTo-Artikeln) \n\t- Anzeige des gegenwärtig aufgezeichneten Tracks möglich \n\t- Richtungsüberprüfung: \'Bitte wenden\' wird jetzt angezeigt und angesagt bei entgegengesetzter Bewegungsrichtung oder bei verpasster Abzweigung \n\t- Neue Ansage \'Strecke neu berechnet\' \n\t- Optische Anzeige eines innerhalb 100m bevorstehenden Abbiegevorgangs durch Farbwechsel des Richtungspfeils \n\t- Die Aktualität auch der deaktivierten Karten wird jetzt im Download-Liste in dunkelgrün und dunkelblau angezeigt \n\t- Weitere Verbesserungen " Das Bearbeiten von POIs innerhalb der Applikation beeinflusst nicht die Offline-Karten, sondern wird in einer eigenen Datei gespeichert. POI hochladen… diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index 8e9e088aa4..cf0d1bcf47 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -2,8 +2,8 @@ Usar superpuestos fluorescentes Usar colores fluorescentes para mostrar trazas y rutas - Edición de PDI sin conexión - Usar siempre edición de PDI sin conexión + Edición sin conexión + Usar siempre edición sin conexión Cambios en 0.7.1 : \n\t- Edición de POI sin conexión \n\t- Seguimiento en directo opcional - envía las coordenadas a un servicio web periódicamente (lea cómo configurar su propio servicio web en los artículos HowTo) \n\t- Muestra la traza actual en el mapa \n\t- Detección de la dirección : \'Da la vuelta\' se indica y se anuncia cuando se orienta en la dirección opuesta o después de saltarse un giro \n\t- Nuevo anuncio de voz \'Ruta recalculada\' \n\t- Indicación óptica de un giro inminente en menos de 100m por el cambio de color en la flecha de dirección \n\t- Disponibilidad de versión actual también para ficheros de índice desactivados - se muestra en la pantalla de Descarga en verde oscuro y azul oscuro \n\t- Otros cambios Los cambios a PDIs dentro de la aplicación no afectan a los archivos de mapa descargados; los cambios se guardan en un archivo local. Enviando PDIs… diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml index 2195ee840e..98f809ce9c 100644 --- a/OsmAnd/res/values-eu/strings.xml +++ b/OsmAnd/res/values-eu/strings.xml @@ -125,8 +125,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. Uploading POI… diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 2b78849425..e3fdd92b9a 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -1,7 +1,7 @@  - Modification hors ligne de POI - Toujours utiliser la modification hors ligne de POI + Modification hors ligne + Toujours utiliser la modification hors ligne "Modifications en 0.7.1 : \n\t- Modification hors ligne des POI \n\t- Option de suivi en ligne - envoyer ses coordonnées à un service web de façon périodique (lire la configuration dans les articles HowTo) \n\t- Afficher l\'itinéraire en cours d\'enregistrement sur la carte \n\t- Détection de la direction: \'Faîtes demi-tour\' est affiché et annoncé lors d\'un déplacement dans la direction opposée, ou après avoir raté un virage \n\t- Nouveau message vocal \'Itinéraire recalculé\' \n\t- Indication visuelle d\'un tournant imminent dans les 100m en changeant la couleur de la flèche de direction \n\t- Etat des fichiers de cartes désactivés affichés dans l\'écran de téléchargement en vert foncé et bleu foncé \n\t- Modifications diverses " Les modifications de POI dans l\'application sont sans effet sur les cartes téléchargées, les modifications sont enregistrées dans un fichier. Téléchargement des POI… diff --git a/OsmAnd/res/values-hi/strings.xml b/OsmAnd/res/values-hi/strings.xml index 1bea0466a6..b49fff7ec2 100644 --- a/OsmAnd/res/values-hi/strings.xml +++ b/OsmAnd/res/values-hi/strings.xml @@ -124,8 +124,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. Uploading POI… diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index a72d13e11a..43ca2118eb 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -72,8 +72,8 @@ Kevés a folyamatmemória a terület megjelenítéséhez Fluoreszkáló színek Élénk színek használata az útvonalak megjelenítéséhez - Offline POI szerkesztés - POI szerkesztése mindig offline módban + Offline szerkesztés + Szerkesztése mindig offline módban "A 0.7.1 verzió változásai: \n\t- Offline POI szerkesztés \n\t- Élő Útvonalrögzítési lehetőség: periodikusan koordinátákat küld egy webes szolgáltatásnak (a beállításról a weboldalunk HowTo cikkében olvashatsz) \n\t- Rögzítés alatt álló útvonal megjeleníthető a térképen \n\t- Irányfelismerés: \'Fordulj vissza\' utasítás megjelenítése és bemondása, ha rossz irányba mész, vagy elvétettél egy lekanyarodást \n\t- Új figyelmeztető hang: \'Útvonal újratervezve\' \n\t- A lekanyarodáshoz közeledve az irányjelző nyíl színe megváltozik \n\t- A letöltéskezelőben a deaktivált indexfájlok sötétebb színnel jelennek meg \n\t- Egyéb javítások " Az alkalmazáson belüli POI módosítások nincsenek hatással a letöltött térképre, a változások helyi fájlban tárolódnak. POI feltöltése… diff --git a/OsmAnd/res/values-hy/strings.xml b/OsmAnd/res/values-hy/strings.xml index 592ccd39e8..f871886163 100644 --- a/OsmAnd/res/values-hy/strings.xml +++ b/OsmAnd/res/values-hy/strings.xml @@ -149,8 +149,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " diff --git a/OsmAnd/res/values-id/strings.xml b/OsmAnd/res/values-id/strings.xml index a48c51a5a2..511ac2c206 100644 --- a/OsmAnd/res/values-id/strings.xml +++ b/OsmAnd/res/values-id/strings.xml @@ -133,8 +133,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. Uploading POI… diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 87815c9c1e..325483b0ee 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2,8 +2,8 @@ Overlay fluorescenti Usa colori fluorescenti per mostrare tracce e percorsi - Editing offline dei PDI - Usa sempre l\'editing offline dei PDI + Editing offline + Usa sempre l\'editing offline "Cambiamenti nella versione 0.7.1 : \n\t- Editing offline dei PDI \n\t- Opzione per il Live Tracking - invia le coordinate periodicamente ad un servizio web (guarda come impostare il tuo servizio personale negli articoli dell\'HowTo) \n\t- Mostra sulla mappa la traccia registrata \n\t- Individuazione della direzione: \'Esegui una svolta ad U\' è indicato e annunciato quando ci si dirige in direzione opposta o dopo aver sbagliato una svolta \n\t- Nuovo avviso vocale \'Ricalcolo percorso\' \n\t- Indicazione visiva di una svolta imminente entro 100 metri tramite il cambio del colore della freccia della direzione \n\t- Viene mostrato in verde e blu scuro nella schermata di Download l\'età dei file di indice disattivati \n\t- Altri cambiamenti " I cambiamenti dei PDI all\'interno dell\'applicazione non si riflettono nelle mappe scaricate, i cambiamenti sono salvati in un file locale. Caricando i PDI… diff --git a/OsmAnd/res/values-ka/strings.xml b/OsmAnd/res/values-ka/strings.xml index d49d3097d3..04aff46091 100644 --- a/OsmAnd/res/values-ka/strings.xml +++ b/OsmAnd/res/values-ka/strings.xml @@ -125,8 +125,8 @@ არასაკმარისი მეხსიერება არჩეული ადგილის საჩვენებლად მანათობელი დაფარვები ბილიკებისა და გზების მანათობელი ფერებით ჩვენება - POI-ს ჩასწორება გათიშულ რეჟიმში - ყოველთვის გამოვიყენოთ POI-ს ჩასწორების გათიშული რეჟიმი + POI-ს ჩასწორება გათიშულ რეჟიმში + ყოველთვის გამოვიყენოთ POI-ს ჩასწორების გათიშული რეჟიმი "ცვლილებები 0.7.1-ში : \n\t- POI-ის გათიშულ რეჟიმში ჩასწორება \n\t- დევნა რეალურ დროში - კოორდინატების პერიოდულად გაგზავნა ვებსერვერისათვის (საკუთარი ვებსერვერის ასაწყობად იხილეთ დოკუმენტაცია)\n\t- მიმდინარე ჩაწერილი ბილიკის რუკაზე ჩვენება\n\t- მიმართულების დადგენა: \'შემობრუნდით\' იქნება ნაჩვენები როდესაც მიდიხართ ზუსტად საპირისპირო მიმართულებით\n\t- ახალი ხმოვანი შეტყობინება: \'გზის გადათვლა დასრულებულია\'\n\t- შეხვევის ისრით ჩვენება 100 მეტრის დაცილებისას \n\t- დეაქტივირებული ინდექს ფაილების ჩვენება მუქი მწვანე და მუქი ლურჯი ფერებით\n\t- სხვა ცვლილებები" აპლიკაციაში POI-ის ცვლილებები არ ეხება ჩამოტვირთულ რუკის ფაილებს. ცვლილებები ინახება ლოკალურ ფაილში. POI-ის ატვირთვა.. diff --git a/OsmAnd/res/values-ko/strings.xml b/OsmAnd/res/values-ko/strings.xml index 83254f257b..0d332c4ea7 100644 --- a/OsmAnd/res/values-ko/strings.xml +++ b/OsmAnd/res/values-ko/strings.xml @@ -92,8 +92,8 @@ 선택 영역을 표시할 충분한 프로세스 메모리가 없습니다. 형광 오버레이 트랙과 경로를 나타내기 위해 형광색을 사용합니다 - 오프라인 POI 편집 - 오프라인 POI 편집을 항상 사용합니다 + 오프라인 편집 + 오프라인 편집을 항상 사용합니다 0.7.1 버전에 대한 변경사항들 : \n\t- 오프라인 POI 편집 diff --git a/OsmAnd/res/values-lv/strings.xml b/OsmAnd/res/values-lv/strings.xml index 5462a05de9..337d7c3b60 100644 --- a/OsmAnd/res/values-lv/strings.xml +++ b/OsmAnd/res/values-lv/strings.xml @@ -86,8 +86,8 @@ Nepietiek procesu atmiņas, lai attēlotu izvēlēto apgabalu Flurescentie slāņi Lietot flurescentās krāsas, lai attēlotu trekus un maršrutu - Bezsaistes POI rediģēšana - Viemēr pielietot bezsaistes POI rediģēšanu + Bezsaistes rediģēšana + Viemēr pielietot bezsaistes rediģēšanu "Jaumi 0.7.1 versijā : \n\t- Bezsaistes POI rediģēšana \n\t- Sekošanas opcija - periodiska koordināšu sūtīšana uz web servisu. (kā izveidot savu web servisu var izlasīt HowTo) \n\t- Parādīt kartē ierakstītos trekus \n\t- Virziena noteikšana: Ja brauciet pretējā virzienā vai esiet pabraucis garām pagriezienam tiek paziņots \'Izpildiet U-pagriezienu\' \n\t- Jauns bals ziņojums \'Maršruts pārrēķināts\' \n\t- Tūlītēja (100m)pagrieziena indikācija ar virziena bultas krāsas maiņu \n\t- Deaktivizēto indeksu failu aktualitāte tiek parādīta lejuplādes ekrānā ar tumši zaļu un tumši zilu \n\t- Citas izmaiņas " POI izmaiņas aplikācijā neietekmē lejuplādētos kartes attēlus, izmaiņas tiek saglabātas atsevišķā failā. Lejuplādē POI… diff --git a/OsmAnd/res/values-mr/strings.xml b/OsmAnd/res/values-mr/strings.xml index 1353b4998f..0208c4355e 100644 --- a/OsmAnd/res/values-mr/strings.xml +++ b/OsmAnd/res/values-mr/strings.xml @@ -124,8 +124,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. Uploading POI… diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index a873938af4..ebe2bc5d07 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -79,8 +79,8 @@ Niet genoeg werkgeheugen voor weergave van het geselecteerde gebied Fluorescerende overlays Gebruik fluorescerende kleuren voor de weergave van tracks and routes - Offline interessepunt-bewerking - Gebruik altijd offline interessepunt-bewerking + Offline bewerking + Gebruik altijd offline bewerking "Wijzigingen in 0.7.1 : \n\t- Offline bewerken van interessepunten \n\t- Live Tracking optie - zend coordinaten naar web service (lees voor het opzetten van je eigen webservice de HowTo Artikelen) \n\t- Toon eerder opgenomen tracks op de kaart \n\t- Richtingdetectie: \'Keer terug\' wordt weergegeven bij een koers in de tegengestelde richting of na het missen van een afslag \n\t- Nieuwe stem-instructie \'Route wordt opnieuw berekend\' \n\t- Optische aanduiding van een afslag binnen 100m door een richtingpijl met veranderende kleur \n\t- Weergave van actuele status van gedeactiveerde kaarten nu op het downloadscherm in donker groen en donker blauw \n\t- Andere wijzigingen " Wijzigingen van interessepunten worden niet bewaard in de gedownloade kaartbestanden, maar in een lokaal bestand. Interessepunt wordt ge-upload diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 3aa38dc0f6..b9279a3c16 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -760,8 +760,8 @@ Ułatwienia dostępu Odblaskowe nakładki Użyj odblaskowych kolorów do wyświetlania ścieżek i tras - Edycja POI w trybie offline - Zawsze edytuj POI w trybie offline + Edycja w trybie offline + Zawsze edytuj w trybie offline "Zmiany w 0.7.1 : \n\t- Edycja POI w trybie offline\n\t- Opcja zapisywania ścieżki na bieżąco - cykliczne wysyłanie informacji o pozycji do usługi sieciowej (przeczytaj jak ustawić własną usługę sieciową w artykułach HowTo)\n\t- Pokazywanie aktualnie nagranego śladu na mapie\n\t- Wykrywanie kierunku poruszania: Nakazanie \'Zawróć\' podczas poruszania w przeciwnym kierunku lub po przeoczeniu zakrętu\n\t- Nowa podpowiedź głosowa - \'Trasa przeliczona\' \n\t- Optyczne wskazanie bliskości zakrętu w odległości nie większej niż 100m prze zmianę koloru strzałki\n\t- Zdezaktywowane pliki indeksów są teraz pokazywane w ekranie pobrań w kolorze ciemno zielonym i ciemno niebieskim\n\t- Inne zmiany" Wysyłam POI... {0} POI zostało wysłanych diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml index 208f7e6bf1..3a1a82ccca 100644 --- a/OsmAnd/res/values-pt/strings.xml +++ b/OsmAnd/res/values-pt/strings.xml @@ -565,8 +565,8 @@ Accessibility Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. Uploading POI… diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index ca44cebf76..087713602e 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -62,8 +62,8 @@ Информация Флуоресцентные цвета Использовать флуоресцентные цвета для отображения треков - Локальное редактирование POI - Всегда использовать локальное редактирование POI + Локальное редактирование + Всегда использовать локальное редактирование "Изменения в 0.7.1: \n\t- Локальное редактирование POI \n\t- Live Tracking функциональность (использование и настройка web service в HowTo en) \n\t- Показывать текущий записываемый трек на карте \n\t- Другие изменения " Изменение POI в приложении не меняет POI загруженные из интернета, однако все изменения сохраняются в локальный файл. Загрузка POI diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 942dd50c5c..7caf94d609 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -100,8 +100,8 @@ Nedostatok procesnej pamäte na zobrazenie zvolenej oblasti Žiarivejšie prekrytia Použije žiarivejšie farby pre zobrazenie stôp a ciest - Offline úprava POI bodov - Ak chcete používať iba offline úpravu POI + Offline úprava bodov + Ak chcete používať iba offline úpravu "Zmeny vo verzii 0.7.1 : \n\t- Offline úpravy POI \n\t- Možnosť stopovania naživo - pravidelné odosielanie súradníc do webovej služby (prečítajte si ako nastaviť Vašu webovú službu v článkoch Ako na to) \n\t- Zobrazenie aktuálne zaznamenávanej stopy na mape \n\t- Detekcia smeru jazdy: \'Otočte sa\' je indikované a oznámené pri smerovaní do opačného smeru alebo minutí odbočenia \n\t- Nový hlasový povel \'Cesta prepočítaná\' \n\t- Optická inidkácia najbližšieho odbočenia v 100 metroch zmenou farby smerovej šípky \n\t- Aktuálne sú tiež deaktivované súbory indexov vyznačené v Sťahovaniach ako tmavo zelené a tmavo modré \n\t- Iné zmeny " Zmeny POI v aplikácii neovplyvnia stiahnuté mapové súbory, zmeny sú uložené namiesto toho v lokálnom súbore. Nahrávajú sa POI diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index c4f96d2327..d9a9275fce 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -155,8 +155,8 @@ Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 3469f88cbb..b3b07c98ea 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -199,8 +199,8 @@ You can enable (online or cached) tile map sources, tracking settings, and many Not enough process memory to display selected area Fluorescent overlays Use fluorescent colors to display tracks and routes - Offline POI editing - Always use offline POI editing + Offline editing + Always use offline editing Changes in 0.7.1 : \n\t- Offline POI editing diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index aa9bea02c5..43af26f519 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -517,8 +517,8 @@ public class OsmandSettings { public final OsmandPreference USER_PASSWORD = new StringPreference("user_password", "").makeGlobal(); - // this value boolean is synchronized with settings_pref.xml preference offline POI edition - public final OsmandPreference OFFLINE_POI_EDITION = new BooleanPreference("offline_poi_edition", false).makeGlobal(); + // this value boolean is synchronized with settings_pref.xml preference offline POI/Bugs edition + public final OsmandPreference OFFLINE_EDITION = new BooleanPreference("offline_edition", false).makeGlobal(); // this value string is synchronized with settings_pref.xml preference name diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java index 1a53945d61..bd713b3bd9 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java @@ -76,7 +76,7 @@ public class EditingPOIActivity implements DialogProvider { this.ctx = uiContext; settings = ((OsmandApplication) uiContext.getApplication()).getSettings(); - if(settings.OFFLINE_POI_EDITION.get() || !settings.isInternetConnectionAvailable(true)){ + if(settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)){ this.openstreetmapUtil = new OpenstreetmapLocalUtil(ctx); } else { this.openstreetmapUtil = new OpenstreetmapRemoteUtil(ctx, ctx.getMapView()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java new file mode 100644 index 0000000000..e71d00b9af --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java @@ -0,0 +1,137 @@ +package net.osmand.plus.osmedit; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class OsmBugsDbHelper extends SQLiteOpenHelper { + + private static final int DATABASE_VERSION = 1; + public static final String OSMBUGS_DB_NAME = "osmbugs"; //$NON-NLS-1$ + private static final String OSMBUGS_TABLE_NAME = "osmbugs"; //$NON-NLS-1$ + private static final String OSMBUGS_COL_ID = "id"; //$NON-NLS-1$ + private static final String OSMBUGS_COL_TEXT = "text"; //$NON-NLS-1$ + private static final String OSMBUGS_COL_LAT = "latitude"; //$NON-NLS-1$ + private static final String OSMBUGS_COL_LON = "longitude"; //$NON-NLS-1$ + private static final String OSMBUGS_COL_ACTION = "action"; //$NON-NLS-1$ + private static final String OSMBUGS_COL_AUTHOR = "author"; //$NON-NLS-1$ + private static final String OSMBUGS_TABLE_CREATE = "CREATE TABLE " + OSMBUGS_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$ + OSMBUGS_COL_ID + " INTEGER, " + OSMBUGS_COL_TEXT + " TEXT, " + //$NON-NLS-1$ //$NON-NLS-2$ + OSMBUGS_COL_LAT + " double, " + OSMBUGS_COL_LON + " double, " + //$NON-NLS-1$ //$NON-NLS-2$ + OSMBUGS_COL_ACTION + " TEXT, " + OSMBUGS_COL_AUTHOR + " TEXT);"; //$NON-NLS-1$ //$NON-NLS-2$ + + private List cachedOsmbugsPoints = new ArrayList(); +// private final Context context; + + public OsmBugsDbHelper(Context context) { + super(context, OSMBUGS_DB_NAME, null, DATABASE_VERSION); +// this.context = context; + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL(OSMBUGS_TABLE_CREATE); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + } + + public List getOsmbugsPoints() { + checkOsmbugsPoints(); + return cachedOsmbugsPoints; + } + + public boolean addOsmbugs(OsmbugsPoint p) { + checkOsmbugsPoints(); + SQLiteDatabase db = getWritableDatabase(); + if (db != null) { + db.execSQL("INSERT INTO " + OSMBUGS_TABLE_NAME + + " (" + OSMBUGS_COL_ID + ", " + OSMBUGS_COL_TEXT + ", " + OSMBUGS_COL_LAT + "," + OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + ")" + + " VALUES (?, ?, ?, ?, ?, ?)", new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmBugsRemoteUtil.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$ + cachedOsmbugsPoints.add(p); + p.setStored(true); + return true; + } + return false; + } + + public boolean deleteOsmbugs(OsmbugsPoint p) { + checkOsmbugsPoints(); + SQLiteDatabase db = getWritableDatabase(); + if (db != null) { + db.execSQL("DELETE FROM " + OSMBUGS_TABLE_NAME + + " WHERE " + OSMBUGS_COL_ID + " = ? AND " + + OSMBUGS_COL_TEXT + " = ? AND " + + OSMBUGS_COL_LAT + " = ? AND " + + OSMBUGS_COL_LON + " = ? AND " + + OSMBUGS_COL_ACTION + " = ? AND " + + OSMBUGS_COL_AUTHOR + " = ?", + new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmBugsRemoteUtil.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$ + cachedOsmbugsPoints.remove(p); + p.setStored(false); + return true; + } + return false; + } + + public boolean deleteAllBugModifications(long id) { + checkOsmbugsPoints(); + SQLiteDatabase db = getWritableDatabase(); + if (db != null) { + db.execSQL("DELETE FROM " + OSMBUGS_TABLE_NAME + + " WHERE " + OSMBUGS_COL_ID + " = ?", new Object[] { id }); //$NON-NLS-1$ //$NON-NLS-2$ + //remove all associated actions with that Bug + for (Iterator it = cachedOsmbugsPoints.iterator(); it.hasNext();) { + if (it.next().getId() == id) { + it.remove(); + } + }; + return true; + } + return false; + } + + private void checkOsmbugsPoints(){ + SQLiteDatabase db = getWritableDatabase(); + if (db != null) { + Cursor query = db.rawQuery("SELECT " + OSMBUGS_COL_ID + ", " + OSMBUGS_COL_TEXT + ", " + OSMBUGS_COL_LAT + "," + OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + OSMBUGS_TABLE_NAME, null); + cachedOsmbugsPoints.clear(); + if (query.moveToFirst()) { + do { + OsmbugsPoint p = new OsmbugsPoint(); + + p.setId(query.getLong(0)); + p.setText(query.getString(1)); + p.setLatitude(query.getDouble(2)); + p.setLongitude(query.getDouble(3)); + p.setAction(query.getString(4)); + p.setAuthor(query.getString(5)); + p.setStored(true); + cachedOsmbugsPoints.add(p); + } while (query.moveToNext()); + } + query.close(); + } + } + + public long getMinID() { + SQLiteDatabase db = getReadableDatabase(); + long minID = 0; + if (db != null) { + Cursor query = db.rawQuery("SELECT MIN(" + OSMBUGS_COL_ID + ") FROM " + OSMBUGS_TABLE_NAME, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + if (query.moveToFirst()) { + minID = query.getLong(0); + } + query.close(); + } + return minID; + } + +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 9764dc68e9..9d3e996614 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -53,7 +53,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider private final static int startZoom = 8; private final int SEARCH_LIMIT = 100; - private OsmBugsRemoteUtil osmbugsUtil; + private final OsmBugsUtil osmbugsUtil; private OsmandMapTileView view; private Handler handlerToLoop; @@ -83,7 +83,13 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider public OsmBugsLayer(MapActivity activity){ this.activity = activity; - this.osmbugsUtil = new OsmBugsRemoteUtil(); + + OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings(); + if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)){ + this.osmbugsUtil = new OsmBugsLocalUtil(activity); + } else { + this.osmbugsUtil = new OsmBugsRemoteUtil(); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java new file mode 100644 index 0000000000..3fc0b32135 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java @@ -0,0 +1,48 @@ +package net.osmand.plus.osmedit; + +import net.osmand.LogUtil; + +import org.apache.commons.logging.Log; + +import android.content.Context; + +public class OsmBugsLocalUtil implements OsmBugsUtil { + + private static final Log log = LogUtil.getLog(OsmBugsLocalUtil.class); + + private final Context ctx; + private final OsmBugsDbHelper db; + + public OsmBugsLocalUtil(Context uiContext) { + this.ctx = uiContext; + this.db = new OsmBugsDbHelper(ctx); + } + + public boolean createNewBug(double latitude, double longitude, String text, String authorName){ + OsmbugsPoint p = new OsmbugsPoint(); + p.setId(-1); + p.setText(text); + p.setLatitude(latitude); + p.setLongitude(longitude); + p.setAction(OsmBugsUtil.Action.CREATE); + p.setAuthor(authorName); + return db.addOsmbugs(p); + } + + public boolean addingComment(long id, String text, String authorName){ + OsmbugsPoint p = new OsmbugsPoint(); + p.setId(id); + p.setText(text); + p.setAction(OsmBugsUtil.Action.MODIFY); + p.setAuthor(authorName); + return db.addOsmbugs(p); + } + + public boolean closingBug(long id){ + OsmbugsPoint p = new OsmbugsPoint(); + p.setId(id); + p.setAction(OsmBugsUtil.Action.CLOSE); + return db.addOsmbugs(p); + } + +} diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java index 7a05683ca5..882f64e9e5 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java @@ -6,6 +6,8 @@ import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; import net.osmand.LogUtil; @@ -17,6 +19,18 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil { private final static String SITE_API = "http://openstreetbugs.schokokeks.org/api/0.1/"; //$NON-NLS-1$ + public static final Map stringAction = new HashMap(); + public static final Map actionString = new HashMap(); + static { + stringAction.put(Action.CREATE, "create"); + stringAction.put(Action.MODIFY, "modify"); + stringAction.put(Action.CLOSE, "close"); + + actionString.put("create", Action.CREATE); + actionString.put("modify", Action.MODIFY); + actionString.put("close", Action.CLOSE); + }; + public boolean createNewBug(double latitude, double longitude, String text, String authorName){ StringBuilder b = new StringBuilder(); b.append(SITE_API).append("addPOIexec?"); //$NON-NLS-1$ diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java index 467e0e4f1a..e334e058e3 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsUtil.java @@ -2,6 +2,8 @@ package net.osmand.plus.osmedit; public interface OsmBugsUtil { + public static enum Action {CREATE, MODIFY, CLOSE}; + public boolean createNewBug(double latitude, double longitude, String text, String authorName); public boolean addingComment(long id, String text, String authorName); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index c3a83ec41d..2ede95ee50 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -79,8 +79,8 @@ public class OsmEditingPlugin extends OsmandPlugin { pwd.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); cat.addPreference(pwd); - CheckBoxPreference poiEdit = activity.createCheckBoxPreference(settings.OFFLINE_POI_EDITION, - R.string.offline_poi_edition, R.string.offline_poi_edition_descr); + CheckBoxPreference poiEdit = activity.createCheckBoxPreference(settings.OFFLINE_EDITION, + R.string.offline_edition, R.string.offline_edition_descr); cat.addPreference(poiEdit); Preference pref = new Preference(app); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java new file mode 100644 index 0000000000..285a989394 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java @@ -0,0 +1,87 @@ +package net.osmand.plus.osmedit; + +import java.io.Serializable; + +public class OsmbugsPoint implements Serializable { + private static final long serialVersionUID = 729654300829771468L; + + private long id; + private String text; + private double latitude; + private double longitude; + private OsmBugsUtil.Action action; + private String author; + private boolean stored = false; + + public OsmbugsPoint(){ + } + + public long getId() { + return id; + } + + public String getText() { + return text; + } + + public double getLatitude() { + return latitude; + } + + public double getLongitude() { + return longitude; + } + + public OsmBugsUtil.Action getAction() { + return action; + } + + public String getAuthor() { + return author; + } + + public boolean isStored() { + return stored; + } + + public void setId(long id) { + this.id = id; + } + + public void setText(String text) { + this.text = text; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public void setAction(String action) { + this.action = OsmBugsRemoteUtil.actionString.get(action); + } + + public void setAction(OsmBugsUtil.Action action) { + this.action = action; + } + + public void setAuthor(String author) { + this.author = author; + } + + public void setStored(boolean stored) { + this.stored = stored; + } + + @Override + public String toString() { + return new StringBuffer("OsmBugs Point ").append(this.getAction()).append(" ").append(this.getText()) + .append(" ").append(this.getAuthor()) + .append(" (").append(this.getId()).append("): [") + .append(" (").append(this.getLatitude()).append(", ").append(this.getLongitude()) + .append(")]").toString(); + } +} From ba40f12e03311f6af7fb3b80740fc419d253ca0f Mon Sep 17 00:00:00 2001 From: Fabien Carrion Date: Sun, 1 Jul 2012 20:32:22 -0500 Subject: [PATCH 3/3] Make UI interface for OSM bug edition --- OsmAnd/res/menu/localosm_child.xml | 4 +- OsmAnd/res/menu/localosm_group.xml | 2 +- OsmAnd/res/values-bs/strings.xml | 14 +- OsmAnd/res/values-cs/strings.xml | 12 +- OsmAnd/res/values-de/strings.xml | 18 +- OsmAnd/res/values-es/strings.xml | 16 +- OsmAnd/res/values-eu/strings.xml | 16 +- OsmAnd/res/values-fr/strings.xml | 14 +- OsmAnd/res/values-hi/strings.xml | 16 +- OsmAnd/res/values-hu/strings.xml | 16 +- OsmAnd/res/values-hy/strings.xml | 16 +- OsmAnd/res/values-id/strings.xml | 16 +- OsmAnd/res/values-it/strings.xml | 16 +- OsmAnd/res/values-ka/strings.xml | 10 +- OsmAnd/res/values-ko/strings.xml | 10 +- OsmAnd/res/values-lv/strings.xml | 16 +- OsmAnd/res/values-mr/strings.xml | 16 +- OsmAnd/res/values-nl/strings.xml | 16 +- OsmAnd/res/values-pl/strings.xml | 16 +- OsmAnd/res/values-pt/strings.xml | 16 +- OsmAnd/res/values-ru/strings.xml | 14 +- OsmAnd/res/values-sk/strings.xml | 16 +- OsmAnd/res/values-uk/strings.xml | 16 +- OsmAnd/res/values/strings.xml | 16 +- .../osmedit/AbstractOpenstreetmapUtil.java | 6 +- .../plus/osmedit/EditingPOIActivity.java | 8 +- .../osmedit/LocalOpenstreetmapActivity.java | 154 +++++++++++------- .../plus/osmedit/OpenstreetmapLocalUtil.java | 4 +- .../plus/osmedit/OpenstreetmapPoint.java | 28 +--- .../plus/osmedit/OpenstreetmapRemoteUtil.java | 21 +-- .../plus/osmedit/OpenstreetmapUtil.java | 6 +- .../plus/osmedit/OpenstreetmapsDbHelper.java | 4 +- .../osmand/plus/osmedit/OsmBugsDbHelper.java | 4 +- .../osmand/plus/osmedit/OsmBugsLocalUtil.java | 6 +- .../plus/osmedit/OsmBugsRemoteUtil.java | 14 -- .../src/net/osmand/plus/osmedit/OsmPoint.java | 64 ++++++++ .../net/osmand/plus/osmedit/OsmbugsPoint.java | 24 +-- 37 files changed, 362 insertions(+), 319 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmPoint.java diff --git a/OsmAnd/res/menu/localosm_child.xml b/OsmAnd/res/menu/localosm_child.xml index e3e7c4f1e5..79ee1b1dcf 100644 --- a/OsmAnd/res/menu/localosm_child.xml +++ b/OsmAnd/res/menu/localosm_child.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/OsmAnd/res/menu/localosm_group.xml b/OsmAnd/res/menu/localosm_group.xml index 4f9bbb2599..aa55b21ce0 100644 --- a/OsmAnd/res/menu/localosm_group.xml +++ b/OsmAnd/res/menu/localosm_group.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/OsmAnd/res/values-bs/strings.xml b/OsmAnd/res/values-bs/strings.xml index 63f3d92f09..ebea3eb0ae 100644 --- a/OsmAnd/res/values-bs/strings.xml +++ b/OsmAnd/res/values-bs/strings.xml @@ -161,16 +161,16 @@ "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded + Uploading… + {0} POI/Bugs were uploaded Upload all POI - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index f1a42f77b0..a1e8522645 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -77,14 +77,14 @@ Vždy používat offline editaci "Změny ve verzi 0.7.1 : \n\t- offline editace POI \n\t- přímý přenos pozice - pravidelně posílá souřadnice na webový server (návod jak nastavit vlastní webovou služby je v HowTo článcích) \n\t- Zobrazení momentálně zaznamenávané trasy \n\t- Detekce směru pohybu: indikace a hlášení \'Otočte se zpět\' v případě pohybu směrem od cíle nebo po minutí odbočky \n\t- Obnovené hlasové hlášení \'Přepočítávám cestu\' \n\t- Optická indikace blížící se odbočky během 100m pomocí změny barvy šipky \n\t- Zobrazení aktuálnosti offline dat u deaktivovaných souborů (sekce Download) pomocí tmavě zelené a tmavě modré \n\t- Další změny \n\nSledujte také stránky české podpory osmand.cz " Změny POI bodů v aplikaci nemají vliv na zobrazení stažených map, změny se ukládají do lokálního souboru. - Odesílám POI… - {0} POI bylo odesláno - Odeslat všechny POI + Odesílám… + {0} POI/Bugs bylo odesláno + Odeslat všechny " " - Zobrazit POI na mapě + Zobrazit na mapě Odeslat změny do OSM - Smazat změny POI - Offline editace POI v Openstreetmap: + Smazat změny + Offline editace POI/Bugs v Openstreetmap: Lokální body Openstreetmap Lokální body uložené v databázi Zapnout odesílání pozice na HTTP server v reálném čase diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 2d398d160d..4e2f6a8cec 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -117,16 +117,16 @@ Immer Offline-Bearbeitung verwenden "Änderungen in 0.7.1 : \n\t- Offline POI-Bearbeitung \n\t- Live-Tracking Option: Koordinaten periodisch an einen Web-Service schicken (Setup-Anleitung für eigenen Web-Service in den HowTo-Artikeln) \n\t- Anzeige des gegenwärtig aufgezeichneten Tracks möglich \n\t- Richtungsüberprüfung: \'Bitte wenden\' wird jetzt angezeigt und angesagt bei entgegengesetzter Bewegungsrichtung oder bei verpasster Abzweigung \n\t- Neue Ansage \'Strecke neu berechnet\' \n\t- Optische Anzeige eines innerhalb 100m bevorstehenden Abbiegevorgangs durch Farbwechsel des Richtungspfeils \n\t- Die Aktualität auch der deaktivierten Karten wird jetzt im Download-Liste in dunkelgrün und dunkelblau angezeigt \n\t- Weitere Verbesserungen " Das Bearbeiten von POIs innerhalb der Applikation beeinflusst nicht die Offline-Karten, sondern wird in einer eigenen Datei gespeichert. - POI hochladen… - {0} POI wurden hochgeladen - Alle POI hochladen + hochladen… + {0} POI/Bugs wurden hochgeladen + Alle hochladen " " - POI auf Karte zeigen - POI Änderung auf OSM hochladen - POI Änderung löschen - Asynchrone OSM POI Bearbeitung: - Lokal notierte OSM Punkte - Lokal vorgemerkte OSM Punkte anzeigen und verwalten + Auf Karte zeigen + Änderung auf OSM hochladen + Änderung löschen + Asynchrone OSM Bearbeitung: + Lokal notierte OSM Punkte/Bugs + Lokal vorgemerkte OSM Punkte/Bugs anzeigen und verwalten Senden von HTTP-Daten an einen Web-Service Live-Tracking aktivieren Angabe des Live-Tracking Invervalls diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index cf0d1bcf47..2679823cc4 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -6,16 +6,16 @@ Usar siempre edición sin conexión Cambios en 0.7.1 : \n\t- Edición de POI sin conexión \n\t- Seguimiento en directo opcional - envía las coordenadas a un servicio web periódicamente (lea cómo configurar su propio servicio web en los artículos HowTo) \n\t- Muestra la traza actual en el mapa \n\t- Detección de la dirección : \'Da la vuelta\' se indica y se anuncia cuando se orienta en la dirección opuesta o después de saltarse un giro \n\t- Nuevo anuncio de voz \'Ruta recalculada\' \n\t- Indicación óptica de un giro inminente en menos de 100m por el cambio de color en la flecha de dirección \n\t- Disponibilidad de versión actual también para ficheros de índice desactivados - se muestra en la pantalla de Descarga en verde oscuro y azul oscuro \n\t- Otros cambios Los cambios a PDIs dentro de la aplicación no afectan a los archivos de mapa descargados; los cambios se guardan en un archivo local. - Enviando PDIs… - {0} PDIs enviados - Enviar todos los PDIs + Enviando… + {0} PDIs/Bugs enviados + Enviar todos "" - Mostrar PDI en el mapa + Mostrar en el mapa Enviar modificación a OSM - Suprimir modificación a PDI - Edición asíncrona de PDIs de OSM: - Puntos OSM guardados localmente - Mostrar y gestionar puntos OSM anotados en base de datos local + Suprimir modificación + Edición asíncrona de OSM: + Puntos/Bugs OSM guardados localmente + Mostrar y gestionar puntos/bugs OSM anotados en base de datos local Permite el envío de peticiones HTTP a un servicio web especificado Seguimiento en directo Especifique el intervalo de Seguimiento en directo diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml index 98f809ce9c..894b63d7f8 100644 --- a/OsmAnd/res/values-eu/strings.xml +++ b/OsmAnd/res/values-eu/strings.xml @@ -129,16 +129,16 @@ Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all "" - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking Specify live tracking interval diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index e3fdd92b9a..a809644e87 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4,16 +4,16 @@ Toujours utiliser la modification hors ligne "Modifications en 0.7.1 : \n\t- Modification hors ligne des POI \n\t- Option de suivi en ligne - envoyer ses coordonnées à un service web de façon périodique (lire la configuration dans les articles HowTo) \n\t- Afficher l\'itinéraire en cours d\'enregistrement sur la carte \n\t- Détection de la direction: \'Faîtes demi-tour\' est affiché et annoncé lors d\'un déplacement dans la direction opposée, ou après avoir raté un virage \n\t- Nouveau message vocal \'Itinéraire recalculé\' \n\t- Indication visuelle d\'un tournant imminent dans les 100m en changeant la couleur de la flèche de direction \n\t- Etat des fichiers de cartes désactivés affichés dans l\'écran de téléchargement en vert foncé et bleu foncé \n\t- Modifications diverses " Les modifications de POI dans l\'application sont sans effet sur les cartes téléchargées, les modifications sont enregistrées dans un fichier. - Téléchargement des POI… - {0} POI ont été téléchargés - Télécharger tous les POI + Téléchargement… + {0} POI/Bugs ont été téléchargés + Télécharger les tous " " - Afficher le POI sur la carte + Afficher le sur la carte Télécharger les modifications vers OSM - Supprimer la modification de POI + Supprimer la modification Modification asynchrone de points OSM: - Points OSM enregistrés en local - Afficher et gérer les points OSM enregistrés dans la base locale + Points/Bugs OSM enregistrés en local + Afficher et gérer les points/Bugs OSM enregistrés dans la base locale Activer l\'envoi de requêtes HTTP à un service web donné Activer le suivi en ligne Préciser l\'intervalle pour le suivi en ligne diff --git a/OsmAnd/res/values-hi/strings.xml b/OsmAnd/res/values-hi/strings.xml index b49fff7ec2..0689434df8 100644 --- a/OsmAnd/res/values-hi/strings.xml +++ b/OsmAnd/res/values-hi/strings.xml @@ -128,16 +128,16 @@ Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all " " - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking Specify live tracking interval diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 43ca2118eb..254cde4646 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -76,16 +76,16 @@ Szerkesztése mindig offline módban "A 0.7.1 verzió változásai: \n\t- Offline POI szerkesztés \n\t- Élő Útvonalrögzítési lehetőség: periodikusan koordinátákat küld egy webes szolgáltatásnak (a beállításról a weboldalunk HowTo cikkében olvashatsz) \n\t- Rögzítés alatt álló útvonal megjeleníthető a térképen \n\t- Irányfelismerés: \'Fordulj vissza\' utasítás megjelenítése és bemondása, ha rossz irányba mész, vagy elvétettél egy lekanyarodást \n\t- Új figyelmeztető hang: \'Útvonal újratervezve\' \n\t- A lekanyarodáshoz közeledve az irányjelző nyíl színe megváltozik \n\t- A letöltéskezelőben a deaktivált indexfájlok sötétebb színnel jelennek meg \n\t- Egyéb javítások " Az alkalmazáson belüli POI módosítások nincsenek hatással a letöltött térképre, a változások helyi fájlban tárolódnak. - POI feltöltése… - {0} POI feltöltve - Összes POI feltöltése + Feltöltése… + {0} POI/Bugs feltöltve + Összes feltöltése " " - POI megjelenítése a térképen + Megjelenítése a térképen Módosítások feltöltése OSM-re - POI módosítás törlése - Aszinkron OSM POI szerkesztés: - Helyileg tárolt OSM pontok - Helyi adatbázisban tárolt OSM pontok megjelenítése, kezelése + Módosítás törlése + Aszinkron OSM szerkesztés: + Helyileg tárolt OSM pontok/Bugs + Helyi adatbázisban tárolt OSM pontok/Bugs megjelenítése, kezelése Lehetővé teszi HTTP üzenetek küldését a megadott webes szolgáltatásnak Élő Útvonalrögzítés Élő Útvonalrögzítés intervalluma diff --git a/OsmAnd/res/values-hy/strings.xml b/OsmAnd/res/values-hy/strings.xml index f871886163..2e617ff354 100644 --- a/OsmAnd/res/values-hy/strings.xml +++ b/OsmAnd/res/values-hy/strings.xml @@ -155,16 +155,16 @@ "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking diff --git a/OsmAnd/res/values-id/strings.xml b/OsmAnd/res/values-id/strings.xml index 511ac2c206..cffd5f774d 100644 --- a/OsmAnd/res/values-id/strings.xml +++ b/OsmAnd/res/values-id/strings.xml @@ -137,16 +137,16 @@ Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all " " - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking Specify live tracking interval diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 325483b0ee..7a574e0c7a 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -6,16 +6,16 @@ Usa sempre l\'editing offline "Cambiamenti nella versione 0.7.1 : \n\t- Editing offline dei PDI \n\t- Opzione per il Live Tracking - invia le coordinate periodicamente ad un servizio web (guarda come impostare il tuo servizio personale negli articoli dell\'HowTo) \n\t- Mostra sulla mappa la traccia registrata \n\t- Individuazione della direzione: \'Esegui una svolta ad U\' è indicato e annunciato quando ci si dirige in direzione opposta o dopo aver sbagliato una svolta \n\t- Nuovo avviso vocale \'Ricalcolo percorso\' \n\t- Indicazione visiva di una svolta imminente entro 100 metri tramite il cambio del colore della freccia della direzione \n\t- Viene mostrato in verde e blu scuro nella schermata di Download l\'età dei file di indice disattivati \n\t- Altri cambiamenti " I cambiamenti dei PDI all\'interno dell\'applicazione non si riflettono nelle mappe scaricate, i cambiamenti sono salvati in un file locale. - Caricando i PDI… - {0} PDI sono stati caricati - Carica tutti i PDI + Caricando… + {0} PDI/Bugs sono stati caricati + Carica tutti " " - Modifica il PDI sulla mappa + Modifica sulla mappa Carica in OSM la modifica - Cancella la modifica al PDI - Modifica asincrona dei PDI OSM: - Nodi OSM salvati in locale - Mostra e gestisci i nodi OSM inseriti nel database locale + Cancella la modifica + Modifica asincrona dei OSM: + Nodi/Bugs OSM salvati in locale + Mostra e gestisci i nodi/Bugs OSM inseriti nel database locale Abilita l\'invio di richieste HTTP ad un specifico servizio web Online Live Tracking Specifica l\'intervallo del Live Tracking diff --git a/OsmAnd/res/values-ka/strings.xml b/OsmAnd/res/values-ka/strings.xml index 04aff46091..c4ce87a7d8 100644 --- a/OsmAnd/res/values-ka/strings.xml +++ b/OsmAnd/res/values-ka/strings.xml @@ -129,16 +129,16 @@ ყოველთვის გამოვიყენოთ POI-ს ჩასწორების გათიშული რეჟიმი "ცვლილებები 0.7.1-ში : \n\t- POI-ის გათიშულ რეჟიმში ჩასწორება \n\t- დევნა რეალურ დროში - კოორდინატების პერიოდულად გაგზავნა ვებსერვერისათვის (საკუთარი ვებსერვერის ასაწყობად იხილეთ დოკუმენტაცია)\n\t- მიმდინარე ჩაწერილი ბილიკის რუკაზე ჩვენება\n\t- მიმართულების დადგენა: \'შემობრუნდით\' იქნება ნაჩვენები როდესაც მიდიხართ ზუსტად საპირისპირო მიმართულებით\n\t- ახალი ხმოვანი შეტყობინება: \'გზის გადათვლა დასრულებულია\'\n\t- შეხვევის ისრით ჩვენება 100 მეტრის დაცილებისას \n\t- დეაქტივირებული ინდექს ფაილების ჩვენება მუქი მწვანე და მუქი ლურჯი ფერებით\n\t- სხვა ცვლილებები" აპლიკაციაში POI-ის ცვლილებები არ ეხება ჩამოტვირთულ რუკის ფაილებს. ცვლილებები ინახება ლოკალურ ფაილში. - POI-ის ატვირთვა.. - {0} POI ატვირთულია + POI-ის ატვირთვა.. + {0} POI/Bugs ატვირთულია ყველა POI-ს ატვირთვა " " - POI-ის რუკაზე ჩვენება + POI-ის რუკაზე ჩვენება ცვლილების OSM-ზე ატვირთვა POI-ის ცვლილების წაშლა OSM POI-ის ასინქრონული ჩასწორება: - ადგილობრივად შენახული OSM POI-ები - ადგილობრივ ბაზაში შენახული OSM POI-ების ჩვენება და მართვა + ადგილობრივად შენახული OSM POI-ები/Bugs + ადგილობრივ ბაზაში შენახული OSM POI-ების/Bugs ჩვენება და მართვა დევნის მითითებულ ვებსერვისზე გაგზავნა დევნა მიმდინარე რეჟიმში მიუთითეთ მიმდინარე რეჟიმში დევნის ინტერვალი diff --git a/OsmAnd/res/values-ko/strings.xml b/OsmAnd/res/values-ko/strings.xml index 0d332c4ea7..670db75bdd 100644 --- a/OsmAnd/res/values-ko/strings.xml +++ b/OsmAnd/res/values-ko/strings.xml @@ -107,14 +107,14 @@ 프로그램 내의 POI 변경은 다운로드된 맵 파일에 영향을 주지 않고, 대신 따로 파일로 저장됩니다. - POI 업로드 중... - {0} POI 가 업로드되었습니다 + POI 업로드 중... + {0} POI/Bugs 가 업로드되었습니다 모든 POI 업로드하기 - 맵 상에 POI 표시 + 맵 상에 표시 수정사항을 OSM 으로 업로드 - POI 수정사항 삭제 - 비동기적인 Openstreetmap POI 편집: + 수정사항 삭제 + 비동기적인 Openstreetmap 편집: 지역 Openstreetmap 지점들 DB에 저장된 지역 지점들 diff --git a/OsmAnd/res/values-lv/strings.xml b/OsmAnd/res/values-lv/strings.xml index 337d7c3b60..408e291569 100644 --- a/OsmAnd/res/values-lv/strings.xml +++ b/OsmAnd/res/values-lv/strings.xml @@ -90,16 +90,16 @@ Viemēr pielietot bezsaistes rediģēšanu "Jaumi 0.7.1 versijā : \n\t- Bezsaistes POI rediģēšana \n\t- Sekošanas opcija - periodiska koordināšu sūtīšana uz web servisu. (kā izveidot savu web servisu var izlasīt HowTo) \n\t- Parādīt kartē ierakstītos trekus \n\t- Virziena noteikšana: Ja brauciet pretējā virzienā vai esiet pabraucis garām pagriezienam tiek paziņots \'Izpildiet U-pagriezienu\' \n\t- Jauns bals ziņojums \'Maršruts pārrēķināts\' \n\t- Tūlītēja (100m)pagrieziena indikācija ar virziena bultas krāsas maiņu \n\t- Deaktivizēto indeksu failu aktualitāte tiek parādīta lejuplādes ekrānā ar tumši zaļu un tumši zilu \n\t- Citas izmaiņas " POI izmaiņas aplikācijā neietekmē lejuplādētos kartes attēlus, izmaiņas tiek saglabātas atsevišķā failā. - Lejuplādē POI… - {0} POI tika lejuplādētji - Lejuplādēt visus POI + Lejuplādē… + {0} POI/Bugs tika lejuplādētji + Lejuplādēt visus " " - Rādīt POI uz kartes + Rādīt uz kartes Augšuplādēt izmaiņas uz OSM - Dzēst POI labojumus - Asinhronā POI rediģēšana: - Laokāli saglabātie OSM POIs - Rādīt un organizēt lokālajā datubāzē pieejamos OSM POI + Dzēst labojumus + Asinhronā rediģēšana: + Laokāli saglabātie OSM POIs/Bugs + Rādīt un organizēt lokālajā datubāzē pieejamos OSM POI/Bugs Nosūtīt treku uz norādīto web servisu Tiešsaistes sekošana Norādīt tiešsaistes sekošanas intervālu diff --git a/OsmAnd/res/values-mr/strings.xml b/OsmAnd/res/values-mr/strings.xml index 0208c4355e..fbc8db92d1 100644 --- a/OsmAnd/res/values-mr/strings.xml +++ b/OsmAnd/res/values-mr/strings.xml @@ -128,16 +128,16 @@ Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all "" - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking Specify live tracking interval diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index ebe2bc5d07..d8275ac342 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -83,16 +83,16 @@ Gebruik altijd offline bewerking "Wijzigingen in 0.7.1 : \n\t- Offline bewerken van interessepunten \n\t- Live Tracking optie - zend coordinaten naar web service (lees voor het opzetten van je eigen webservice de HowTo Artikelen) \n\t- Toon eerder opgenomen tracks op de kaart \n\t- Richtingdetectie: \'Keer terug\' wordt weergegeven bij een koers in de tegengestelde richting of na het missen van een afslag \n\t- Nieuwe stem-instructie \'Route wordt opnieuw berekend\' \n\t- Optische aanduiding van een afslag binnen 100m door een richtingpijl met veranderende kleur \n\t- Weergave van actuele status van gedeactiveerde kaarten nu op het downloadscherm in donker groen en donker blauw \n\t- Andere wijzigingen " Wijzigingen van interessepunten worden niet bewaard in de gedownloade kaartbestanden, maar in een lokaal bestand. - Interessepunt wordt ge-upload - {0} interessepunten zijn ge-upload - Upload Alle interessepunten + Wordt ge-upload + {0} interessepunten/Bugs zijn ge-upload + Upload Alle " " - Toon interessepunten op kaart + Toon op kaart Upload wijziging naar OSM - Wis de wijziging van interessepunten - Asynchrone Openstreetmap interessepunten wijziging: - Locale Openstreetmap punten - Locale Punten bewaard in database + Wis de wijziging + Asynchrone Openstreetmap wijziging: + Locale Openstreetmap punten/Bugs + Locale Punten/Bugs bewaard in database Versturen HTTP verzoeken naar een webservice toestaan Online Live Tracking Specificeer Live Tracking interval diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index b9279a3c16..b7b2e1a02e 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -763,16 +763,16 @@ Edycja w trybie offline Zawsze edytuj w trybie offline "Zmiany w 0.7.1 : \n\t- Edycja POI w trybie offline\n\t- Opcja zapisywania ścieżki na bieżąco - cykliczne wysyłanie informacji o pozycji do usługi sieciowej (przeczytaj jak ustawić własną usługę sieciową w artykułach HowTo)\n\t- Pokazywanie aktualnie nagranego śladu na mapie\n\t- Wykrywanie kierunku poruszania: Nakazanie \'Zawróć\' podczas poruszania w przeciwnym kierunku lub po przeoczeniu zakrętu\n\t- Nowa podpowiedź głosowa - \'Trasa przeliczona\' \n\t- Optyczne wskazanie bliskości zakrętu w odległości nie większej niż 100m prze zmianę koloru strzałki\n\t- Zdezaktywowane pliki indeksów są teraz pokazywane w ekranie pobrań w kolorze ciemno zielonym i ciemno niebieskim\n\t- Inne zmiany" - Wysyłam POI... - {0} POI zostało wysłanych - Wyślij wszystkie POI + Wysyłam... + {0} POI/Bugs zostało wysłanych + Wyślij wszystkie - Pokaż POI na mapie + Pokaż na mapie Wyślij modyfikacje do OSM - Usuń modyfikacje POI - Asynchroniczna edycja POI OSM: - Lokalnie zapisane POI OSM - Pokaż i zarządzaj POI OSM zapisanymi w lokalnej bazie danych + Usuń modyfikacje + Asynchroniczna edycja OSM: + Lokalnie zapisane POI/Bugs OSM + Pokaż i zarządzaj POI/Bugs OSM zapisanymi w lokalnej bazie danych Wysyłaj informacje o pozycji do wybranej usługi sieciowej Śledzenie online na bieżąco Określ interwał pomiędzy wysyłaniem danych diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml index 3a1a82ccca..af9ceee63a 100644 --- a/OsmAnd/res/values-pt/strings.xml +++ b/OsmAnd/res/values-pt/strings.xml @@ -569,16 +569,16 @@ Always use offline editing "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking Specify live tracking interval diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 087713602e..fa7d12b4fa 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -66,16 +66,16 @@ Всегда использовать локальное редактирование "Изменения в 0.7.1: \n\t- Локальное редактирование POI \n\t- Live Tracking функциональность (использование и настройка web service в HowTo en) \n\t- Показывать текущий записываемый трек на карте \n\t- Другие изменения " Изменение POI в приложении не меняет POI загруженные из интернета, однако все изменения сохраняются в локальный файл. - Загрузка POI - {0} POI были загружены - Загрузить все POI + Загрузка + {0} POI/Bugs были загружены + Загрузить все " " - Показать POI на карте + Показать на карте Загрузить изменения в OSM - Удалить созданные POI - Offline POI дополнение: + Удалить созданные + Offline дополнение: Локальные Openstreetmap точки - "Управление локальными POI" + "Управление локальными POI/Bugs" Отсылать текущее положение на специальный web-сервис Включить Live слежение Укажите интервал Live слежения diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 7caf94d609..4f8d8f3a40 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -104,16 +104,16 @@ Ak chcete používať iba offline úpravu "Zmeny vo verzii 0.7.1 : \n\t- Offline úpravy POI \n\t- Možnosť stopovania naživo - pravidelné odosielanie súradníc do webovej služby (prečítajte si ako nastaviť Vašu webovú službu v článkoch Ako na to) \n\t- Zobrazenie aktuálne zaznamenávanej stopy na mape \n\t- Detekcia smeru jazdy: \'Otočte sa\' je indikované a oznámené pri smerovaní do opačného smeru alebo minutí odbočenia \n\t- Nový hlasový povel \'Cesta prepočítaná\' \n\t- Optická inidkácia najbližšieho odbočenia v 100 metroch zmenou farby smerovej šípky \n\t- Aktuálne sú tiež deaktivované súbory indexov vyznačené v Sťahovaniach ako tmavo zelené a tmavo modré \n\t- Iné zmeny " Zmeny POI v aplikácii neovplyvnia stiahnuté mapové súbory, zmeny sú uložené namiesto toho v lokálnom súbore. - Nahrávajú sa POI - {0} POI bolo nahratých - Nahrať všetky POI + Nahrávajú sa + {0} POI/Bugs bolo nahratých + Nahrať všetky " " - Zobraziť POI na mape + Zobraziť na mape Nahrať úpravu na OSM - Vymazať úpravu POI - Asynchrónna úprava Openstreetmap POI: - Lokálne Openstreetmap body - Lokálne body uložené v databáze + Vymazať úpravu + Asynchrónna úprava Openstreetmap: + Lokálne Openstreetmap body/Bugs + Lokálne body/Bugs uložené v databáze Zapnutie posielania HTTP požiadaviek na určenú webovú službu Zapnúť stopovanie naživo Určenie intervalu stopovania naživo diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index d9a9275fce..ac7fbb61db 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -161,16 +161,16 @@ "Changes in 0.7.1 : \n\t- Offline POI editing \n\t- Live Tracking option - send coordinates to web service periodically (read how to setup your own web service in HowTo Articles) \n\t- Show currently recorded track on map \n\t- Direction detection: \'Make U-turn\' is indicated and announced when heading in opposite direction or after missing a turn \n\t- New voice prompt \'Route recalculated\' \n\t- Optical indication of an imminent turn within 100m by diretion arrow changing color \n\t- Actuality also of deactivated index files now shown on Download screen in dark green and dark blue \n\t- Other changes " POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index b3b07c98ea..eb606971b3 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -214,16 +214,16 @@ You can enable (online or cached) tile map sources, tracking settings, and many POI changes inside application do not affect downloaded map files, changes are saved to local file instead. - Uploading POI… - {0} POI were uploaded - Upload all POI + Uploading… + {0} POI/Bugs were uploaded + Upload all - Show POI on map + Show on map Upload modification to OSM - Delete POI modification - Asynchronous OSM POI Editing: - Locally saved OSM POIs - Show and manage OSM POIs noted in local database + Delete modification + Asynchronous OSM Editing: + Locally saved OSM POIs/Bugs + Show and manage OSM POIs/Bugs noted in local database Send tracking to a specified web service Online live tracking diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java index 9ee6a6ab5a..441e3f5a0d 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AbstractOpenstreetmapUtil.java @@ -17,7 +17,7 @@ import android.widget.Toast; public abstract class AbstractOpenstreetmapUtil implements OpenstreetmapUtil { @Override - public void updateNodeInIndexes(Activity ctx, OpenstreetmapUtil.Action action, Node n, Node oldNode) { + public void updateNodeInIndexes(Activity ctx, OsmPoint.Action action, Node n, Node oldNode) { final OsmandApplication app = (OsmandApplication) ctx.getApplication(); final AmenityIndexRepositoryOdb repo = app.getResourceManager().getUpdatablePoiDb(); ctx.runOnUiThread(new Runnable() { @@ -42,12 +42,12 @@ public abstract class AbstractOpenstreetmapUtil implements OpenstreetmapUtil { } // delete all amenities with same id - if (OpenstreetmapUtil.Action.DELETE == action || OpenstreetmapUtil.Action.MODIFY == action) { + if (OsmPoint.Action.DELETE == action || OsmPoint.Action.MODIFY == action) { repo.deleteAmenities(n.getId() << 1); repo.clearCache(); } // add amenities - if (OpenstreetmapUtil.Action.DELETE != action) { + if (OsmPoint.Action.DELETE != action) { List ams = Amenity.parseAmenities(MapRenderingTypes.getDefault(), n, new ArrayList()); for (Amenity a : ams) { repo.addAmenity(a); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java index bd713b3bd9..c6310f75f6 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java @@ -134,7 +134,7 @@ public class EditingPOIActivity implements DialogProvider { public void onClick(DialogInterface dialog, int which) { Node n = (Node) args.getSerializable(KEY_AMENITY_NODE); String c = comment.getText().toString(); - commitNode(OpenstreetmapUtil.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c, new Runnable(){ + commitNode(OsmPoint.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c, new Runnable(){ @Override public void run() { AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.poi_remove_success), Toast.LENGTH_LONG).show(); @@ -248,7 +248,7 @@ public class EditingPOIActivity implements DialogProvider { Resources resources = v.getResources(); final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources .getString(R.string.poi_action_change); - OpenstreetmapUtil.Action action = n.getId() == -1 ? OpenstreetmapUtil.Action.CREATE : OpenstreetmapUtil.Action.MODIFY; + OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY; Map> typeNameToTagVal = MapRenderingTypes.getDefault().getAmenityTypeNameToTagVal(); AmenityType type = a.getType(); String tag = type.getDefaultTag(); @@ -362,8 +362,8 @@ public class EditingPOIActivity implements DialogProvider { } - public void commitNode(final OpenstreetmapUtil.Action action, final Node n, final EntityInfo info, final String comment, final Runnable successAction) { - if (info == null && OpenstreetmapUtil.Action.CREATE != action) { + public void commitNode(final OsmPoint.Action action, final Node n, final EntityInfo info, final String comment, final Runnable successAction) { + if (info == null && OsmPoint.Action.CREATE != action) { AccessibleToast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show(); return; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java index a26bb07e20..5c5b6e313f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/LocalOpenstreetmapActivity.java @@ -42,11 +42,13 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { private LocalOpenstreetmapAdapter listAdapter; - private OpenstreetmapsDbHelper db; + private OpenstreetmapsDbHelper dbpoi; + private OsmBugsDbHelper dbbug; - private OpenstreetmapRemoteUtil remote; + private OpenstreetmapRemoteUtil remotepoi; + private OsmBugsRemoteUtil remotebug; - protected OpenstreetmapPoint[] toUpload; + protected OsmPoint[] toUpload; @Override protected void onCreate(Bundle savedInstanceState) { @@ -71,9 +73,11 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { }); setListAdapter(listAdapter); - db = new OpenstreetmapsDbHelper(this); + dbpoi = new OpenstreetmapsDbHelper(this); + dbbug = new OsmBugsDbHelper(this); - remote = new OpenstreetmapRemoteUtil(this, this.getWindow().getDecorView()); + remotepoi = new OpenstreetmapRemoteUtil(this, this.getWindow().getDecorView()); + remotebug = new OsmBugsRemoteUtil(); findViewById(R.id.UploadAllButton).setOnClickListener(new View.OnClickListener() { @@ -81,7 +85,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { @Override public void onClick(View v) { //NOTE, the order of upload is important, there can be more edits per one POI!! - toUpload = listAdapter.values().toArray(new OpenstreetmapPoint[0]); + toUpload = listAdapter.values().toArray(new OsmPoint[0]); showDialog(DIALOG_PROGRESS_UPLOAD); } }); @@ -91,10 +95,14 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { protected void onResume() { super.onResume(); listAdapter.clear(); - List l = db.getOpenstreetmapPoints(); - android.util.Log.d(LogUtil.TAG, "List of POI " + l.size() + " length"); - for (OpenstreetmapPoint p : l) { - listAdapter.addOpenstreetmapPoint(p); + List l1 = dbpoi.getOpenstreetmapPoints(); + List l2 = dbbug.getOsmbugsPoints(); + android.util.Log.d(LogUtil.TAG, "List " + (l1.size() + l2.size()) + " length"); + for (OpenstreetmapPoint p : l1) { + listAdapter.addOsmPoint(p); + } + for (OsmbugsPoint p : l2) { + listAdapter.addOsmPoint(p); } listAdapter.notifyDataSetChanged(); } @@ -105,21 +113,25 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { int group = ExpandableListView.getPackedPositionGroup(packedPos); int child = ExpandableListView.getPackedPositionChild(packedPos); int itemId = item.getItemId(); - if(itemId == R.id.showpoi) { + if(itemId == R.id.showmod) { OsmandSettings settings = getMyApplication().getSettings(); - OpenstreetmapPoint info = (OpenstreetmapPoint) listAdapter.getChild(group, child); + OsmPoint info = (OsmPoint) listAdapter.getChild(group, child); settings.setMapLocationToShow(info.getLatitude(), info.getLongitude(), settings.getLastKnownMapZoom()); MapActivity.launchMapActivityMoveToTop(LocalOpenstreetmapActivity.this); return true; - } else if(itemId == R.id.deletepoimod) { - OpenstreetmapPoint info = (OpenstreetmapPoint) listAdapter.getChild(group, child); - db.deleteAllPOIModifications(info.getId()); + } else if(itemId == R.id.deletemod) { + OsmPoint info = (OsmPoint) listAdapter.getChild(group, child); + if (info.getGroup() == OsmPoint.Group.POI) { + dbpoi.deleteAllPOIModifications(info.getId()); + } else if (info.getGroup() == OsmPoint.Group.BUG) { + dbbug.deleteAllBugModifications(info.getId()); + } listAdapter.delete(info); return true; - } else if(itemId == R.id.uploadpoimods) { - List list = listAdapter.data.get(group); + } else if(itemId == R.id.uploadmods) { + List list = listAdapter.data.get(group); if (list != null) { - toUpload = list.toArray(new OpenstreetmapPoint[] {}); + toUpload = list.toArray(new OsmPoint[] {}); showDialog(DIALOG_PROGRESS_UPLOAD); return true; } @@ -131,8 +143,11 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { @Override protected void onDestroy() { super.onDestroy(); - if (db != null) { - db.close(); + if (dbpoi != null) { + dbpoi.close(); + } + if (dbbug != null) { + dbbug.close(); } } @@ -143,7 +158,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { return ProgressDialogImplementation.createProgressDialog( LocalOpenstreetmapActivity.this, getString(R.string.uploading), - getString(R.string.local_openstreetmap_uploading_poi), + getString(R.string.local_openstreetmap_uploading), ProgressDialog.STYLE_HORIZONTAL).getDialog(); } return null; @@ -153,45 +168,63 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { protected void onPrepareDialog(int id, Dialog dialog, Bundle args) { switch (id) { case DIALOG_PROGRESS_UPLOAD: - UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask((ProgressDialog) dialog, remote, - toUpload.length); + UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask((ProgressDialog) dialog, remotepoi, + remotebug, toUpload.length); uploadTask.execute(toUpload); break; } } - public class UploadOpenstreetmapPointAsyncTask extends AsyncTask { + public class UploadOpenstreetmapPointAsyncTask extends AsyncTask { private ProgressDialog progress; - private OpenstreetmapRemoteUtil remote; + private OpenstreetmapRemoteUtil remotepoi; + + private OsmBugsRemoteUtil remotebug; private int listSize = 0; private boolean interruptUploading = false; public UploadOpenstreetmapPointAsyncTask(ProgressDialog progress, - OpenstreetmapRemoteUtil remote, + OpenstreetmapRemoteUtil remotepoi, + OsmBugsRemoteUtil remotebug, int listSize) { this.progress = progress; - this.remote = remote; + this.remotepoi = remotepoi; + this.remotebug = remotebug; this.listSize = listSize; } @Override - protected Integer doInBackground(OpenstreetmapPoint... points) { + protected Integer doInBackground(OsmPoint... points) { int uploaded = 0; - for (OpenstreetmapPoint p : points) { + for (OsmPoint point : points) { if (interruptUploading) break; - EntityInfo entityInfo = null; - if (OpenstreetmapUtil.Action.CREATE != p.getAction()) { - entityInfo = remote.loadNode(p.getEntity()); - } - Node n; - if ((n = remote.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment())) != null) { - remote.updateNodeInIndexes(LocalOpenstreetmapActivity.this, p.getAction(), n, p.getEntity()); + if (point.getGroup() == OsmPoint.Group.POI) { + OpenstreetmapPoint p = (OpenstreetmapPoint) point; + EntityInfo entityInfo = null; + if (OsmPoint.Action.CREATE != p.getAction()) { + entityInfo = remotepoi.loadNode(p.getEntity()); + } + Node n; + if ((n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment())) != null) { + remotepoi.updateNodeInIndexes(LocalOpenstreetmapActivity.this, p.getAction(), n, p.getEntity()); + publishProgress(p); + uploaded++; + } + } else if (point.getGroup() == OsmPoint.Group.BUG) { + OsmbugsPoint p = (OsmbugsPoint) point; + if (p.getAction() == OsmPoint.Action.CREATE) { + remotebug.createNewBug(p.getLatitude(), p.getLongitude(), p.getText(), p.getAuthor()); + } else if (p.getAction() == OsmPoint.Action.MODIFY) { + remotebug.addingComment(p.getId(), p.getText(), p.getAuthor()); + } else if (p.getAction() == OsmPoint.Action.DELETE) { + remotebug.closingBug(p.getId()); + } publishProgress(p); uploaded++; } @@ -219,7 +252,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { protected void onPostExecute(Integer result) { listAdapter.notifyDataSetChanged(); if(result != null){ - AccessibleToast.makeText(LocalOpenstreetmapActivity.this, MessageFormat.format(getString(R.string.local_openstreetmap_poi_were_uploaded), result.intValue()), Toast.LENGTH_LONG).show(); + AccessibleToast.makeText(LocalOpenstreetmapActivity.this, MessageFormat.format(getString(R.string.local_openstreetmap_were_uploaded), result.intValue()), Toast.LENGTH_LONG).show(); } removeDialog(DIALOG_PROGRESS_UPLOAD); } @@ -229,7 +262,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { } @Override - protected void onProgressUpdate(OpenstreetmapPoint... points) { + protected void onProgressUpdate(OsmPoint... points) { listAdapter.delete(points[0]); progress.incrementProgressBy(1); } @@ -237,7 +270,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { } protected class LocalOpenstreetmapAdapter extends BaseExpandableListAdapter { - Map> data = new LinkedHashMap>(); + Map> data = new LinkedHashMap>(); List category = new ArrayList(); @@ -250,21 +283,26 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { notifyDataSetChanged(); } - public List values() { - List values = new ArrayList(); - for (List v : data.values()) { + public List values() { + List values = new ArrayList(); + for (List v : data.values()) { values.addAll(v); } return values; } - public void delete(OpenstreetmapPoint i) { + public void delete(OsmPoint i) { final AmenityIndexRepositoryOdb repo = getMyApplication().getResourceManager().getUpdatablePoiDb(); android.util.Log.d(LogUtil.TAG, "Delete " + i); - db.deleteOpenstreetmap(i); + + if (i.getGroup() == OsmPoint.Group.POI) { + dbpoi.deleteOpenstreetmap((OpenstreetmapPoint) i); + } else if (i.getGroup() == OsmPoint.Group.BUG) { + dbbug.deleteOsmbugs((OsmbugsPoint) i); + } Long c = i.getId(); if(c != null){ - List list = data.get(c); + List list = data.get(c); list.remove(i); if (list.isEmpty()) { data.remove(c); @@ -272,8 +310,11 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { } repo.deleteAmenities(i.getId() << 1); // We need to re-insert the POI if it is a delete or modify - for (OpenstreetmapPoint p : list) { - remote.updateNodeInIndexes(LocalOpenstreetmapActivity.this, p.getAction(), p.getEntity(), p.getEntity()); + for (OsmPoint point : list) { + if (point.getGroup() == OsmPoint.Group.POI) { + OpenstreetmapPoint p = (OpenstreetmapPoint) point; + remotepoi.updateNodeInIndexes(LocalOpenstreetmapActivity.this, p.getAction(), p.getEntity(), p.getEntity()); + } } repo.clearCache(); } @@ -284,7 +325,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { notifyDataSetChanged(); } - public void addOpenstreetmapPoint(OpenstreetmapPoint info) { + public void addOsmPoint(OsmPoint info) { int found = -1; // search from end for (int i = category.size() - 1; i >= 0; i--) { @@ -299,13 +340,13 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { category.add(info.getId()); } if (!data.containsKey(category.get(found))) { - data.put(category.get(found), new ArrayList()); + data.put(category.get(found), new ArrayList()); } data.get(category.get(found)).add(info); } @Override - public OpenstreetmapPoint getChild(int groupPosition, int childPosition) { + public OsmPoint getChild(int groupPosition, int childPosition) { Long cat = category.get(groupPosition); return data.get(cat).get(childPosition); } @@ -319,18 +360,21 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity { @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View v = convertView; - final OpenstreetmapPoint child = (OpenstreetmapPoint) getChild(groupPosition, childPosition); + final OsmPoint child = (OsmPoint) getChild(groupPosition, childPosition); if (v == null ) { LayoutInflater inflater = getLayoutInflater(); v = inflater.inflate(net.osmand.plus.R.layout.local_openstreetmap_list_item, parent, false); } TextView viewName = ((TextView) v.findViewById(R.id.local_openstreetmap_name)); - viewName.setText("(" + child.getSubtype() + ") " + child.getName()); - if (child.getAction() == OpenstreetmapUtil.Action.CREATE) { + if (child.getGroup() == OsmPoint.Group.POI) + viewName.setText("(" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName()); + else if (child.getGroup() == OsmPoint.Group.BUG) + viewName.setText("(" + ((OsmbugsPoint) child).getAuthor() + ") " + ((OsmbugsPoint) child).getText()); + if (child.getAction() == OsmPoint.Action.CREATE) { viewName.setTextColor(getResources().getColor(R.color.osm_create)); - } else if (child.getAction() == OpenstreetmapUtil.Action.MODIFY) { + } else if (child.getAction() == OsmPoint.Action.MODIFY) { viewName.setTextColor(getResources().getColor(R.color.osm_modify)); - } else if (child.getAction() == OpenstreetmapUtil.Action.DELETE) { + } else if (child.getAction() == OsmPoint.Action.DELETE) { viewName.setTextColor(getResources().getColor(R.color.osm_delete)); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index bf42e3e25d..7ecf412f73 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -37,7 +37,7 @@ public class OpenstreetmapLocalUtil extends AbstractOpenstreetmapUtil { } @Override - public Node commitNodeImpl(Action action, Node n, EntityInfo info, String comment){ + public Node commitNodeImpl(OsmPoint.Action action, Node n, EntityInfo info, String comment){ Node newNode = n; if (n.getId() == -1) { newNode = new Node(n,--nextid); //generate local id for the created node @@ -46,7 +46,7 @@ public class OpenstreetmapLocalUtil extends AbstractOpenstreetmapUtil { p.setEntity(newNode); p.setAction(action); p.setComment(comment); - if (p.getAction() == Action.DELETE && newNode.getId() < 0) { //if it is our local poi + if (p.getAction() == OsmPoint.Action.DELETE && newNode.getId() < 0) { //if it is our local poi db.deleteAllPOIModifications(p.getId()); } else { db.addOpenstreetmap(p); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java index e7870bec1c..4590eb4a56 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapPoint.java @@ -6,12 +6,10 @@ import net.osmand.data.AmenityType; import net.osmand.osm.Node; import net.osmand.osm.OSMSettings.OSMTagKey; -public class OpenstreetmapPoint implements Serializable { +public class OpenstreetmapPoint extends OsmPoint implements Serializable { private static final long serialVersionUID = 729654300829771467L; private Node entity; - private OpenstreetmapUtil.Action action; private String comment; - private boolean stored = false; public OpenstreetmapPoint(){ } @@ -51,6 +49,10 @@ public class OpenstreetmapPoint implements Serializable { return entity.getLongitude(); } + public Group getGroup() { + return Group.POI; + } + public String getOpeninghours() { String ret = entity.getTag(OSMTagKey.OPENING_HOURS.getValue()); if (ret == null) @@ -62,38 +64,18 @@ public class OpenstreetmapPoint implements Serializable { return entity; } - public OpenstreetmapUtil.Action getAction() { - return action; - } - public String getComment() { return comment; } - public boolean isStored() { - return stored; - } - public void setEntity(Node entity) { this.entity = entity; } - public void setAction(String action) { - this.action = OpenstreetmapRemoteUtil.actionString.get(action); - } - - public void setAction(OpenstreetmapUtil.Action action) { - this.action = action; - } - public void setComment(String comment) { this.comment = comment; } - public void setStored(boolean stored) { - this.stored = stored; - } - @Override public String toString() { return new StringBuffer("Openstreetmap Point ").append(this.getAction()).append(" ").append(this.getName()) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java index c031e6fa27..cbe69c89d9 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java @@ -14,7 +14,6 @@ import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.text.MessageFormat; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -61,18 +60,6 @@ public class OpenstreetmapRemoteUtil extends AbstractOpenstreetmapUtil { // private final static String SITE_API = "http://api06.dev.openstreetmap.org/"; private final static String SITE_API = "http://api.openstreetmap.org/"; //$NON-NLS-1$ - public static final Map stringAction = new HashMap(); - public static final Map actionString = new HashMap(); - static { - stringAction.put(Action.CREATE, "create"); - stringAction.put(Action.MODIFY, "modify"); - stringAction.put(Action.DELETE, "delete"); - - actionString.put("create", Action.CREATE); - actionString.put("modify", Action.MODIFY); - actionString.put("delete", Action.DELETE); - }; - private static final long NO_CHANGESET_ID = -1; private final Context ctx; @@ -336,7 +323,7 @@ public class OpenstreetmapRemoteUtil extends AbstractOpenstreetmapUtil { } @Override - public Node commitNodeImpl(Action action, final Node n, EntityInfo info, String comment){ + public Node commitNodeImpl(OsmPoint.Action action, final Node n, EntityInfo info, String comment){ if (isNewChangesetRequired()){ changeSetId = openChangeSet(comment); changeSetTimeStamp = System.currentTimeMillis(); @@ -355,11 +342,11 @@ public class OpenstreetmapRemoteUtil extends AbstractOpenstreetmapUtil { ser.startTag(null, "osmChange"); //$NON-NLS-1$ ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$ ser.attribute(null, "generator", Version.getAppName(ctx)); //$NON-NLS-1$ - ser.startTag(null, stringAction.get(action)); + ser.startTag(null, OsmPoint.stringAction.get(action)); ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$ ser.attribute(null, "generator", Version.getAppName(ctx)); //$NON-NLS-1$ writeNode(n, info, ser, changeSetId, settings.USER_NAME.get()); - ser.endTag(null, stringAction.get(action)); + ser.endTag(null, OsmPoint.stringAction.get(action)); ser.endTag(null, "osmChange"); //$NON-NLS-1$ ser.endDocument(); } catch (IOException e) { @@ -369,7 +356,7 @@ public class OpenstreetmapRemoteUtil extends AbstractOpenstreetmapUtil { writer.getBuffer().toString(), ctx.getString(R.string.commiting_node), true); log.debug(res+""); //$NON-NLS-1$ if (res != null) { - if (Action.CREATE == action) { + if (OsmPoint.Action.CREATE == action) { long newId = n.getId(); int i = res.indexOf("new_id=\""); //$NON-NLS-1$ if (i > 0) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java index 58162c8908..c05ff58c64 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapUtil.java @@ -7,13 +7,11 @@ import android.app.Activity; public interface OpenstreetmapUtil { - public static enum Action {CREATE, MODIFY, DELETE}; - public EntityInfo getEntityInfo(); - public Node commitNodeImpl(Action action, Node n, EntityInfo info, String comment); + public Node commitNodeImpl(OsmPoint.Action action, Node n, EntityInfo info, String comment); public Node loadNode(Amenity n); - public void updateNodeInIndexes(Activity ctx, OpenstreetmapUtil.Action action, Node n, Node oldNode); + public void updateNodeInIndexes(Activity ctx, OsmPoint.Action action, Node n, Node oldNode); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java index ec490534cf..c8be811c72 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapsDbHelper.java @@ -58,7 +58,7 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper { if (db != null) { db.execSQL("INSERT INTO " + OPENSTREETMAP_TABLE_NAME + " (" + OPENSTREETMAP_COL_ID + ", " + OPENSTREETMAP_COL_NAME + ", " + OPENSTREETMAP_COL_TYPE + ", " + OPENSTREETMAP_COL_SUBTYPE + ", " + OPENSTREETMAP_COL_LAT + "," + OPENSTREETMAP_COL_LON + "," + OPENSTREETMAP_COL_ACTION + "," + OPENSTREETMAP_COL_COMMENT + "," + OPENSTREETMAP_COL_OPENINGHOURS + ")" + - " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", new Object[] { p.getId(), p.getName(), p.getType(), p.getSubtype(), p.getLatitude(), p.getLongitude(), OpenstreetmapRemoteUtil.stringAction.get(p.getAction()), p.getComment(), p.getOpeninghours() }); //$NON-NLS-1$ //$NON-NLS-2$ + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", new Object[] { p.getId(), p.getName(), p.getType(), p.getSubtype(), p.getLatitude(), p.getLongitude(), OsmPoint.stringAction.get(p.getAction()), p.getComment(), p.getOpeninghours() }); //$NON-NLS-1$ //$NON-NLS-2$ cachedOpenstreetmapPoints.add(p); p.setStored(true); return true; @@ -80,7 +80,7 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper { OPENSTREETMAP_COL_ACTION + " = ? AND " + OPENSTREETMAP_COL_COMMENT + " = ? AND " + OPENSTREETMAP_COL_OPENINGHOURS + " = ?", - new Object[] { p.getId(), p.getName(), p.getType(), p.getSubtype(), p.getLatitude(), p.getLongitude(), OpenstreetmapRemoteUtil.stringAction.get(p.getAction()), p.getComment(), p.getOpeninghours() }); //$NON-NLS-1$ //$NON-NLS-2$ + new Object[] { p.getId(), p.getName(), p.getType(), p.getSubtype(), p.getLatitude(), p.getLongitude(), OsmPoint.stringAction.get(p.getAction()), p.getComment(), p.getOpeninghours() }); //$NON-NLS-1$ //$NON-NLS-2$ cachedOpenstreetmapPoints.remove(p); p.setStored(false); return true; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java index e71d00b9af..9f2cdaf848 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsDbHelper.java @@ -53,7 +53,7 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper { if (db != null) { db.execSQL("INSERT INTO " + OSMBUGS_TABLE_NAME + " (" + OSMBUGS_COL_ID + ", " + OSMBUGS_COL_TEXT + ", " + OSMBUGS_COL_LAT + "," + OSMBUGS_COL_LON + "," + OSMBUGS_COL_ACTION + "," + OSMBUGS_COL_AUTHOR + ")" + - " VALUES (?, ?, ?, ?, ?, ?)", new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmBugsRemoteUtil.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$ + " VALUES (?, ?, ?, ?, ?, ?)", new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmPoint.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$ cachedOsmbugsPoints.add(p); p.setStored(true); return true; @@ -72,7 +72,7 @@ public class OsmBugsDbHelper extends SQLiteOpenHelper { OSMBUGS_COL_LON + " = ? AND " + OSMBUGS_COL_ACTION + " = ? AND " + OSMBUGS_COL_AUTHOR + " = ?", - new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmBugsRemoteUtil.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$ + new Object[] { p.getId(), p.getText(), p.getLatitude(), p.getLongitude(), OsmPoint.stringAction.get(p.getAction()), p.getAuthor() }); //$NON-NLS-1$ //$NON-NLS-2$ cachedOsmbugsPoints.remove(p); p.setStored(false); return true; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java index 3fc0b32135..13fcd5d090 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLocalUtil.java @@ -24,7 +24,7 @@ public class OsmBugsLocalUtil implements OsmBugsUtil { p.setText(text); p.setLatitude(latitude); p.setLongitude(longitude); - p.setAction(OsmBugsUtil.Action.CREATE); + p.setAction(OsmPoint.Action.CREATE); p.setAuthor(authorName); return db.addOsmbugs(p); } @@ -33,7 +33,7 @@ public class OsmBugsLocalUtil implements OsmBugsUtil { OsmbugsPoint p = new OsmbugsPoint(); p.setId(id); p.setText(text); - p.setAction(OsmBugsUtil.Action.MODIFY); + p.setAction(OsmPoint.Action.MODIFY); p.setAuthor(authorName); return db.addOsmbugs(p); } @@ -41,7 +41,7 @@ public class OsmBugsLocalUtil implements OsmBugsUtil { public boolean closingBug(long id){ OsmbugsPoint p = new OsmbugsPoint(); p.setId(id); - p.setAction(OsmBugsUtil.Action.CLOSE); + p.setAction(OsmPoint.Action.DELETE); return db.addOsmbugs(p); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java index 882f64e9e5..7a05683ca5 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java @@ -6,8 +6,6 @@ import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; import net.osmand.LogUtil; @@ -19,18 +17,6 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil { private final static String SITE_API = "http://openstreetbugs.schokokeks.org/api/0.1/"; //$NON-NLS-1$ - public static final Map stringAction = new HashMap(); - public static final Map actionString = new HashMap(); - static { - stringAction.put(Action.CREATE, "create"); - stringAction.put(Action.MODIFY, "modify"); - stringAction.put(Action.CLOSE, "close"); - - actionString.put("create", Action.CREATE); - actionString.put("modify", Action.MODIFY); - actionString.put("close", Action.CLOSE); - }; - public boolean createNewBug(double latitude, double longitude, String text, String authorName){ StringBuilder b = new StringBuilder(); b.append(SITE_API).append("addPOIexec?"); //$NON-NLS-1$ diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmPoint.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmPoint.java new file mode 100644 index 0000000000..df0581de5f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmPoint.java @@ -0,0 +1,64 @@ +package net.osmand.plus.osmedit; + +import java.util.HashMap; +import java.util.Map; + +public abstract class OsmPoint { + private static final long serialVersionUID = 729654300829771469L; + + public static enum Group {BUG, POI}; + + public static enum Action {CREATE, MODIFY, DELETE}; + + public static final Map stringAction = new HashMap(); + public static final Map actionString = new HashMap(); + static { + stringAction.put(Action.CREATE, "create"); + stringAction.put(Action.MODIFY, "modify"); + stringAction.put(Action.DELETE, "delete"); + + actionString.put("create", Action.CREATE); + actionString.put("modify", Action.MODIFY); + actionString.put("delete", Action.DELETE); + }; + + private Action action; + private boolean stored = false; + + public OsmPoint(){ + } + + public abstract long getId(); + + public abstract double getLatitude(); + + public abstract double getLongitude(); + + public abstract Group getGroup(); + + public Action getAction() { + return action; + } + + public boolean isStored() { + return stored; + } + + public void setAction(String action) { + this.action = actionString.get(action); + } + + public void setAction(Action action) { + this.action = action; + } + + public void setStored(boolean stored) { + this.stored = stored; + } + + @Override + public String toString() { + return new StringBuffer("Osm Point ").append(this.getAction()).append(" ") + .toString(); + } +} diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java index 285a989394..14c36f5f61 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmbugsPoint.java @@ -2,16 +2,14 @@ package net.osmand.plus.osmedit; import java.io.Serializable; -public class OsmbugsPoint implements Serializable { +public class OsmbugsPoint extends OsmPoint implements Serializable { private static final long serialVersionUID = 729654300829771468L; private long id; private String text; private double latitude; private double longitude; - private OsmBugsUtil.Action action; private String author; - private boolean stored = false; public OsmbugsPoint(){ } @@ -32,18 +30,14 @@ public class OsmbugsPoint implements Serializable { return longitude; } - public OsmBugsUtil.Action getAction() { - return action; + public Group getGroup() { + return Group.BUG; } public String getAuthor() { return author; } - public boolean isStored() { - return stored; - } - public void setId(long id) { this.id = id; } @@ -60,22 +54,10 @@ public class OsmbugsPoint implements Serializable { this.longitude = longitude; } - public void setAction(String action) { - this.action = OsmBugsRemoteUtil.actionString.get(action); - } - - public void setAction(OsmBugsUtil.Action action) { - this.action = action; - } - public void setAuthor(String author) { this.author = author; } - public void setStored(boolean stored) { - this.stored = stored; - } - @Override public String toString() { return new StringBuffer("OsmBugs Point ").append(this.getAction()).append(" ").append(this.getText())