diff --git a/OsmAnd-java/src/main/java/com/jwetherell/openmap/common/MGRSPoint.java b/OsmAnd-java/src/main/java/com/jwetherell/openmap/common/MGRSPoint.java index 8cbb306b7e..6e99eec8b5 100644 --- a/OsmAnd-java/src/main/java/com/jwetherell/openmap/common/MGRSPoint.java +++ b/OsmAnd-java/src/main/java/com/jwetherell/openmap/common/MGRSPoint.java @@ -14,6 +14,10 @@ package com.jwetherell.openmap.common; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class MGRSPoint extends ZonedUTMPoint { /** @@ -104,6 +108,15 @@ public class MGRSPoint extends ZonedUTMPoint { * an UPPERCASE coordinate string is expected. */ protected void decode(String mgrsString) throws NumberFormatException { + if (mgrsString.contains(" ")) { + String[] parts = mgrsString.split(" "); + StringBuilder s = new StringBuilder(); + for (String i : parts) { + s.append(i); + } + mgrsString = s.toString(); + } + if (mgrsString == null || mgrsString.length() == 0) { throw new NumberFormatException("MGRSPoint coverting from nothing"); } @@ -633,6 +646,97 @@ public class MGRSPoint extends ZonedUTMPoint { return twoLetter; } + public String toFlavoredString() { + try { + List all = new ArrayList<>(); + for (int i = 0; i <= mgrs.length(); i++) { + if (Character.isAlphabetic(mgrs.charAt(i))){ + all.add(mgrs.substring(0,i+1)); + all.add(mgrs.substring(i+1,i+3)); + String remains = mgrs.substring(i+3); + all.add(remains.substring(0,remains.length()/2)); + all.add(remains.substring(remains.length()/2)); + break; + } + } + StringBuilder os = new StringBuilder(); + for(String part: all){ + if (os.length() > 0) os.append(" "); + os.append(part); + } + return os.toString(); + }catch (Exception e){ + return mgrs; + } + } + + public String toFlavoredString(int accuracy) { + try { + List all = new ArrayList<>(); + for (int i = 0; i <= mgrs.length(); i++) { + if (Character.isAlphabetic(mgrs.charAt(i))){ + all.add(mgrs.substring(0,i+1)); + all.add(mgrs.substring(i+1,i+3)); + String remains = mgrs.substring(i+3); + int easting = Integer.parseInt(remains.substring(0,remains.length()/2)); + int northing = Integer.parseInt(remains.substring(remains.length()/2)); + double resolution = Math.pow(10, getAccuracy() - accuracy); + long roundedEasting = Math.round(easting/resolution); + long roundedNorthing = Math.round(northing/resolution); + int eastShift = 0; + int northShift = 0; + if (roundedEasting == resolution*10){ + roundedEasting = 0L; + eastShift = 1; + } + if (roundedNorthing == resolution*10){ + roundedNorthing = 0L; + northShift = 1; + } + if (eastShift != 0 || northShift != 0){ + all.set(1, shiftChar(all.get(1), eastShift, northShift)); + String zero = ""; + } + + + all.add(String.format("%0" + accuracy + "d", roundedEasting)); + all.add(String.format("%0" + accuracy + "d", roundedNorthing)); + break; + } + } + StringBuilder os = new StringBuilder(); + for(String part: all){ + if (os.length() > 0) os.append(" "); + os.append(part); + } + return os.toString(); + }catch (Exception e){ + return toFlavoredString(); + } + } + + private static String shiftChar(String chars, int east, int north){ + ArrayList keys = new ArrayList( + Arrays.asList('A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z')); + StringBuilder s = new StringBuilder(); + if (east != 0){ + int idx = keys.indexOf(chars.charAt(0)); + idx += east; + if (idx >= keys.size()) idx -= keys.size(); + if (idx < 0) idx += keys.size(); + s.append(keys.get(idx)); + }else s.append(chars.charAt(0)); + if (north != 0){ + int idx = keys.indexOf(chars.charAt(1)); + idx += north; + if (idx >= keys.size()) idx -= keys.size(); + if (idx < 0) idx += keys.size(); + s.append(keys.get(idx)); + }else s.append(chars.charAt(1)); + return s.toString(); + } + + /** * {@inheritDoc} */ diff --git a/OsmAnd-java/src/main/java/net/osmand/LocationConvert.java b/OsmAnd-java/src/main/java/net/osmand/LocationConvert.java index 0f4ec96883..88eb471840 100644 --- a/OsmAnd-java/src/main/java/net/osmand/LocationConvert.java +++ b/OsmAnd-java/src/main/java/net/osmand/LocationConvert.java @@ -15,6 +15,7 @@ public class LocationConvert { public static final int FORMAT_SECONDS = 2; public static final int UTM_FORMAT = 3; public static final int OLC_FORMAT = 4; + public static final int MGRS_FORMAT = 5; private static final char DELIM = ':'; private static final char DELIMITER_DEGREES = '°'; private static final char DELIMITER_MINUTES = '′'; diff --git a/OsmAnd-java/src/main/java/net/osmand/util/LocationParser.java b/OsmAnd-java/src/main/java/net/osmand/util/LocationParser.java index 100c4f014d..efa4cdaf42 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/LocationParser.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/LocationParser.java @@ -3,6 +3,7 @@ package net.osmand.util; import com.google.openlocationcode.OpenLocationCode; import com.google.openlocationcode.OpenLocationCode.CodeArea; import com.jwetherell.openmap.common.LatLonPoint; +import com.jwetherell.openmap.common.MGRSPoint; import com.jwetherell.openmap.common.UTMPoint; import net.osmand.data.LatLon; @@ -111,7 +112,7 @@ public class LocationParser { return null; } // detect UTM - if (all.size() == 4 && d.size() == 3 && all.get(1) instanceof String) { + if (all.size() == 4 && d.size() == 3 && all.get(1) instanceof String && ((String) all.get(1)).length() == 1) { char ch = all.get(1).toString().charAt(0); if (Character.isLetter(ch)) { UTMPoint upoint = new UTMPoint(d.get(2), d.get(1), d.get(0).intValue(), ch); @@ -120,7 +121,7 @@ public class LocationParser { } } - if (all.size() == 3 && d.size() == 2 && all.get(1) instanceof String) { + if (all.size() == 3 && d.size() == 2 && all.get(1) instanceof String && ((String) all.get(1)).length() == 1) { char ch = all.get(1).toString().charAt(0); String combined = strings.get(2); if (Character.isLetter(ch)) { @@ -135,6 +136,17 @@ public class LocationParser { } } } + + //detect MGRS + if (all.size() >= 3 && (d.size() == 2 || d.size() == 3) && all.get(1) instanceof String) { + try { + MGRSPoint mgrsPoint = new MGRSPoint(locPhrase); + LatLonPoint ll = mgrsPoint.toLatLonPoint(); + return validateAndCreateLatLon(ll.getLatitude(), ll.getLongitude()); + } catch (NumberFormatException e) { + //do nothing + } + } // try to find split lat/lon position int jointNumbers = 0; int lastJoin = 0; diff --git a/OsmAnd-telegram/res/values-es/strings.xml b/OsmAnd-telegram/res/values-es/strings.xml index 63c0fcf19b..29442e4212 100644 --- a/OsmAnd-telegram/res/values-es/strings.xml +++ b/OsmAnd-telegram/res/values-es/strings.xml @@ -268,4 +268,8 @@ Última respuesta: hace %1$s hace %1$s ERR + Exportar + Búfer de Logcat + Selecciona y comparte logs detallados de la app + Enviar informe \ No newline at end of file diff --git a/OsmAnd-telegram/res/values-is/strings.xml b/OsmAnd-telegram/res/values-is/strings.xml new file mode 100644 index 0000000000..94bb15851c --- /dev/null +++ b/OsmAnd-telegram/res/values-is/strings.xml @@ -0,0 +1,211 @@ + + + Einingar og snið þeirra + Setja upp OsmAnd + Lykilorð + Meðalhæð + Fela + sendi (%1$d í biðminni) + Endursenda staðsetningu + Staðsetning… + Meðalhraði + Athugaðu og deildu nákvæmum atvikaskrám úr forritinu + Mílur/metrar + Lykilorð í Telegram + Deila staðsetningu sem + Deila staðsetningu + Sía: Stilltu lágmarksfjarlægð frá síðustu staðsetningu þar sem punktur er tekinn í skráningu + Til baka + Slökkt + Engin internettenging + Stilla tíma + Samþykkja + sek + %1$d mín + Mílur/fet + Vélmenni + Meðferð persónuupplýsinga í OsmAnd + Sendi staðsetningu + Tegund milliþjóns (proxy) + Breyta einingum sem notaðar eru við lengdarmælingar. + Staðsetningaferill + Merki OsmAnd + Gat ekki bætt við nýju tæki + Staða + Stillingar milliþjóns (proxy) + Gátt + Eftir nafni + Tímabelti + mín/km + m + Skráning staðsetningar virk + Tenging + Kílómetrar/metrar + Síðasta uppfærsla frá Telegram: Fyrir %1$s síðan + Vöktun er óvirk + Staða OsmAnd-rekjara + OsmAnd rekjari + Hópur + mín/ml + Netþjónn + Slökkva á öllu + Til baka í OsmAnd + Heiti tækis er of langt + Loka + %1$d klst %2$d mín + Mínútur á mílu + mín + Byrja + Vista + Landakort og texti + Lykilorð + %1$s bætt við. + Birta í OsmAnd + Síðasta tiltæka staðsetning + Sent + Auðkenningarkóði + Leita í tengiliðum + Opna OsmAnd + Endar + Settu inn auðkenningarkóða + Staðsetning mín + Skrá út + Birta á korti + Staða deilingar + Hætta við + Bíð eftir svari frá Telegram + Tókst að senda og uppfæra + Velja + Metrar á sekúndu + Heiti tækis + Velkomin + Hvernig það virkar + Stefna + Milliþjónn + Engin GPS-tenging + Senda staðsetningu sem + %1$d punktar + yd + Gera óvirkt + Tími á ferðinni + Sjómílur á klukkustund (hnútar) + %1$d klst + Lykill + Bakgrunnsvinna + Setja upp + Bæta við + Raða eftir + Síðasta svar: %1$s + Allt + Hæð + Birta GPS-punkta + Heiti tækis getur ekki verið tómt + Leita + Eftir vegalengd + Sjómílur + m/sek + Þú ert ekki skráð/ur inn + Ræsing + Lágmarksnákvæmni skráningar + Loka + Lágmarkshraði skráninga + OsmAnd rakningarþjónusta + Telegram + Kveikja á \"Staðsetning\"\? + Tengdur aðgangur + mi + Notandanafn + Heimild + Lengdareiningar + GPX-stillingar + Nýskráning í Telegram + Vegalengd + klst + km/klst + Skrá inn + Síðasta svar + Deila staðsetningu + ft + Nafn + %1$s síðan + Veldu notendur eða hópa til að deila með staðsetningu þinni. + Ég er ekki með Telegram-aðgang + Vöktun er virk + Rennur út + Gagnaleynd + Notandaaðgangur + Virkt + Nákvæmni + VILL + Ekki á ferð + Halda áfram + Staða + Upphafs — Endadagsetning + Aftengt + sml + Uppfæra + Settu inn lykilorð + Deila + Logcat biðminni + Settu inn símanúmer + Mínútur á kílómetra + Hætta + Útlit + Dagsetning + Síðar + Stefna + Hraðaeining + Landakort + Sía: Engin skráning punkta fyrir neðan þennan hraða + í %1$s + Leit: Hópur eða tengiliður + hnútar + km + Tímalína + Vistuð skilaboð + GPS-punktar + Virkja + Lágmarksfjarlægð skráninga + Síðasta uppfærsla frá Telegram + Safnað + Skrái út + Mílur/yardar + Veldu tíma sem á að birta + Auðkenni + Kílómetrar á klukkustund + Síðasta svar: Fyrir %1$s síðan + Tengist internetinu + Senda skýrslu + Flytja út + Mílur á klukkustund + Í lagi + Virkja + Persónuverndarstefna Telegram + Virkt spjall + Senda staðsetningu mína + Stungið upp á + Fara í stillingar + mi/klst + Deiling í bakgrunni + Deiling: %1$s + Síðasta uppfærsla frá Telegram: %1$s + Byrja + Raða + Engin gögn + Eftir hópi + Bæta við tæki + Texti + Stillingar + Birta notendur á kortinu + Tengt + Símanúmer + Upphafsdagsetning + Skilgreindu einingu fyrir hraða. + síðan + Settu inn kóða + Gera vöktun óvirka + Forritið hefur ekki heimildir til að nota staðsetningargögn. + Lokadagsetning + Bakgrunnshamur + OsmAnd-rakning keyrir í bakgrunni á meðan slökkt er á skjá. + \ No newline at end of file diff --git a/OsmAnd-telegram/res/values-it/strings.xml b/OsmAnd-telegram/res/values-it/strings.xml index 15986c05a0..04ca50389d 100644 --- a/OsmAnd-telegram/res/values-it/strings.xml +++ b/OsmAnd-telegram/res/values-it/strings.xml @@ -265,4 +265,5 @@ Ultima risposta: %1$s Ultimo aggiornamento da Telegram: %1$s ERR + Controlla e condividi i log dettagliati dell\'applicazione \ No newline at end of file diff --git a/OsmAnd-telegram/res/values-nl/strings.xml b/OsmAnd-telegram/res/values-nl/strings.xml index b77535908e..ebddf36454 100644 --- a/OsmAnd-telegram/res/values-nl/strings.xml +++ b/OsmAnd-telegram/res/values-nl/strings.xml @@ -257,4 +257,8 @@ Afstand eenheden Definieer de eenheid voor snelheid. Eenheid van snelheid + Stuur rapport + Exporteer naar OSM + Logcat buffer + Controleer en deel gedetailleerde logs van de app \ No newline at end of file diff --git a/OsmAnd-telegram/res/values-tzm/strings.xml b/OsmAnd-telegram/res/values-tzm/strings.xml new file mode 100644 index 0000000000..a6b3daec93 --- /dev/null +++ b/OsmAnd-telegram/res/values-tzm/strings.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/ic_action_logout.xml b/OsmAnd/res/drawable/ic_action_logout.xml new file mode 100644 index 0000000000..e1f0b60564 --- /dev/null +++ b/OsmAnd/res/drawable/ic_action_logout.xml @@ -0,0 +1,12 @@ + + + + diff --git a/OsmAnd/res/drawable/ic_action_openstreetmap_logo_colored.xml b/OsmAnd/res/drawable/ic_action_openstreetmap_logo_colored.xml new file mode 100644 index 0000000000..2d2472c970 --- /dev/null +++ b/OsmAnd/res/drawable/ic_action_openstreetmap_logo_colored.xml @@ -0,0 +1,14 @@ + + + + diff --git a/OsmAnd/res/drawable/ic_action_user_account.xml b/OsmAnd/res/drawable/ic_action_user_account.xml new file mode 100644 index 0000000000..51beae9b6e --- /dev/null +++ b/OsmAnd/res/drawable/ic_action_user_account.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/OsmAnd/res/layout/follow_track_options.xml b/OsmAnd/res/layout/follow_track_options.xml index 60c6a885b3..0877fcc307 100644 --- a/OsmAnd/res/layout/follow_track_options.xml +++ b/OsmAnd/res/layout/follow_track_options.xml @@ -55,6 +55,17 @@ android:textSize="@dimen/default_list_text_size" osmand:typeface="@string/font_roboto_medium" /> + + diff --git a/OsmAnd/res/layout/search_advanced_coords.xml b/OsmAnd/res/layout/search_advanced_coords.xml index 75b3ee5b4e..a93991c38b 100644 --- a/OsmAnd/res/layout/search_advanced_coords.xml +++ b/OsmAnd/res/layout/search_advanced_coords.xml @@ -324,6 +324,52 @@ + + + + + + + + + + + + + + + + + + + + + + + رسم بياني %2$s — %1$s فجوة + الخرائط المحلية + راحة + خاص + نقل + خدمة + الرموز + رياضة + الطوارئ + سفر \ No newline at end of file diff --git a/OsmAnd/res/values-bg/strings.xml b/OsmAnd/res/values-bg/strings.xml index f5c84b1d29..813e23367c 100644 --- a/OsmAnd/res/values-bg/strings.xml +++ b/OsmAnd/res/values-bg/strings.xml @@ -2170,4 +2170,21 @@ Възстановяване на всички настройки на профила\? Наистина ли искате да изчистите записаните данни\? Преизчисляване на маршрута в случай на отклонение + Успешно излязохте + Файлът вече е импортиран в OsmAnd + Използване на 2-стъпков A* рутиращ алгоритъм + Изчакайте преизчисляването на маршрута. +\nГрафиката ще бъде достъпна след преизчисляване. + Местни карти + %1$s — %2$s + Пропуск + Удобства + Специални + Транспорт + Услуги + Символи + Спорт + Аварийни служби + Пътуване + Изчистете маркера OAuth на OpenStreetMap \ No newline at end of file diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 697326c31c..559fb70a06 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -3224,8 +3224,10 @@ %1$s für die ersten %2$s Einstellungen für Profil: OsmAnd verwendet den UTM-Standard, der ähnlich, aber nicht identisch zum UTM-NATO-Format ist. + OsmAnd verwendet MGRS, das identisch zum UTM-NATO-Format ist. Beispiel UTM-Standard + MGRS Das gewählte Format wird in der gesamten App angewandt. Für Profile wird als Vorgabe diese Einstellung gewählt: %s Einstellung ändern @@ -3933,4 +3935,6 @@ Für das Schneemobilfahren mit speziellen Straßen und Tracks. Durchführen eines OAuth-Logins zur Nutzung der osmedit-Funktionen 2-Phasen-A*-Routing-Algorithmus verwenden + %1$s Daten sind nur auf den Straßen verfügbar, Sie müssen eine Route mit \"Route zwischen Punkten\" berechnen, um sie zu erhalten. + %1$s — %2$s \ No newline at end of file diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index ece67180a8..9e3cd983c5 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -3932,4 +3932,15 @@ Datumoj de %1$s estas disponeblaj nur por vojoj, vi devas kalkuli la kurson uzante “kalkuli kurson inter punktoj” por akiri ĝin. Atendado ĝis la kurso estos rekalkulita. \nDiagramo estos videbla post rekalkulado. + %1$s — %2$s + Manko + Lokaj mapoj + Oportunaĵo + Specialaj + Transporto + Servo + Simboloj + Sporto + Vivsavo + Vojaĝo \ No newline at end of file diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index 4a15cc5cdd..9f3c0b8803 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -3811,7 +3811,7 @@ Contrastado Primitivo Incorrecto - Señal para encontrar el poste + Conexión a Internet: clientes Nivel del agua: parcialmente sumergido Nivel del agua: sumergido Nivel de agua: seco @@ -3852,4 +3852,8 @@ Panal de abejas Frutos secos Gas natural licuado + Apartadero + Cobertizos + Azotea + Punto GPX \ No newline at end of file diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index 4da8d4966b..54e7d2a41b 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -3551,14 +3551,14 @@ Guardando el nuevo perfil No se pudo respaldar el perfil. ¿Borrar los datos registrados\? - Importación de datos de %1$s - Importación + Importando de datos de «%1$s» + Importando OsmAnd comprueba %1$s para ver si hay duplicados con los elementos existentes en la aplicación. \n \nPuede llevar algún tiempo. Elementos añadidos Importación completa - Todos los datos de %1$s son importados, puedes usar los botones de abajo para abrir la parte necesaria de la aplicación para manejarla. + Todos los datos de «%1$s» fueron importados. Puedes usar los botones de abajo para gestionar la sección necesaria de la aplicación. Min %1$s de %2$s Terreno @@ -3829,7 +3829,7 @@ Ruta inversa Recalcular sólo el siguiente segmento usando el perfil elegido. Recalcular toda la traza usando el perfil elegido. - Marca cómo conectar los puntos, con una línea recta o calcular una ruta entre ellos como se detalla a continuación. + Elige cómo conectar los puntos, con una línea recta o calcular una ruta entre ellos como se detalla a continuación. Traza completa Siguiente segmento A continuación, ajusta la traza al camino permitido más cercano con un perfil de navegación. @@ -3937,4 +3937,13 @@ Espera el recálculo de la ruta. \nEl gráfico estará disponible después del recálculo. %1$s — %2$s + Mapas locales + Comodidad + Especial + Transporte + Servicio + Símbolos + Deporte + Emergencia + Viaje \ No newline at end of file diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml index 3930c5b18f..2a0af4fbbf 100644 --- a/OsmAnd/res/values-et/strings.xml +++ b/OsmAnd/res/values-et/strings.xml @@ -3786,4 +3786,13 @@ OsmAnd andmed reaalajas Mootorsaanide sõitmine eraldi määratud teedel ja radadel. %1$s — %2$s + Eriteenused + Mugavus + Kohalikud kaardid + Reisimine + Hädaabi + Sport + Sümbolid + Teenused + Transport \ No newline at end of file diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 2a4458f148..18fd7f8009 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -3801,7 +3801,7 @@ Sélectionnez un fichier de trace à ouvrir. Terminé Remplacer la trace - Sélectionnez comment relier les points : par une ligne droite ou en calculant un itinéraire reliant les points comme indiqué ci-dessous. + Définissez comment relier les points : par une ligne droite ou en calculant un itinéraire avec le profil ci-dessous. Toute la trace sera recalculée en utilisant le profil sélectionné. Seul le prochain segment sera recalculé en utilisant le profil sélectionné. Ensuite, sélectionnez le profil de navigation pour détecter les routes autorisées et le seuil de distance afin de déplacer votre trace. @@ -3914,4 +3914,13 @@ Graphique Écart %1$s - %2$s + Cartes locales + Loisir + Spécial + Transport + Service + Symboles + Sport + Urgence + Voyage \ No newline at end of file diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 9ae52a9644..f3762a3fd1 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -3834,7 +3834,7 @@ Egyszerűsített nyomvonal Kész elmentve - Jelölje ki, hogyan legyenek összekötve a pontok: egyenes vonallal vagy az alábbiak szerint kiszámított útvonallal. + Válassza ki, hogyan legyenek összekötve a pontok: egyenes vonallal vagy az alábbiak szerint kiszámított útvonallal. Teljes nyomvonal Megjegyzés: Ha a GPS közvetlenül a felvétel előtt ki volt kapcsolva, akkor rosszabb lehet az első mért pont pontossága. A kódban ezért szeretnénk majd talán várni egy-két másodpercet egy pont rögzítése előtt (vagy a 3 egymást követő pont közül a legjobbat rögzíteni vagy valami hasonló), de ezt még nem programoztuk le. Cím törlése @@ -3926,4 +3926,13 @@ %1$s adatok csak az utakról állnak rendelkezésre. Használja az „Útvonal tervezése pontok között” funkciót. Várja meg az útvonal újraszámítását. \nAz ábra az újraszámítás után lesz látható. + Helyi térképek + Hasznos és fontos létesítmény + Különleges + Közlekedés + Szolgáltatás + Jelképek + Sport + Vészhelyzet + Utazás \ No newline at end of file diff --git a/OsmAnd/res/values-is/phrases.xml b/OsmAnd/res/values-is/phrases.xml index 07ff354d7e..564d5dfea5 100644 --- a/OsmAnd/res/values-is/phrases.xml +++ b/OsmAnd/res/values-is/phrases.xml @@ -3802,7 +3802,7 @@ Vatnsyfirborð: í kafi Vatnsyfirborð: að hluta í kafi Gróft - Merki til að finna staurinn + Internetaðgangur: viðskiptavinir Staða dælu: vantar bita Sog Undir þrýstingi @@ -3830,4 +3830,8 @@ LNG Brottfaratafla: nei Brottfaratafla + Meðfram götu + Skýli + Á þaki + GPX-punktur \ No newline at end of file diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index c5ce396f03..0682b0030e 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -106,15 +106,15 @@ Veldu flokk Hraðaeining sml - sjómílur - kílómetrar á klukkustund - mílur á klukkustund - metrar á sekúndu - mínútur á kílómetra - mínútur á mílu + Sjómílur + Kílómetrar á klukkustund + Mílur á klukkustund + Metrar á sekúndu + Mínútur á kílómetra + Mínútur á mílu Sjómílur á klukkustund (hnútar) hnútar - mín/m + mín/ml mín/km m/sek Leiðsögn @@ -238,7 +238,7 @@ Sýna allt Fella saman Birta á korti - Kort + Landakort Eftirlæti Eftirlæti Heimilisfang @@ -2109,7 +2109,7 @@ Nafnið inniheldur of marga hástafi. Viltu halda áfram? Tvítekið nafn á flýtiaðgerð Flokkur til að vista eftirlætisstað í: - Setja inn + Setja upp Ljósmyndir á netinu Engar myndir hér. Breyttu leitarorðum eða stækkaðu radíus leitarinnar. @@ -3777,7 +3777,7 @@ \n \nVeldu %2$s: öllum gögnum sem tengjast hraðamyndavélum; t.d. aðvaranir, tilkynningar, staðsetningar o.fl. verður eytt þar til OsmAnd er sett inn aftur frá grunni. Veldu ferilskrá þar sem nýjum bút verður bætt inn. - Veldu hvernig eigi að tengja punkta; með beinni línu eða reikna leið milli þeirra eins og tiltekið er hér að neðan. + Veldu hvernig eigi að tengja punktana; með beinni línu eða reikna leið milli þeirra eins og tiltekið er hér að neðan. Allur ferillinn verður endurreiknaður með völdu sniði. Lokaður OSM-minnispunktur Allur ferillinn @@ -3914,4 +3914,44 @@ Veldu millibil skráninga í almenna leiðarskráningu (virkjað með viðmótshlutanum fyrir GPX-skráningu á kortinu). Setja skráningu í bið Halda áfram með skráningu + • Uppfærðar aðgerðir í skipulagningu leiða: mismunandi leiðsögn á hverjum bút auk slóða +\n +\n • Ný útlitsvalmynd fyrir slóðir: val á lit, þykkt, birting stefnuörva, táknmynda við upphaf/endi +\n +\n • Bættur sýnileiki hjólreiðahnúta. +\n +\n • Hægt að ýta á slóðir, hafa samhengisvalmynd með grunnupplýsingum. +\n +\n • Bætt reiknirit leitar +\n +\n • Bættir valkostir fyrir \'Fylgja slóð\' í leiðsögn +\n +\n • Lagfærð vandamál við inn/útflutning á stillingum sniða +\n +\n + Bíddu eftir endurútreikningi leiðar. +\nGrafið verður tiltækt eftir endurútreikning. + Fyrir akstur vélsleða á sérstökum vegum og slóðum. + %1$s gögn aðeins tiltæk á vegunum, þú þarft að reikna leið með “Leið milli punkta” til að fá hana. + Skrá hefur þegar verið flutt inn í OsmAnd + Bil + Takk fyrir að kaupa \'Hæðarlínur\' + Áskriftargjaldið verður rukkað miðað við valið tímabil. Þú getur sagt áskriftinni upp hvenær sem er á AppGallery. + Nota 2-umferða A* leiðararútreikning + Greiðsla verður gjaldfærð á AppGallery reikninginn þinn við staðfestingu á kaupunum. +\n +\n Áskrift endurnýjast sjálfkrafa nema hún sé felld niður fyrir endurnýjunardag. Reikningur þinn verður einungis gjaldfærður fyrir endurnýjunartímabil (mánuður / þrír mánuðir / ár) á endurnýjunardegi. +\n +\n Þú getur stýrt og aflýst áskriftunum þínum með því að fara í AppGallery stillingarnar þínar. + Graf + %1$s — %2$s + Staðkort + Aðstaða + Sértákn + Samgöngur + Þjónusta + Tákn + Íþróttir + Neyðartilfelli + Ferðalög \ No newline at end of file diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 7b4c8ad764..e950feca34 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -3718,7 +3718,7 @@ Questi elementi sono nascosti dal menu, ma le opzioni rappresentate o i plugins continueranno a funzionare. Nascondere le opzioni le reimposta al loro valore originale. Azioni principali - Puoi accedere a queste azioni toccando il pulsante \"Azioni aggiuntive\". + Puoi accedere a queste azioni toccando il pulsante “%1$s”. Puoi spostare gli elementi solo all\'interno di questa categoria. Seleziona i linguaggi in cui gli articoli di Wikipedia appariranno sulla mappa. Puoi cambiare fra tutte le lingue disponibili mentre leggi questo articolo. Alcuni articoli di Wikipedia potrebbero non essere disponibili nella tua lingua. diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index 7334c5dbb9..c82e5e3b8d 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -3837,7 +3837,7 @@ נא לבחור קובץ מסלול שבו יתווסף המקטע החדש. כל המסלול יחושב מחדש באמצעות הפרופיל הנבחר. רק המקטע הבא יחושב מחודש באמצעות הפרופיל הנבחר. - נא לבחור כיצד לחבר נקודות, בקו ישר, או לחבר מסלול ביניהן כפי שצוין להלן. + נא לבחור כיצד לחבר את הנקודות, בקו ישר, או לחבר מסלול ביניהן כפי שצוין להלן. בשלב הבא עליך להצמיד את הדרך המורשית הקרובה ביותר לאחד מפרופילי הניווט שלך כדי להשתמש באפשרות הזו. תמונות ברמת רחוב להתעלם מהשינויים במסלול המתוכנן על ידי סגירתו\? @@ -3939,4 +3939,13 @@ נא להמתין לחישוב המסלול מחדש. \nהתרשים יהיה זמין לאחר החישוב מחדש. %1$s ‏— %2$s + מפות מקומיות + שירות לציבור + מיוחד + תחבורה + שירות + סמלים + ספורט + חירום + טיול \ No newline at end of file diff --git a/OsmAnd/res/values-ja/phrases.xml b/OsmAnd/res/values-ja/phrases.xml index 865fa35edc..3ddebc7b5a 100644 --- a/OsmAnd/res/values-ja/phrases.xml +++ b/OsmAnd/res/values-ja/phrases.xml @@ -990,7 +990,7 @@ ベトナム語 wiki ボラピュク語 wiki 中国語 wiki - 係船柱 + 自転車用車止め オートバイ用車止め ブロック @@ -1260,8 +1260,8 @@ 掃除機 ディーゼル排気用液(AdBlue・尿素水) ドライブスルー - 有り - 無し + + ドライブスルー: 不可 91UL 無鉛航空燃料 100LL 有鉛航空燃料 JET A-1ジェット燃料 @@ -1479,7 +1479,7 @@ 持ち帰り不可 テイクアウト・持ち帰りのみ 遺跡の種類 - 医療機関 + 専門分野 総合診療医 眼科 婦人科 @@ -1487,7 +1487,7 @@ 整形外科 耳鼻咽喉科 小児科 - 医療機関:小児科:無し + 専門分野:小児科:無し 皮膚科 泌尿器科 一般外科 @@ -1577,7 +1577,7 @@ スカイスポーツの対応要素 季節営業 ドライブイン - 無し + ドライブイン: 不可 有り ボーイスカウト用キャンプ 肯定 @@ -1710,7 +1710,7 @@ 南インドのタミル伝統医学 ユナニ医学・南アジアの伝統医学 医療事務 - 有り + 代替医療の専門種 往診 無し @@ -3835,4 +3835,8 @@ ギブボックス(提供品置場) 簡易給水栓 液化天然ガス + GPXポイント + 待避所 + 車庫 + 屋上 \ No newline at end of file diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml index 86695fc95d..c189909e5a 100644 --- a/OsmAnd/res/values-ja/strings.xml +++ b/OsmAnd/res/values-ja/strings.xml @@ -827,7 +827,7 @@ POIの更新は利用できません ヘルプ アクセシビリティモード アクセシビリティ(ユーザー補助)機能を設定します - ON + On OFF デバイス側のユーザー補助設定に従う メニューに戻る @@ -1547,7 +1547,7 @@ POIの更新は利用できません マップストレージ コピー OSMの編集を削除 - 無効化 + 無効 ログオフ 国境を越えて別の国に入るようなルート設定を避けます。 高さ制限 @@ -2754,7 +2754,7 @@ POIの更新は利用できません OSMメモ、POI、またはその両方用にエクスポートします。 全てのデータ OSMメモ - 明日開く + 明日以降の次の時間に営業 名無し • 一部の機種で起動時にクラッシュしていた問題を修正 \n @@ -2775,11 +2775,11 @@ POIの更新は利用できません 駐車上限時刻 時間制限なし 記事の全文を読む - 以下の場所から開く - 以下の所まで開く - 閉店時間 - 開店予定時間 - 営業予定時刻 + 次の時間から営業 + 次の時間まで営業 + 営業終了時間 + 営業開始時間 + 営業開始時間 マップマーカーを作成しよう! 通過した地点のマーカーと通過予定地点のマーカーがこの画面に表示されます。 @@ -2853,7 +2853,7 @@ POIの更新は利用できません %1$s を利用 道路種別 入れ替え - 詳細を見る + さらに表示 マップ上の経路 GPX経路の表示/非表示 マップ上にある選択したGPX経路の表示/非表示を切り替えるボタンです。 @@ -2898,7 +2898,7 @@ POIの更新は利用できません %1$.2f %2$s 支払い方法の選択: 寄付金はOSMの地図製作に役立てられます。 - 360°イメージのみ表示 + 360°画像のみを表示 編集 %1$s, 合計 %2$s mBTC 起動 グアラニー語 @@ -3048,9 +3048,9 @@ POIの更新は利用できません マップ上に低排出ゾーン(CO2排出量の多い車両に課税するエリア)を表示します。ルーティングには影響しません。 低排出ゾーンの表示 デフォルト - 出口: + 降車 %1$d回の乗り換え - 歩行 + 徒歩 ログの送信 %1$d個のファイルを移動しました。(%2$s) %1$d個のファイルをコピーしました。(%2$s) @@ -3106,12 +3106,12 @@ POIの更新は利用できません 開始時に表示するプロファイルの選択 カスタムプロファイルは標準のアプリケーションプロファイルを元に作成します。ウィジェットなどの表示設定や速度と距離の単位などの標準設定をプロファイルごとに定義可能です。これらは標準のアプリプロファイルを基本としており、今後それらと共に拡張される可能性があります: ナビゲーションタイプの選択 - 乗用車,トラック,オートバイ - マウンテンバイク、モペッド(ペダル付き原動機付自転車)、馬 - 徒歩,ハイキング,ランニング + 乗用車、トラック、オートバイ + マウンテンバイク、モペッド、馬 + 徒歩、ハイキング、ランニング 公共交通機関の種類 - エンジン付き船舶,漕ぎボート,帆船 - 航空機,グライダー + 船舶、漕ぎボート、帆船 + 航空機、グライダー ジオコーディング 直線 BRouter(オフライン) diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 85f13702a1..12e10abaef 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -628,7 +628,7 @@ Oversiktskart (verden) Skikart (verden) Kroatisk - Nettfrakoblet beregning av OsmAnd-rutesegment + Frakoblet beregning av OsmAnd-rutesegment Beregn OsmAnd-rute for første og siste rutesegment Statuslinje Foretrukket språk for påskrifter på kartet (hvis utilgjengelig brukes engelsk eller lokale navn). @@ -3694,7 +3694,7 @@ Egendefinert Retningspiler tonn - Rute mellom punkter + Rut mellom punkter Enduro-motorsykkel Skjermkontroll Bruk systemets skjermtidsavbrudd @@ -3706,7 +3706,7 @@ Snu rute Overskriv spor Hele sporet blir beregnet på nytt med den valgte profilen. - Velg hvordan punkter skal forbindes; med en rett linje, eller beregn en rute mellom dem som spesifisert nedenfor. + Velg hvordan punktene skal forbindes; med en rett linje, eller beregn en rute mellom dem som spesifisert nedenfor. Kun det neste segmentet blir beregnet på nytt med den valgte profilen. Hele sporet Neste segment @@ -3872,4 +3872,6 @@ \nGraf vil være tilgjengelig etter omberegning. %1$s — %2$s Graf + %1$s-data er tilgjengelig kun på veiene, du må beregne en rute med “Rut mellom punkter”. + Spor rute \ No newline at end of file diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 54c11b5a67..3c40568702 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -12,7 +12,7 @@ Kijkrichting Transparante widgets continu - Vectorkaarten worden vaak sneller weergegeven. Werkt niet op sommige apparaten. + Vectorkaarten worden vaak sneller weergegeven. Werkt niet op alle toestellen. Kies een stem en test door aankondigingen af te spelen: OsmAnd fout-opsporing en ontwikkeling Interne kaartgeneratie @@ -218,7 +218,7 @@ Taal niet ondersteund De gekozen taal wordt niet ondersteund door de geïnstalleerde Android TTS (tekst-naar-spraak) stemgenerator. De standaard TTS taal zal worden gebruikt. Zoek een andere TTS stemgenerator op de markt\? Ontbrekende gegevens - Geen gegevens voor de geselecteerde taal geïnstalleerd. Wil je naar de Play-store gaan om deze te installeren? + Geen gegevens voor de geselecteerde taal geïnstalleerd. Ga naar \"Play Store\" om deze te installeren\? Keer richting van GPX-track om Huidige bestemming gebruiken Volg de gehele track @@ -251,7 +251,7 @@ Fout bij offline zoeken. Zoek adres in de offline kaarten Systeem - App toon talen (OsmAnd dient opnieuw gestart). + App \"Toon talen\" (OsmAnd dient opnieuw gestart). Toon talen Wijzig de eenheid van afstand voor metingen. Afstand eenheden @@ -433,7 +433,7 @@ Naar signaal zoeken… Zoek bij het midden van de kaart Zoek dichtbij - Zelfde als apparaat-instelling + Zelfde als apparaatinstelling Portret Landschap Kaartscherm-oriëntatie @@ -636,13 +636,13 @@ Gebruik online kaarten (download en bewaar deze op SD-kaart). Online kaarten Configureer online of bewaarde kaarttegels. - Geeft toegang tot vele soorten online (zogenaamde tile of raster) kaarten, van vooraf gedefinieerde OSM tiles (zoals Mapnik) tot satellietbeelden en lagen voor speciale doeleinden zoals weerkaarten, klimaatkaarten, geologische kaarten, reliëfschaduwlagen, enz. + Geeft toegang tot vele soorten online (zogenaamde tile of raster) kaarten, van vooraf gedefinieerde OSM tiles (zoals Mapnik) tot satellietbeelden en lagen voor speciale doeleinden zoals weerkaarten, klimaatkaarten, geologische kaarten, reliëf schaduwlagen, enz. \n \nAl deze kaarten kunnen worden gebruikt als de hoofd(basis)kaart, of als een extra laag of een achtergrondlaag bij een andere basiskaart (zoals de normale offline kaarten van OsmAnd). Om een achtergrondlaag beter te kunnen zien, kunt u elementen van de OsmAnd vectorkaarten eenvoudig verbergen via het menu \'Kaart instellen\'. \n \nRasterkaarten zijn direct via online bronnen verkrijgbaar of kunnen voor offline gebruik gereedgemaakt worden (en handmatig gekopieerd naar de OsmAnd gegevensmap) als SQLite database door diverse hulpprogramma\'s van derden. Instellingen om tracking en navigatie te kunnen gebruiken met het scherm uit (schakelt de GPS periodiek in). - "Maakt de toegankelijkheidsopties van het toestel rechtstreeks beschikbaar in OsmAnd. Hiermee kan o.a. de spreeksnelheid van tekst-naar-spraak-stemmen aangepast worden, D-pad schermnavigatie geconfigureerd worden, een trackball gebruikt worden voor de zoomregeling, of het gebruiken van meldingen via tekst-naar-spraak, bijvoorbeeld het automatisch melden van de positie." + Maakt de toegankelijkheidsopties van het toestel rechtstreeks beschikbaar in OsmAnd. Hiermee kan o.a. de spreeksnelheid van tekst-naar-spraak stemmen aangepast worden, D-pad schermnavigatie geconfigureerd worden, een trackball gebruikt worden voor de zoomregeling, of het gebruiken van meldingen via tekst-naar-spraak, bijvoorbeeld het automatisch melden van de positie. Deze plug-in toont de instellingen voor ontwikkel- en debug-opties, zoals routetest en -simulatie, schermweergave-prestaties, en spraaksturing. Deze instellingen zijn bedoeld voor programmeurs die OsmAnd willen verbeteren en zijn niet nodig voor normaal gebruik. Plugins beheren Schakel plugins in voor speciale functies en extra instellingen. @@ -750,7 +750,7 @@ OsmAnd is een open-source navigatiesysteem met online en offline kaarten OsmAnd (OSM Automated Navigation Directions) \n -\n OsmAnd is een open-source navigatie-app die toegang geeft tot een grote variëteit aan wereldwijde OSM-gegevens. Alle kaartgegevens (vector- of rasterkaarten) kunnen in het telefoongeheugen worden opgeslagen voor offline gebruik. OsmAnd biedt ook zowel offline als online routeaanwijzingen, met stembegeleiding. +\nOsmAnd is een open-source navigatie-app die toegang geeft tot een grote variëteit aan wereldwijde OSM-gegevens. Alle kaartgegevens (vector- of rasterkaarten) kunnen in het telefoongeheugen worden opgeslagen voor offline gebruik. OsmAnd biedt ook zowel offline als online routeaanwijzingen, met stembegeleiding. \n \n Enkele van de belangrijkste mogelijkheden: \n - Volledig offline gebruik (gedownloade vector- of rasterkaarten worden opgeslagen op het apparaat) @@ -767,11 +767,9 @@ \n \n Beperkingen van deze gratis versie van OsmAnd: \n - Beperkt aantal kaartdownloads -\n - Geen toegang tot offline Wikipedia POI\'s. +\n - Geen toegang tot offline Wikipedia POI\'s \n -\n OsmAnd wordt actief ontwikkeld en ons project en de verdere vooruitgang ervan is afhankelijk van -\nfinanciële bijdragen om de ontwikkeling en testen van nieuwe functionaliteit te kunnen bekostigen. -\nWij verzoeken je om OsmAnd+ te kopen, of om een donatie over te maken via https://osmand.net. +\n OsmAnd wordt actief ontwikkeld en ons project en de verdere vooruitgang ervan is afhankelijk van financiële bijdragen om de ontwikkeling en testen van nieuwe functionaliteit te kunnen bekostigen. Wij verzoeken je om OsmAnd+ te kopen, of om een donatie over te maken via https://osmand.net. OsmAnd+ (OSM Automated Navigation Directions) \n \nOsmAnd+ is een open-source app voor navigatie die gebruikmaakt van de wereldwijde verzameling van OSM-gegevens. Alle kaartmateriaal (vector- en rasterkaarten) kunnen worden opgeslagen in het telefoongeheugen voor offline gebruik. De app biedt ook offline- en online-navigatie, met stembegeleiding. @@ -1283,7 +1281,7 @@ Widgets Linker Kolom Kaart instellen Binnen - Anonieme gebruikesr kunnen geen + Anonieme gebruikers kunnen geen: \n- groepen aanmaken; \n- groepen en apparaten synchroniseren met de server; \n- groepen en apparaten beheren in een eigen omgeving op de website. @@ -1437,7 +1435,7 @@ Start Stop Importeren - Export naar OSM + Exporteer naar OSM Meer… Meer acties Toon niet meer @@ -1532,7 +1530,7 @@ Hoogte van het voertuig Geef de hoogte die minimaal toegestaan moet zijn op de route. Slim opnieuw berekenen van routes - Herbereken alleen het begin van de route voor lange trajecten. + Herbereken alleen het begin van de route. Kan gebruikt worden voor lange trajecten. Verwijder OSM-wijziging Uitgeschakeld Kleuren naar Wandelroute-netwerk @@ -2285,10 +2283,10 @@ \n • Toon POIs (Points Of Interest) in uw omgeving \n • Draai de kaart in uw bewegingsrichting (of kompasrichting) \n • Toon uw positie en waar u naar kijkt -\n • Deel uw lokatie met vrienden +\n • Deel uw locatie met vrienden \n • Bewaar belangrijke plaatsen in ‘Favorieten’ \n • Toon namen in het Engels, de lokale taal, of fonetisch -\n • Toon extra online tiles, zoals een satellietfoto (van Bing), verschillende extra lagen zoals GPX-tracks voor navigatie e.d. met instelbare transparantie +\n • Toon extra online tegels, zoals een satellietfoto (van Bing), verschillende extra lagen zoals GPX-tracks voor navigatie e.d. met instelbare transparantie \n Skiën \nMet de OsmAnd Ski plug-in ziet u pistes met hun moeilijkheidsgraad, en extra informatie zoals liften en andere faciliteiten. @@ -2302,7 +2300,7 @@ \n • De kaart toont voetpaden en wandelpaden \n • Wikipedia kan je veel vertellen tijdens een stadswandeling, in je eigen taal \n • OV-haltes (tram, bus, trein, metro), inclusief lijnnummers, helpen je bij het reizen in een onbekende stad -\n • GPS-navigatie in voetgangermodus gebruikt voor het berekenen van de route voet- en wandelpaden +\n • GPS-navigatie in voetgangersmodus gebruikt voor het berekenen van de route voet- en wandelpaden \n • Upload en volg een GPX-route of neem er zelf één op en deel deze. \n Draag bij aan OpenStreetMap (OSM) @@ -2384,7 +2382,7 @@ \n • Kaart draaien in kompas- of bewegingsrichting \n • Bewaar belangrijke plaatsen in ‘Favorieten’. \n • Toon POI’s (points of interest) in de buurt -\n • Toon specifieke online tiles, satellietbeelden (van Bing), en extra lagen zoals GPX-tracks met rit-/routeinformatie e.d., met instelbare transparantie +\n • Toon specifieke online tegels, satellietbeelden (van Bing), en extra lagen zoals GPX-tracks met rit-/routeinformatie e.d., met instelbare transparantie \n • Toon plaatsnamen in het Engels, de lokale taal of fonetisch weergegeven \n Gebruik OSM- en Wikipedia-gegevens @@ -3235,7 +3233,7 @@ \'Freeride\' en \'Off-piste\' zijn officieuze routes en passages. Meestal onverzorgd en niet onderhouden, en niet \'s avonds gecontroleerd. Betreden op eigen risico. Verzamelde data Laatste OsmAnd uitvoering gecrasht. Help ons alstublieft OsmAnd te verbeteren door de foutmelding te delen. - Personal transporter + Persoonlijk transport Offroad WunderLINQ Wegtype @@ -3298,24 +3296,24 @@ Uitschakelen Nieuwe plug-in toegevoegd Segmenten samenvoegen - • App profiles: Create a custom profile for your own needs, with a custom icon and color -\n -\n • Nu aan te passen standaard en min / max snelheden voor elk profiel -\n -\n • Widget toegevoegd voor de huidige coördinaten -\n -\n • Opties toegevoegd om het kompas en een straalliniaal op de kaart te tonen -\n -\n • Fix background track logging -\n -\n • Improved background map downloads -\n -\n • \'Zet scherm aan\' optie is terug -\n -\n • Wikipedia taalkeuze aangepast -\n -\n • Vast kompasknop tijdens navigatie -\n + • App-profielen: maak een eigen profiel, met een aangepast pictogram en kleur +\n +\n • Nu aan te passen standaard en min / max snelheden voor elk profiel +\n +\n • Widget toegevoegd voor de huidige coördinaten +\n +\n • Opties toegevoegd om het kompas en een straalliniaal op de kaart te tonen +\n +\n • Trackregistratie op de achtergrond herstellen +\n +\n • Verbeterde downloads van achtergrondkaarten +\n +\n • \'Zet scherm aan\' optie is terug +\n +\n • Wikipedia taalkeuze aangepast +\n +\n • Vast kompasknop tijdens navigatie +\n \n • Andere fouten verholpen \n \n @@ -3336,7 +3334,7 @@ U kunt geen standaard OsmAnd profielen verwijderen, maar u kunt ze deactiveren (in het vorige scherm), of naar onderen verplaatsen. Wijzig profielen \'Navigatietype\' bepaalt hoe routes berekend worden. - Profiel aanzicht + Profiel weergave Icoon, kleur en naam Wijzig lijst met profielen Geselecteerd profiel @@ -3567,7 +3565,7 @@ Vervang een ander punt door dit punt. Toerskiën Sneeuwscooter - Aangepaste OsmAnd-plug-in + Aangepaste OsmAnd plug-in Elementen Wijzigingen toegepast op het \'%1$s\'-profiel. Kon niet lezen van \'%1$s\'. @@ -3579,7 +3577,7 @@ Alle talen Om Wikipedia-POI’s op de kaart te tonen zijn extra kaarten nodig. Selecteer de talen voor Wikipedia-artikelen op de kaart. Tijdens het lezen van het artikel kan omgeschakeld worden naar een andere beschikbare taal. - Sommige Wikipedia-artikelen zijn mogelijk niet beschikbaar in de eigen taal. + Sommige Wikipedia-artikelen zijn mogelijk niet beschikbaar in je eigen taal. Kantonees Minnanyu Yoruba @@ -3624,8 +3622,8 @@ App-profiel wijzigingen Wereldoverzichtskaart (gedetailleerd) Niet ondersteund type - Geef de voertuigbreedte op, er zijn mogelijk routebeperkingen voor brede voertuigen. - Geef de voertuighoogte op, er zijn mogelijk routebeperkingen voor hoge voertuigen. + Geef de voertuigbreedte op, er zijn mogelijk routebeperkingen voor te brede voertuigen. + Geef de voertuighoogte op, er zijn mogelijk routebeperkingen voor te hoge voertuigen. Geef het voertuiggewicht op, er zijn mogelijk routebeperkingen voor zwaar verkeer. OsmAnd GPX is corrupt, neem contact op met het support team voor verder onderzoek. Altijd @@ -3636,7 +3634,7 @@ Scherm aanzetten bij elke routeaanwijzing. Routeaanwijzingen Uitgeschakeld. De instelling ‘Timeout na wakker worden’ moet ingesteld zijn op ‘Scherm aanlaten’. - Door op de aan/uit-knop te drukken gaat het scherm aan met OsmAnd op de voorgrond van het vergrendelscherm. + Door op de aan/uit knop te drukken gaat het scherm aan met OsmAnd op de voorgrond van het vergrendelde scherm. Aan/uit-knop Nabijheidssensor Selecteer de schermtimeout na wakker worden. (Kies “%1$s” om geen timeout te gebruiken.) @@ -3682,7 +3680,7 @@ Kies hoe gedownloade rasterkaartsegmenten worden opgeslagen. Geen overeenkomende profielen gevonden. Time-out van het scherm - Inschakelen om het zoomniveau van de kaart in te stellen met de volumeknoppen. + Regel het zoomniveau, van de kaart, met de volumeknop op het apparaat. Gebruik volumeknoppen om in en uit te zoomen Verkrijg informatie over POIs uit Wikipedia. Het is je offline reisgidsje - schakel de Wikipedia-plug-in in en geniet van artikelen over de bezienswaardigheden in je omgeving. Geef de voertuiglengte op, er zijn mogelijk routebeperkingen voor lange voertuigen. @@ -3707,7 +3705,7 @@ Het toegevoegde punt zal niet zichtbaar zijn op de kaart, aangezien de geselecteerde groep verborgen is, je kan het vinden in \"%s\". Standaard Route tussen punten - "Vervolgens, zet uw track vast op de dichtstbijzijnde toegestane weg met een van uw navigatieprofielen om deze optie te gebruiken." + Vervolgens, zet uw track vast op de dichtstbijzijnde toegestane weg met een van uw navigatieprofielen om deze optie te gebruiken. %1$s gegevens alleen beschikbaar op de wegen, u moet een route berekenen met behulp van \"Route tussen punten\" om deze te krijgen. Selecteer hoe de punten verbonden worden, via een rechte lijn, of een route berekenen tussen de punten zoals hieronder aangegeven. Alleen het volgende segment wordt opnieuw berekend met het geselecteerde profiel. @@ -3744,7 +3742,7 @@ Alleen de routelijn wordt opgeslagen, de waypoints worden verwijderd. Bewaar Route omkeren - "Selecteer een track waaraan je een nieuw segment wil toevoegen." + Selecteer een track waaraan je een nieuw segment wil toevoegen. Selecteer een trackbestand om te openen. Weet u zeker dat u alle wijzigingen in de geplande route wilt annuleren door deze te sluiten\? Opsmukken voor @@ -3771,4 +3769,129 @@ Maak een nieuwe route Open een bestaande track Plan een route + Gebruik 2-fasen A* routeringsalgoritme + Grafiek + Wacht op de herberekening van de route. +\nDe grafiek is beschikbaar na herberekening. + %1$s — %2$s + Kies een trackbestand om te volgen of importeer het, vanaf uw apparaat. + Kloof + Op maat + Voer een OAuth-login uit om osm edit functies te gebruiken + "• Bijgewerkte app- en profielinstellingen: instellingen zijn nu gerangschikt op type. Elk profiel kan afzonderlijk worden aangepast. +\n +\n • Nieuw dialoogvenster voor het downloaden van kaarten waarin wordt voorgesteld een kaart te downloaden tijdens het browsen +\n +\n • Donkere thema-fixes +\n +\n • Verschillende routeringsproblemen over de hele wereld opgelost +\n +\n • Bijgewerkte basiskaart met meer gedetailleerd wegennet +\n +\n • Vaste overstroomde gebieden over de hele wereld +\n +\n • Skirouting: hoogteprofiel en routecomplexiteit toegevoegd aan de routedetails +\n +\n • Andere bugs opgelost +\n +\n" + "• Profielen: nu kunt u de volgorde wijzigen, het pictogram voor de kaart instellen, alle instellingen voor basisprofielen wijzigen en ze terugzetten naar de standaardinstellingen +\n +\n • Exitnummer toegevoegd in de navigatie +\n +\n • Herwerkte plug-in instellingen +\n +\n • Herwerkt instellingenscherm voor snelle toegang tot alle profielen +\n +\n • Optie toegevoegd om instellingen van een ander profiel te kopiëren +\n +\n • Mogelijkheid toegevoegd om een volgorde te wijzigen of POI-categorieën in Zoeken te verbergen +\n +\n • Correct uitgelijnde POI-pictogrammen op de kaart +\n +\n • Zonsondergang / zonsopganggegevens toegevoegd om de kaart te configureren +\n +\n • Thuis/werk-pictogrammen toegevoegd op de kaart +\n +\n • Ondersteuning toegevoegd voor meerdere regels beschrijving bij Instellingen +\n +\n • Correcte transliteratie toegevoegd aan de kaart van Japan +\n +\n • Antarctica-kaart toegevoegd +\n +\n" + Wat is er nieuw + Voor sneeuwscooter, rijden met speciale wegen en tracks. + Stel aantal werkdagen in om door te gaan + Selecteer het interval waarmee markeringen met afstand of tijd op de track worden weergegeven. + Selecteer de gewenste splitsingsoptie: op tijd of op afstand. + Vaste + Overschrijf track + Drempelafstand + Navigatieprofiel + In geval van een omgekeerde richting + Routes + Routes + Routes + Log track naar GPX-bestand + Volg route + Voeg trackbestanden toe + Voeg een trackwaypoint toe + Volg de track + Kies een trackbestand om te volgen + Selecteer een andere track + Navigeer vanaf mijn positie naar de track + Track starten + Dichtstbijzijnde punt + Aan wegen koppelen + Adres verwijderen + Adres ingeven + Adres ingeven + Bestandsnaam + %s trackbestanden geselecteerd + Zal trackregistratie onderbreken wanneer de app wordt uitgeschakeld (via recente apps). (OsmAnd-achtergrondindicatie verdwijnt uit de Android-berichtenbalk.) + Vorig segment + Alle voorgaande segmenten + Alleen het geselecteerde segment wordt opnieuw berekend met het geselecteerde profiel. + Alle voorgaande segmenten worden opnieuw berekend met het geselecteerde profiel. + Open opgeslagen track + wordt opgeslagen + Voeg ten minste twee punten toe. + Opnieuw doen + Laatst gewijzigd + Naam: A – Z + Naam: A – Z + Start/stop iconen + Bedankt voor het kopen van \'Contourlijnen\' + Abonnement berekend per geselecteerde periode. Annuleer het op elk moment op AppGallery. + De betaling wordt bij de bevestiging van de aankoop in rekening gebracht op uw AppGallery-account. +\n +\nHet abonnement wordt automatisch verlengd, tenzij het vóór de verlengingsdatum wordt opgezegd. Uw account wordt alleen op de verlengingsdatum in rekening gebracht voor de verlengingsperiode (maand / drie maanden / jaar). +\n +\nU kunt uw abonnementen beheren en annuleren door naar uw AppGallery-instellingen te gaan. + Vermijd voetpaden + Vermijd voetpaden + Ontwikkeling + OsmAnd Live gegevens + OsmAnd Live gegevens + Twee stappen routeberekening voor autonavigatie. + Eigen ontwikkeling van het openbaar vervoer + Schakel over naar Java (veilige) routeberekening voor het openbaar vervoer + Inloggen via OAuth + Wis OpenStreetMap OAuth-token + Uitloggen gelukt + Het bestand is al geïmporteerd in OsmAnd + Lokale kaarten + Aangenaam + Speciaal + Transport + Onderhoud + Symbolen + Sport + Noodtoestand + Reizen + Trackbestanden importeren of opnemen + Track waypoint toevoegen + Opslaan als trackbestand + Rec \ No newline at end of file diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml index 43ef613eb1..0d88da8148 100644 --- a/OsmAnd/res/values-pt-rBR/strings.xml +++ b/OsmAnd/res/values-pt-rBR/strings.xml @@ -3819,7 +3819,7 @@ Rota reversa A trilha inteira será recalculada usando o perfil selecionado. Apenas o próximo segmento será recalculado usando o perfil selecionado. - Selecione como conectar pontos, por uma linha reta, ou calcular uma rota entre eles conforme especificado abaixo. + Escolha como conectar os pontos, por uma linha reta, ou calcular uma rota entre eles conforme especificado abaixo. Trilha inteira Próximo segmento Para usar esta opção, OsmAnd precisa ajustar sua trilha para as estradas do mapa. @@ -3929,4 +3929,13 @@ Aguarde o recálculo da rota. \nO gráfico estará disponível após o recálculo. %1$s — %2$s + Mapas locais + Amenidade + Especial + Transporte + Serviço + Símbolos + Esporte + Emergência + Viagem \ No newline at end of file diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 7b0db11a82..36b7e66d59 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -3762,7 +3762,7 @@ Тип монастыря: монашество Магазин защиты и безопасности Горноспасательная станция - Сигнал для поиска полюса + Доступ в Интернет: клиенты Многоуровневые маршруты: нет Многоуровневые маршруты: есть Взрывной залп: вторая или более поздняя детонация залпового теста @@ -3833,4 +3833,6 @@ Магазин орехов Улей СПГ + Навесы + Точка GPX \ No newline at end of file diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 145cd10775..ef0b614441 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -3924,4 +3924,17 @@ Файл уже импортирован Дождитесь пересчёта маршрута. \nГрафик будет доступен после пересчёта. - + Разрыв + Сервис + Специальные + Для езды на снегоходах по выделенным дорогам и трассам. + Разработка + Местная карта + %1$s — %2$s + Удобства + Транспорт + Символы + Спорт + Экстренные службы + Путешествие + \ No newline at end of file diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index 8c9aa3a3ec..2245af22f2 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -3932,4 +3932,11 @@ Iseta su càrculu nou de s\'àndala. \nSu gràficu at a èssere a disponimentu a pustis de su càrculu. %1$s — %2$s + Apretu/Emergèntzia + Ispetziales + Trasportu + Servìtziu + Sìmbulos + Isport + Biàgiu \ No newline at end of file diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 9f57bcf8fd..1ae947c024 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -3935,4 +3935,13 @@ \nGraf bude dostupný po prepočte. %1$s — %2$s Medzera + Lokálne mapy + Občianska vybavenosť + Špeciálne + Doprava + Služby + Symboly + Šport + Núdzová situácia/Záchrana + Cestovanie \ No newline at end of file diff --git a/OsmAnd/res/values-tzm/phrases.xml b/OsmAnd/res/values-tzm/phrases.xml new file mode 100644 index 0000000000..a6b3daec93 --- /dev/null +++ b/OsmAnd/res/values-tzm/phrases.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index aec06b50db..f75ae53dfc 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -3931,4 +3931,13 @@ \nГрафік буде доступний після переобчислення. Розрив %1$s — %2$s + Місцеві мапи + Зручності + Спеціальні + Транспорт + Послуги + Знаки + Спорт + Аварійні служби + Мандрівка \ No newline at end of file diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index e01741d9c3..980ed0c113 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -3821,7 +3821,7 @@ 反向路線 整個軌跡都會使用選定的設定檔重新計算。 僅下一個片段會使用選定的設定檔重新計算。 - 選取如何連接點,透過直線或以下面選定的方法計算其間的路徑。 + 選擇如何連接點,透過直線或以下面選定的方法計算其間的路徑。 整個軌道 下一段 接下來,使用您其中一個導航設定檔來將路線貼齊到最近可用的道路上以使用此選項。 @@ -3930,4 +3930,13 @@ \n重新計算後即可使用圖表。 %1$s — %2$s 分隔 + 本機地圖 + 便利設施 + 特殊 + 運輸 + 服務 + 符號 + 運動 + 警急 + 旅行 \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index d5287d60bb..7861393b31 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -628,8 +628,10 @@ Configure profile Settings for profile: OsmAnd uses the UTM Standard, which is similar but not identical to the UTM NATO format. + OsmAnd uses MGRS, which is similar to the UTM NATO format. Example UTM Standard + MGRS Open Location Code The selected format will be applied throughout the app. This setting is selected by default for profiles: %s @@ -2209,6 +2211,7 @@ Map language Transport stops Zone + MGRS Open Location Code Invalid OLC\n diff --git a/OsmAnd/res/xml/coordinates_format.xml b/OsmAnd/res/xml/coordinates_format.xml index 083f42182b..6f2635e71f 100644 --- a/OsmAnd/res/xml/coordinates_format.xml +++ b/OsmAnd/res/xml/coordinates_format.xml @@ -27,6 +27,12 @@ android:persistent="false" android:title="@string/navigate_point_format_utm" /> + + points = new ArrayList<>(); + public FavoriteGroup() { + } + + public FavoriteGroup(String name, boolean visible, int color) { + this.name = name; + this.visible = visible; + this.color = color; + } + + public FavoriteGroup(String name, List points, int color, boolean visible) { + this.name = name; + this.color = color; + this.points = points; + this.visible = visible; + } + public boolean isPersonal() { return isPersonal(name); } @@ -640,7 +656,7 @@ public class FavouritesDbHelper { return asGpxFile(cachedFavoritePoints); } - private GPXFile asGpxFile(List favoritePoints) { + public GPXFile asGpxFile(List favoritePoints) { GPXFile gpx = new GPXFile(Version.getFullVersion(context)); for (FavouritePoint p : favoritePoints) { context.getSelectedGpxHelper().addPoint(p.toWpt(context), gpx); diff --git a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java index b58b3eba5e..f9d3315bf5 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.text.format.DateUtils; import com.jwetherell.openmap.common.LatLonPoint; +import com.jwetherell.openmap.common.MGRSPoint; import com.jwetherell.openmap.common.UTMPoint; import net.osmand.LocationConvert; @@ -53,6 +54,7 @@ public class OsmAndFormatter { public static final int FORMAT_SECONDS = LocationConvert.FORMAT_SECONDS; public static final int UTM_FORMAT = LocationConvert.UTM_FORMAT; public static final int OLC_FORMAT = LocationConvert.OLC_FORMAT; + public static final int MGRS_FORMAT = LocationConvert.MGRS_FORMAT; private static final char DELIMITER_DEGREES = '°'; private static final char DELIMITER_MINUTES = '′'; private static final char DELIMITER_SECONDS = '″'; @@ -518,6 +520,9 @@ public class OsmAndFormatter { r = "0, 0"; } result.append(r); + } else if (outputFormat == MGRS_FORMAT) { + MGRSPoint pnt = new MGRSPoint(new LatLonPoint(lat, lon)); + result.append(pnt.toFlavoredString(5)); } return result.toString(); } diff --git a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java index b3d7ceb144..da9af5dca9 100644 --- a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java +++ b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java @@ -509,26 +509,27 @@ public class SQLiteTileSource implements ITileSource { if(db == null || coordinatesZoom > 25 ){ return null; } - SQLiteCursor q ; + SQLiteCursor cursor ; if (inversiveZoom) { int minZoom = (17 - minZ) + 1; // 17 - z = zoom, x << (25 - zoom) = 25th x tile = 8 + z, - q = db.rawQuery("SELECT max(x << (8+z)), min(x << (8+z)), max(y << (8+z)), min(y << (8+z))" + + cursor = db.rawQuery("SELECT max(x << (8+z)), min(x << (8+z)), max(y << (8+z)), min(y << (8+z))" + " from tiles where z < " + minZoom, new String[0]); } else { - q = db.rawQuery("SELECT max(x << (25-z)), min(x << (25-z)), max(y << (25-z)), min(y << (25-z))" + cursor = db.rawQuery("SELECT max(x << (25-z)), min(x << (25-z)), max(y << (25-z)), min(y << (25-z))" + " from tiles where z > " + minZ, new String[0]); } - q.moveToFirst(); - int right = (int) (q.getInt(0) >> (25 - coordinatesZoom)); - int left = (int) (q.getInt(1) >> (25 - coordinatesZoom)); - int top = (int) (q.getInt(3) >> (25 - coordinatesZoom)); - int bottom = (int) (q.getInt(2) >> (25 - coordinatesZoom)); + cursor.moveToFirst(); + int right = (int) (cursor.getInt(0) >> (25 - coordinatesZoom)); + int left = (int) (cursor.getInt(1) >> (25 - coordinatesZoom)); + int top = (int) (cursor.getInt(3) >> (25 - coordinatesZoom)); + int bottom = (int) (cursor.getInt(2) >> (25 - coordinatesZoom)); + + cursor.close(); + return new QuadRect(left, top, right, bottom); - - } public void deleteImage(int x, int y, int zoom) { diff --git a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java index 0d88642e4b..7b0ca4c17c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java @@ -21,6 +21,7 @@ import android.widget.TextView; import androidx.fragment.app.Fragment; import com.jwetherell.openmap.common.LatLonPoint; +import com.jwetherell.openmap.common.MGRSPoint; import com.jwetherell.openmap.common.UTMPoint; import net.osmand.LocationConvert; @@ -70,8 +71,8 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi } currentFormat = app.getSettings().COORDINATES_FORMAT.get(); initUI(location.getLatitude(), location.getLongitude()); - if(savedInstanceState != null && savedInstanceState.containsKey(SEARCH_LAT) && savedInstanceState.containsKey(SEARCH_LON) && - currentFormat != PointDescription.UTM_FORMAT) { + if(savedInstanceState != null && savedInstanceState.containsKey(SEARCH_LAT) && savedInstanceState.containsKey(SEARCH_LON) && + currentFormat != PointDescription.UTM_FORMAT && currentFormat != PointDescription.MGRS_FORMAT) { String lat = savedInstanceState.getString(SEARCH_LAT); String lon = savedInstanceState.getString(SEARCH_LON); if(lat != null && lon != null && lat.length() > 0 && lon.length() > 0) { @@ -152,23 +153,52 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi protected void showCurrentFormat(LatLon l) { final EditText latEdit = ((EditText)view.findViewById(R.id.LatitudeEdit)); final EditText lonEdit = ((EditText)view.findViewById(R.id.LongitudeEdit)); - boolean utm = currentFormat == PointDescription.UTM_FORMAT; - view.findViewById(R.id.easting_row).setVisibility(utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.northing_row).setVisibility(utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.zone_row).setVisibility(utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.lat_row).setVisibility(!utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.lon_row).setVisibility(!utm ? View.VISIBLE : View.GONE); - if(currentFormat == PointDescription.UTM_FORMAT) { - final EditText northingEdit = ((EditText)view.findViewById(R.id.NorthingEdit)); - final EditText eastingEdit = ((EditText)view.findViewById(R.id.EastingEdit)); - final EditText zoneEdit = ((EditText)view.findViewById(R.id.ZoneEdit)); - UTMPoint pnt = new UTMPoint(new LatLonPoint(l.getLatitude(), l.getLongitude())); - zoneEdit.setText(pnt.zone_number + ""+pnt.zone_letter); - northingEdit.setText(((long)pnt.northing)+""); - eastingEdit.setText(((long)pnt.easting)+""); - } else { - latEdit.setText(LocationConvert.convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat)); - lonEdit.setText(LocationConvert.convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat)); + switch (currentFormat){ + case PointDescription.UTM_FORMAT: { + view.findViewById(R.id.easting_row).setVisibility(View.VISIBLE); + view.findViewById(R.id.northing_row).setVisibility(View.VISIBLE); + view.findViewById(R.id.zone_row).setVisibility(View.VISIBLE); + view.findViewById(R.id.lat_row).setVisibility(View.GONE); + view.findViewById(R.id.lon_row).setVisibility(View.GONE); + view.findViewById(R.id.mgrs_row).setVisibility(View.GONE); + + final EditText northingEdit = ((EditText) view.findViewById(R.id.NorthingEdit)); + final EditText eastingEdit = ((EditText) view.findViewById(R.id.EastingEdit)); + final EditText zoneEdit = ((EditText) view.findViewById(R.id.ZoneEdit)); + UTMPoint pnt = new UTMPoint(new LatLonPoint(l.getLatitude(), l.getLongitude())); + zoneEdit.setText(pnt.zone_number + "" + pnt.zone_letter); + northingEdit.setText(((long) pnt.northing) + ""); + eastingEdit.setText(((long) pnt.easting) + ""); + break; + } + + case PointDescription.MGRS_FORMAT: { + view.findViewById(R.id.easting_row).setVisibility(View.GONE); + view.findViewById(R.id.northing_row).setVisibility(View.GONE); + view.findViewById(R.id.zone_row).setVisibility(View.GONE); + view.findViewById(R.id.lat_row).setVisibility(View.GONE); + view.findViewById(R.id.lon_row).setVisibility(View.GONE); + view.findViewById(R.id.mgrs_row).setVisibility(View.VISIBLE); + + final EditText mgrsEdit = ((EditText) view.findViewById(R.id.MGRSEdit)); + MGRSPoint pnt = new MGRSPoint(new LatLonPoint(l.getLatitude(), l.getLongitude())); + mgrsEdit.setText(pnt.toFlavoredString(5)); + break; + } + + default: { + view.findViewById(R.id.easting_row).setVisibility(View.GONE); + view.findViewById(R.id.northing_row).setVisibility(View.GONE); + view.findViewById(R.id.zone_row).setVisibility(View.GONE); + view.findViewById(R.id.lat_row).setVisibility(View.VISIBLE); + view.findViewById(R.id.lon_row).setVisibility(View.VISIBLE); + view.findViewById(R.id.mgrs_row).setVisibility(View.GONE); + + + latEdit.setText(LocationConvert.convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat)); + lonEdit.setText(LocationConvert.convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat)); + } + } } @@ -199,6 +229,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_MINUTES), PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_SECONDS), PointDescription.formatToHumanString(this.getContext(), PointDescription.UTM_FORMAT), + PointDescription.formatToHumanString(this.getContext(), PointDescription.MGRS_FORMAT), }); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); format.setAdapter(adapter); @@ -217,6 +248,8 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi newFormat = PointDescription.FORMAT_SECONDS; } else if (PointDescription.formatToHumanString(NavigatePointFragment.this.getContext(), PointDescription.UTM_FORMAT).equals(itm)) { newFormat = PointDescription.UTM_FORMAT; + } else if (PointDescription.formatToHumanString(NavigatePointFragment.this.getContext(), PointDescription.MGRS_FORMAT).equals(itm)) { + newFormat = PointDescription.MGRS_FORMAT; } try { LatLon loc = parseLocation(); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index c28b110c85..b8d4ef0c92 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -44,6 +44,7 @@ import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.Location; import net.osmand.PlatformUtil; +import net.osmand.StateChangedListener; import net.osmand.data.DataTileManager; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; @@ -158,7 +159,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public static final int AV_CAMERA_FOCUS_CONTINUOUS = 5; // photo shot: private static int shotId = 0; - private SoundPool sp = null; + private SoundPool soundPool = null; public static final int FULL_SCEEN_RESULT_DELAY_MS = 3000; public final CommonPreference AV_CAMERA_PICTURE_SIZE; @@ -596,6 +597,17 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public boolean init(@NonNull final OsmandApplication app, Activity activity) { + if (AV_PHOTO_PLAY_SOUND.get()) { + loadCameraSound(); + } + AV_PHOTO_PLAY_SOUND.addListener(new StateChangedListener() { + @Override + public void stateChanged(Boolean change) { + if (AV_PHOTO_PLAY_SOUND.get() && soundPool == null) { + loadCameraSound(); + } + } + }); // initializeRemoteControlRegistrationMethods(); // AudioManager am = (AudioManager) app.getSystemService(Context.AUDIO_SERVICE); // if (am != null) { @@ -604,6 +616,21 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { return true; } + private void loadCameraSound() { + if (soundPool == null) { + soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); + } + if (shotId == 0) { + try { + AssetFileDescriptor assetFileDescriptor = app.getAssets().openFd("sounds/camera_click.ogg"); + shotId = soundPool.load(assetFileDescriptor, 1); + assetFileDescriptor.close(); + } catch (Exception e) { + log.error("cannot get shotId for sounds/camera_click.ogg"); + } + } + } + @Override public void registerLayers(MapActivity activity) { this.mapActivity = activity; @@ -1338,21 +1365,6 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public void surfaceCreated(SurfaceHolder holder) { try { - // load sound befor shot - if (AV_PHOTO_PLAY_SOUND.get()) { - if (sp == null) - sp = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); - if (shotId == 0) { - try { - AssetFileDescriptor assetFileDescriptor = app.getAssets().openFd("sounds/camera_click.ogg"); - shotId = sp.load(assetFileDescriptor, 1); - assetFileDescriptor.close(); - } catch (Exception e) { - log.error("cannot get shotId for sounds/camera_click.ogg"); - } - } - } - Parameters parameters = cam.getParameters(); parameters.setPictureSize(selectedCamPicSize.width, selectedCamPicSize.height); log.debug("takePhotoWithCamera() set Picture size: width=" + selectedCamPicSize.width @@ -1734,6 +1746,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public void disable(OsmandApplication app) { + if (soundPool != null) { + soundPool.release(); + soundPool = null; + shotId = 0; + } // AudioManager am = (AudioManager) app.getSystemService(Context.AUDIO_SERVICE); // if (am != null) { // unregisterMediaListener(am); @@ -2043,8 +2060,8 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { photoJpegData = data; if (AV_PHOTO_PLAY_SOUND.get()) { - if (sp != null && shotId != 0) { - sp.play(shotId, 0.7f, 0.7f, 0, 0, 1); + if (soundPool != null && shotId != 0) { + soundPool.play(shotId, 0.7f, 0.7f, 0, 0, 1); } } diff --git a/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java b/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java index 541300a7ec..16fb083f13 100644 --- a/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java @@ -650,8 +650,8 @@ public class ImportHelper { } } - protected static List asFavourites(OsmandApplication app, List wptPts, String fileName, boolean forceImportFavourites) { - final List favourites = new ArrayList<>(); + public static List asFavourites(OsmandApplication app, List wptPts, String fileName, boolean forceImportFavourites) { + List favourites = new ArrayList<>(); for (WptPt p : wptPts) { if (p.name != null) { final String fpCat; @@ -664,18 +664,18 @@ public class ImportHelper { } else { fpCat = p.category; } - final FavouritePoint fp = new FavouritePoint(p.lat, p.lon, p.name, fpCat); + FavouritePoint point = new FavouritePoint(p.lat, p.lon, p.name, fpCat); if (p.desc != null) { - fp.setDescription(p.desc); + point.setDescription(p.desc); } - fp.setAddress(p.getExtensionsToRead().get("address")); - fp.setColor(p.getColor(0)); + point.setAddress(p.getExtensionsToRead().get("address")); + point.setColor(p.getColor(0)); String iconName = p.getIconName(); if (iconName != null) { - fp.setIconIdFromName(app, iconName); + point.setIconIdFromName(app, iconName); } - fp.setBackgroundType(BackgroundType.getByTypeName(p.getBackgroundType(), DEFAULT_BACKGROUND_TYPE)); - favourites.add(fp); + point.setBackgroundType(BackgroundType.getByTypeName(p.getBackgroundType(), DEFAULT_BACKGROUND_TYPE)); + favourites.add(point); } } return favourites; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 00d0a8cc20..e18beeeb01 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -676,9 +676,15 @@ public class MenuBuilder { LinearLayout llv = buildCollapsableContentView(mapActivity, true, true); for (final Map.Entry line : locationData.entrySet()) { final TextViewEx button = buildButtonInCollapsableView(mapActivity, false, false); - if (line.getKey() == OsmAndFormatter.UTM_FORMAT || line.getKey() == OsmAndFormatter.OLC_FORMAT) { + if (line.getKey() == OsmAndFormatter.UTM_FORMAT || line.getKey() == OsmAndFormatter.OLC_FORMAT || line.getKey() == OsmAndFormatter.MGRS_FORMAT) { SpannableStringBuilder ssb = new SpannableStringBuilder(); - ssb.append(line.getKey() == OsmAndFormatter.UTM_FORMAT ? "UTM: " : "OLC: "); + if (line.getKey() == OsmAndFormatter.UTM_FORMAT) { + ssb.append("UTM: "); + } else if (line.getKey() == OsmAndFormatter.MGRS_FORMAT) { + ssb.append("MGRS: "); + } else if (line.getKey() == OsmAndFormatter.OLC_FORMAT){ + ssb.append("OLC: "); + } ssb.setSpan(new ForegroundColorSpan(app.getResources().getColor(R.color.text_color_secondary_light)), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ssb.append(line.getValue()); button.setText(ssb); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 5b9b9eb7ce..285e323867 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -323,9 +323,9 @@ public class OsmEditingPlugin extends OsmandPlugin { @Override public void addMyPlacesTab(FavoritesActivity favoritesActivity, List mTabs, Intent intent) { - mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class)); + mTabs.add(favoritesActivity.getTabIndicator(OSM_EDIT_TAB, OsmEditsFragment.class)); if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) { - app.getSettings().FAVORITES_TAB.set(R.string.osm_edits); + app.getSettings().FAVORITES_TAB.set(OSM_EDIT_TAB); } } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index 8537c8df7a..d805cde0df 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -1,11 +1,8 @@ package net.osmand.plus.routepreparationmenu; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; -import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; @@ -19,7 +16,6 @@ import android.view.ViewGroup.MarginLayoutParams; import android.view.ViewTreeObserver.OnScrollChangedListener; import android.widget.FrameLayout; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.LinearLayout; import androidx.annotation.NonNull; @@ -37,6 +33,7 @@ import net.osmand.data.RotatedTileBox; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; +import net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem; import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities.DialogButtonType; import net.osmand.plus.activities.MapActivity; @@ -44,6 +41,7 @@ import net.osmand.plus.base.ContextMenuScrollFragment; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; +import net.osmand.plus.helpers.enums.TracksSortByMode; import net.osmand.plus.importfiles.ImportHelper; import net.osmand.plus.importfiles.ImportHelper.OnGpxImportCompleteListener; import net.osmand.plus.measurementtool.GpxData; @@ -71,6 +69,7 @@ import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; import java.io.File; +import java.util.ArrayList; import java.util.List; @@ -89,6 +88,10 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca private GPXFile gpxFile; private View buttonsShadow; + private ImageButton sortButton; + + private TracksToFollowCard tracksCard; + private TracksSortByMode sortByMode = TracksSortByMode.BY_DATE; private boolean editingTrack; private boolean selectingTrack; @@ -166,6 +169,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca } setupCards(); setupButtons(view); + setupSortButton(view); setupScrollShadow(); if (!isPortrait()) { int widthNoShadow = getLandscapeNoShadowWidth(); @@ -202,10 +206,6 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca cardsContainer.removeAllViews(); if (gpxFile == null || selectingTrack) { - ImportTrackCard importTrackCard = new ImportTrackCard(mapActivity); - importTrackCard.setListener(this); - cardsContainer.addView(importTrackCard.build(mapActivity)); - setupTracksCard(); } else { String fileName = null; @@ -265,7 +265,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca List list = GpxUiHelper.getSortedGPXFilesInfo(dir, selectedTrackNames, false); if (list.size() > 0) { String defaultCategory = app.getString(R.string.shared_string_all); - TracksToFollowCard tracksCard = new TracksToFollowCard(mapActivity, list, defaultCategory); + tracksCard = new TracksToFollowCard(mapActivity, list, defaultCategory); tracksCard.setListener(FollowTrackFragment.this); getCardsContainer().addView(tracksCard.build(mapActivity)); } @@ -601,6 +601,36 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca } } + private void setupSortButton(View view) { + final ImageButton sortButton = view.findViewById(R.id.sort_button); + int colorId = isNightMode() ? R.color.inactive_buttons_and_links_bg_dark : R.color.inactive_buttons_and_links_bg_light; + Drawable background = app.getUIUtilities().getIcon(R.drawable.bg_dash_line_dark, colorId); + sortButton.setImageResource(sortByMode.getIconId()); + AndroidUtils.setBackground(sortButton, background); + sortButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + List items = new ArrayList<>(); + for (final TracksSortByMode mode : TracksSortByMode.values()) { + items.add(new SimplePopUpMenuItem(getString(mode.getNameId()), + app.getUIUtilities().getThemedIcon(mode.getIconId()), + new View.OnClickListener() { + @Override + public void onClick(View v) { + sortByMode = mode; + sortButton.setImageResource(mode.getIconId()); + if (tracksCard != null) { + tracksCard.setSortByMode(mode); + } + } + }, sortByMode == mode + )); + } + UiUtilities.showPopUpMenu(v, items); + } + }); + } + private void setupButtons(View view) { View buttonsContainer = view.findViewById(R.id.buttons_container); buttonsContainer.setBackgroundColor(AndroidUtils.getColorFromAttr(view.getContext(), R.attr.bg_color)); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TracksToFollowCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TracksToFollowCard.java index c21b508116..0897894730 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TracksToFollowCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TracksToFollowCard.java @@ -3,30 +3,36 @@ package net.osmand.plus.routepreparationmenu.cards; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import net.osmand.Collator; import net.osmand.IndexConstants; +import net.osmand.OsmAndCollator; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.GpxTrackAdapter; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; +import net.osmand.plus.helpers.enums.TracksSortByMode; import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter; import net.osmand.util.Algorithms; import java.io.File; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; public class TracksToFollowCard extends BaseCard { + private List gpxInfoList; private Map> gpxInfoCategories; - private List gpxInfoList; - private String selectedCategory; + private GpxTrackAdapter tracksAdapter; + private TracksSortByMode sortByMode = TracksSortByMode.BY_DATE; + private String defaultCategory; private String visibleCategory; - - private GpxTrackAdapter tracksAdapter; + private String selectedCategory; public TracksToFollowCard(MapActivity mapActivity, List gpxInfoList, String selectedCategory) { super(mapActivity); @@ -37,9 +43,10 @@ public class TracksToFollowCard extends BaseCard { gpxInfoCategories = getGpxInfoCategories(); } - public void setGpxInfoList(List gpxInfoList) { - this.gpxInfoList = gpxInfoList; + public void setSortByMode(TracksSortByMode sortByMode) { + this.sortByMode = sortByMode; gpxInfoCategories = getGpxInfoCategories(); + updateTracksAdapter(); } public List getGpxInfoList() { @@ -91,11 +98,8 @@ public class TracksToFollowCard extends BaseCard { @Override public void onItemSelected(HorizontalSelectionAdapter.HorizontalSelectionItem item) { selectedCategory = item.getTitle(); - List items = gpxInfoCategories.get(selectedCategory); tracksAdapter.setShowFolderName(showFoldersName()); - tracksAdapter.setGpxInfoList(items != null ? items : new ArrayList()); - tracksAdapter.notifyDataSetChanged(); - + updateTracksAdapter(); selectionAdapter.notifyDataSetChanged(); } }); @@ -106,6 +110,12 @@ public class TracksToFollowCard extends BaseCard { selectionAdapter.notifyDataSetChanged(); } + private void updateTracksAdapter() { + List items = gpxInfoCategories.get(selectedCategory); + tracksAdapter.setGpxInfoList(items != null ? items : new ArrayList()); + tracksAdapter.notifyDataSetChanged(); + } + private boolean showFoldersName() { return defaultCategory.equals(selectedCategory) || visibleCategory.equals(selectedCategory); } @@ -116,6 +126,7 @@ public class TracksToFollowCard extends BaseCard { gpxInfoCategories.put(visibleCategory, new ArrayList()); gpxInfoCategories.put(defaultCategory, new ArrayList()); + sortGPXInfoItems(gpxInfoList); for (GPXInfo info : gpxInfoList) { if (info.isSelected()) { addGpxInfoCategory(gpxInfoCategories, info, visibleCategory); @@ -141,4 +152,25 @@ public class TracksToFollowCard extends BaseCard { } items.add(info); } + + public void sortGPXInfoItems(List gpxInfoList) { + final Collator collator = OsmAndCollator.primaryCollator(); + Collections.sort(gpxInfoList, new Comparator() { + @Override + public int compare(GPXInfo i1, GPXInfo i2) { + if (sortByMode == TracksSortByMode.BY_NAME_ASCENDING) { + return collator.compare(i1.getFileName(), i2.getFileName()); + } else if (sortByMode == TracksSortByMode.BY_NAME_DESCENDING) { + return -collator.compare(i1.getFileName(), i2.getFileName()); + } else { + long time1 = i1.getLastModified(); + long time2 = i2.getLastModified(); + if (time1 == time2) { + return collator.compare(i1.getFileName(), i2.getFileName()); + } + return -((time1 < time2) ? -1 : ((time1 == time2) ? 0 : 1)); + } + } + }); + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index b4cabfb389..4358938079 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -1,20 +1,22 @@ package net.osmand.plus.routing; +import android.content.res.AssetFileDescriptor; import android.media.AudioManager; import android.media.SoundPool; import net.osmand.Location; +import net.osmand.StateChangedListener; import net.osmand.binary.RouteDataObject; import net.osmand.data.PointDescription; -import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper; import net.osmand.plus.routing.AlarmInfo.AlarmInfoType; import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo; import net.osmand.plus.routing.data.StreetName; +import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener; +import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.voice.AbstractPrologCommandPlayer; import net.osmand.plus.voice.CommandBuilder; import net.osmand.plus.voice.CommandPlayer; @@ -80,7 +82,10 @@ public class VoiceRouter { private int TURN_IN_DISTANCE; private int TURN_IN_DISTANCE_END; private int TURN_NOW_DISTANCE; - + + private SoundPool soundPool; + private int soundClick = -1; + private VoiceCommandPending pendingCommand = null; private RouteDirectionInfo nextRouteDirection; @@ -103,8 +108,36 @@ public class VoiceRouter { } }; app.getAppCustomization().addListener(customizationListener); + + if (!isMute()) { + loadCameraSound(); + } + settings.VOICE_MUTE.addListener(new StateChangedListener() { + @Override + public void stateChanged(Boolean change) { + if (!isMute() && soundPool == null) { + loadCameraSound(); + } + } + }); } - + + private void loadCameraSound() { + if (soundPool == null) { + soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); + } + if (soundClick == -1) { + try { + // Taken unaltered from https://freesound.org/people/Corsica_S/sounds/91926/ under license http://creativecommons.org/licenses/by/3.0/ : + AssetFileDescriptor assetFileDescriptor = app.getAssets().openFd("sounds/ding.ogg"); + soundClick = soundPool.load(assetFileDescriptor, 1); + assetFileDescriptor.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + public void setPlayer(CommandPlayer player) { this.player = player; if (pendingCommand != null && player != null) { @@ -1015,18 +1048,8 @@ public class VoiceRouter { if (isMute()) { return; } - SoundPool sp = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); - int soundClick = -1; - boolean success = true; - try { - // Taken unaltered from https://freesound.org/people/Corsica_S/sounds/91926/ under license http://creativecommons.org/licenses/by/3.0/ : - soundClick = sp.load(settings.getContext().getAssets().openFd("sounds/ding.ogg"), 1); - } catch (IOException e) { - e.printStackTrace(); - success = false; - } - if (success) { - sp.play(soundClick, 1 ,1, 0, 0, 1); + if (soundPool != null && soundClick != -1) { + soundPool.play(soundClick, 1, 1, 0, 0, 1); } } diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java index 902f4bea4b..78383f3179 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java @@ -29,6 +29,7 @@ import androidx.fragment.app.DialogFragment; import com.google.openlocationcode.OpenLocationCode; import com.jwetherell.openmap.common.LatLonPoint; +import com.jwetherell.openmap.common.MGRSPoint; import com.jwetherell.openmap.common.UTMPoint; import net.osmand.AndroidUtils; @@ -73,6 +74,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os private static final String QUICK_SEARCH_COORDS_NORTH_KEY = "quick_search_coords_north_key"; private static final String QUICK_SEARCH_COORDS_EAST_KEY = "quick_search_coords_east_key"; private static final String QUICK_SEARCH_COORDS_ZONE_KEY = "quick_search_coords_zone_key"; + private static final String QUICK_SEARCH_COORDS_MGRS_KEY = "quick_search_coords_mgrs_key"; private static final String QUICK_SEARCH_COORDS_OLC_KEY = "quick_search_coords_olc_key"; private static final String QUICK_SEARCH_COORDS_OLC_INFO_KEY = "quick_search_coords_olc_info_key"; private static final String QUICK_SEARCH_COORDS_FORMAT_KEY = "quick_search_coords_format_key"; @@ -89,6 +91,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os private EditText northingEdit; private EditText eastingEdit; private EditText zoneEdit; + private EditText mgrsEdit; private EditText olcEdit; private TextView olcInfo; private EditText formatEdit; @@ -153,6 +156,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os northingEdit = ((EditText) view.findViewById(R.id.northingEditText)); eastingEdit = ((EditText) view.findViewById(R.id.eastingEditText)); zoneEdit = ((EditText) view.findViewById(R.id.zoneEditText)); + mgrsEdit = ((EditText) view.findViewById(R.id.mgrsEditText)); olcEdit = ((EditText) view.findViewById(R.id.olcEditText)); olcInfo = ((TextView) view.findViewById(R.id.olcInfoTextView)); formatEdit = ((EditText) view.findViewById(R.id.formatEditText)); @@ -160,6 +164,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os String defaultLat = ""; String defaultZone = ""; + String defaultMgrs = ""; String defaultOlc = ""; boolean coordinatesApplied = false; if (getArguments() != null) { @@ -167,6 +172,8 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os if (!Algorithms.isEmpty(text)) { if (currentFormat == PointDescription.UTM_FORMAT) { defaultZone = text.trim(); + } else if (currentFormat == PointDescription.MGRS_FORMAT) { + defaultMgrs = text.trim(); } else if (currentFormat == PointDescription.OLC_FORMAT) { defaultOlc = text.trim(); } else { @@ -188,6 +195,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os String northingStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_NORTH_KEY, ""); String eastingStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_EAST_KEY, ""); String zoneStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_ZONE_KEY, defaultZone); + String mgrsStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_MGRS_KEY, defaultMgrs); String olcStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_OLC_KEY, defaultOlc); String olcInfoStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_OLC_INFO_KEY, defaultOlc); @@ -209,6 +217,8 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os eastingEdit.setSelection(eastingStr.length()); zoneEdit.setText(zoneStr); zoneEdit.setSelection(zoneStr.length()); + mgrsEdit.setText(mgrsStr); + mgrsEdit.setSelection(mgrsStr.length()); olcEdit.setText(olcStr); olcEdit.setSelection(olcStr.length()); olcInfo.setText(olcInfoStr); @@ -242,6 +252,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os northingEdit.addTextChangedListener(textWatcher); eastingEdit.addTextChangedListener(textWatcher); zoneEdit.addTextChangedListener(textWatcher); + mgrsEdit.addTextChangedListener(textWatcher); olcEdit.addTextChangedListener(textWatcher); OnEditorActionListener doneListener = new OnEditorActionListener() { @@ -258,6 +269,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os lonEdit.setOnEditorActionListener(doneListener); zoneEdit.setOnEditorActionListener(doneListener); + mgrsEdit.setOnEditorActionListener(doneListener); olcEdit.setOnEditorActionListener(doneListener); UiUtilities ic = app.getUIUtilities(); @@ -318,6 +330,15 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os olcEdit.setText(""); } }); + ImageButton mgrsClearButton = (ImageButton) view.findViewById(R.id.mgrsClearButton); + mgrsClearButton.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_remove_dark)); + mgrsClearButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mgrsEdit.setText(""); + } + }); + ImageButton formatSelectButton = (ImageButton) view.findViewById(R.id.formatSelectButton); formatSelectButton.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_drop_down)); formatSelectButton.setOnClickListener(new View.OnClickListener() { @@ -364,6 +385,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os final TextView northEdit = ((TextView) view.findViewById(R.id.northingEditText)); final TextView eastEdit = ((TextView) view.findViewById(R.id.eastingEditText)); final TextView zoneEdit = ((TextView) view.findViewById(R.id.zoneEditText)); + final TextView mgrsEdit = ((TextView) view.findViewById(R.id.mgrsEditText)); final TextView olcEdit = ((TextView) view.findViewById(R.id.olcEditText)); final TextView olcInfo = ((TextView) view.findViewById(R.id.olcInfoTextView)); outState.putString(QUICK_SEARCH_COORDS_LAT_KEY, latEdit.getText().toString()); @@ -371,6 +393,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os outState.putString(QUICK_SEARCH_COORDS_NORTH_KEY, northEdit.getText().toString()); outState.putString(QUICK_SEARCH_COORDS_EAST_KEY, eastEdit.getText().toString()); outState.putString(QUICK_SEARCH_COORDS_ZONE_KEY, zoneEdit.getText().toString()); + outState.putString(QUICK_SEARCH_COORDS_MGRS_KEY, mgrsEdit.getText().toString()); outState.putString(QUICK_SEARCH_COORDS_OLC_KEY, olcEdit.getText().toString()); outState.putString(QUICK_SEARCH_COORDS_OLC_INFO_KEY, olcInfo.getText().toString()); } @@ -470,23 +493,52 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os } private void updateControlsVisibility() { - if (currentFormat == PointDescription.OLC_FORMAT) { - view.findViewById(R.id.eastingLayout).setVisibility(View.GONE); - view.findViewById(R.id.northingLayout).setVisibility(View.GONE); - view.findViewById(R.id.zoneLayout).setVisibility(View.GONE); - view.findViewById(R.id.olcLayout).setVisibility(View.VISIBLE); - view.findViewById(R.id.olcInfoLayout).setVisibility(View.VISIBLE); - view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE); - view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE); - } else { - boolean utm = currentFormat == PointDescription.UTM_FORMAT; - view.findViewById(R.id.eastingLayout).setVisibility(utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.northingLayout).setVisibility(utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.zoneLayout).setVisibility(utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.olcLayout).setVisibility(View.GONE); - view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE); - view.findViewById(R.id.latitudeLayout).setVisibility(!utm ? View.VISIBLE : View.GONE); - view.findViewById(R.id.longitudeLayout).setVisibility(!utm ? View.VISIBLE : View.GONE); + switch (currentFormat){ + + case PointDescription.OLC_FORMAT: { + view.findViewById(R.id.eastingLayout).setVisibility(View.GONE); + view.findViewById(R.id.northingLayout).setVisibility(View.GONE); + view.findViewById(R.id.zoneLayout).setVisibility(View.GONE); + view.findViewById(R.id.olcLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.olcInfoLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE); + view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE); + view.findViewById(R.id.mgrsLayout).setVisibility(View.GONE); + break; + } + case PointDescription.UTM_FORMAT: { + view.findViewById(R.id.eastingLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.northingLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.zoneLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.olcLayout).setVisibility(View.GONE); + view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE); + view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE); + view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE); + view.findViewById(R.id.mgrsLayout).setVisibility(View.GONE); + break; + } + case PointDescription.MGRS_FORMAT: { + view.findViewById(R.id.eastingLayout).setVisibility(View.GONE); + view.findViewById(R.id.northingLayout).setVisibility(View.GONE); + view.findViewById(R.id.zoneLayout).setVisibility(View.GONE); + view.findViewById(R.id.olcLayout).setVisibility(View.GONE); + view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE); + view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE); + view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE); + view.findViewById(R.id.mgrsLayout).setVisibility(View.VISIBLE); + break; + } + default: { + view.findViewById(R.id.eastingLayout).setVisibility(View.GONE); + view.findViewById(R.id.northingLayout).setVisibility(View.GONE); + view.findViewById(R.id.zoneLayout).setVisibility(View.GONE); + view.findViewById(R.id.olcLayout).setVisibility(View.GONE); + view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE); + view.findViewById(R.id.latitudeLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.longitudeLayout).setVisibility(View.VISIBLE); + view.findViewById(R.id.mgrsLayout).setVisibility(View.GONE); + break; + } } } @@ -544,11 +596,28 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os zoneEdit.setText(olcEdit.getText()); northingEdit.setText(""); eastingEdit.setText(""); + } else if (prevFormat == PointDescription.MGRS_FORMAT) { + zoneEdit.setText(mgrsEdit.getText()); + northingEdit.setText(""); + eastingEdit.setText(""); } else { zoneEdit.setText(latEdit.getText()); northingEdit.setText(""); eastingEdit.setText(""); } + } else if (currentFormat == PointDescription.MGRS_FORMAT) { + final EditText mgrsEdit = ((EditText) view.findViewById(R.id.mgrsEditText)); + if (latLon != null) { + MGRSPoint pnt = new MGRSPoint(new LatLonPoint(latLon.getLatitude(), latLon.getLongitude())); + mgrsEdit.setText(pnt.toFlavoredString(5)); + } else if (prevFormat == PointDescription.UTM_FORMAT) { + mgrsEdit.setText(zoneEdit.getText()); + } else if (prevFormat == PointDescription.OLC_FORMAT) { + mgrsEdit.setText(olcEdit.getText()); + } else { + mgrsEdit.setText(latEdit.getText()); + + } } else if (currentFormat == PointDescription.OLC_FORMAT) { if (latLon != null) { String olc = OpenLocationCode.encode(latLon.getLatitude(), latLon.getLongitude()); @@ -557,6 +626,9 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os } else if (prevFormat == PointDescription.UTM_FORMAT) { olcEdit.setText(zoneEdit.getText()); olcInfo.setText(provideOlcInfo(olcEdit.getText().toString())); + } else if (prevFormat == PointDescription.MGRS_FORMAT) { + olcEdit.setText(mgrsEdit.getText()); + olcInfo.setText(provideOlcInfo(olcEdit.getText().toString())); } else { olcEdit.setText(latEdit.getText()); olcInfo.setText(provideOlcInfo(olcEdit.getText().toString())); @@ -568,6 +640,9 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os } else if (prevFormat == PointDescription.UTM_FORMAT) { latEdit.setText(zoneEdit.getText()); lonEdit.setText(""); + } else if (prevFormat == PointDescription.MGRS_FORMAT) { + latEdit.setText(mgrsEdit.getText()); + lonEdit.setText(""); } else if (prevFormat == PointDescription.OLC_FORMAT) { latEdit.setText(olcEdit.getText()); lonEdit.setText(""); @@ -591,6 +666,11 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os UTMPoint upoint = new UTMPoint(northing, easting, z, c); LatLonPoint ll = upoint.toLatLonPoint(); loc = new LatLon(ll.getLatitude(), ll.getLongitude()); + } else if (currentFormat == LocationConvert.MGRS_FORMAT) { + String mgrs = (mgrsEdit.getText().toString()); + MGRSPoint upoint = new MGRSPoint(mgrs); + LatLonPoint ll = upoint.toLatLonPoint(); + loc = new LatLon(ll.getLatitude(), ll.getLongitude()); } else if (currentFormat == LocationConvert.OLC_FORMAT) { String olcText = olcEdit.getText().toString(); olcInfo.setText(provideOlcInfo(olcText)); @@ -851,12 +931,13 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final QuickSearchCoordinatesFragment parent = (QuickSearchCoordinatesFragment) getParentFragment(); - String[] entries = new String[5]; + String[] entries = new String[6]; entries[0] = PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES); entries[1] = PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES); entries[2] = PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS); entries[3] = PointDescription.formatToHumanString(getContext(), PointDescription.UTM_FORMAT); entries[4] = PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT); + entries[5] = PointDescription.formatToHumanString(getContext(), PointDescription.MGRS_FORMAT); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.coords_format) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java index 4c0ebc2c11..91d5493217 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java @@ -14,6 +14,7 @@ public enum ExportSettingsType { OSM_NOTES, OSM_EDITS, OFFLINE_MAPS, + FAVORITES, TTS_VOICE, VOICE } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java index 3088d9e86f..61b5f28541 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java @@ -174,6 +174,6 @@ public class AvoidRoadsSettingsItem extends CollectionSettingsItem getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/DownloadsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/DownloadsItem.java index 67b9d5812e..7c9318ad37 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/DownloadsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/DownloadsItem.java @@ -97,6 +97,6 @@ public class DownloadsItem extends SettingsItem { @Nullable @Override SettingsItemWriter getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java new file mode 100644 index 0000000000..8e8c4c6f36 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java @@ -0,0 +1,197 @@ +package net.osmand.plus.settings.backend.backup; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import net.osmand.GPXUtilities; +import net.osmand.GPXUtilities.GPXFile; +import net.osmand.data.FavouritePoint; +import net.osmand.plus.FavouritesDbHelper; +import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static net.osmand.IndexConstants.GPX_FILE_EXT; +import static net.osmand.plus.importfiles.ImportHelper.asFavourites; + +public class FavoritesSettingsItem extends CollectionSettingsItem { + + private FavouritesDbHelper favoritesHelper; + + public FavoritesSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { + super(app, null, items); + } + + public FavoritesSettingsItem(@NonNull OsmandApplication app, @Nullable FavoritesSettingsItem baseItem, @NonNull List items) { + super(app, baseItem, items); + } + + FavoritesSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { + super(app, json); + } + + @Override + protected void init() { + super.init(); + favoritesHelper = app.getFavorites(); + existingItems = new ArrayList<>(favoritesHelper.getFavoriteGroups()); + } + + @NonNull + @Override + public SettingsItemType getType() { + return SettingsItemType.FAVOURITES; + } + + @NonNull + @Override + public String getName() { + return "favourites"; + } + + @NonNull + @Override + public String getPublicName(@NonNull Context ctx) { + return ctx.getString(R.string.shared_string_favorites); + } + + @NonNull + public String getDefaultFileName() { + return getName() + getDefaultFileExtension(); + } + + @NonNull + public String getDefaultFileExtension() { + return GPX_FILE_EXT; + } + + @Override + public void apply() { + List newItems = getNewItems(); + if (!newItems.isEmpty() || !duplicateItems.isEmpty()) { + appliedItems = new ArrayList<>(newItems); + + for (FavoriteGroup duplicate : duplicateItems) { + if (shouldReplace) { + FavoriteGroup existingGroup = favoritesHelper.getGroup(duplicate.getName()); + if (existingGroup != null) { + List favouritePoints = new ArrayList<>(existingGroup.getPoints()); + for (FavouritePoint favouritePoint : favouritePoints) { + favoritesHelper.deleteFavourite(favouritePoint, false); + } + } + } + appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate)); + } + List favourites = getPointsFromGroups(appliedItems); + for (FavouritePoint favourite : favourites) { + favoritesHelper.addFavourite(favourite, false); + } + favoritesHelper.sortAll(); + favoritesHelper.saveCurrentPointsIntoFile(); + } + } + + @Override + public boolean isDuplicate(@NonNull FavoriteGroup favoriteGroup) { + String name = favoriteGroup.getName(); + for (FavoriteGroup group : existingItems) { + if (group.getName().equals(name)) { + return true; + } + } + return false; + } + + @Override + public boolean shouldReadOnCollecting() { + return true; + } + + @NonNull + @Override + public FavoriteGroup renameItem(@NonNull FavoriteGroup item) { + int number = 0; + while (true) { + number++; + String name = item.getName() + " (" + number + ")"; + FavoriteGroup renamedItem = new FavoriteGroup(name, item.getPoints(), item.getColor(), item.isVisible()); + if (!isDuplicate(renamedItem)) { + for (FavouritePoint point : renamedItem.getPoints()) { + point.setCategory(renamedItem.getName()); + } + return renamedItem; + } + } + } + + @Nullable + @Override + SettingsItemReader getReader() { + return new SettingsItemReader(this) { + + @Override + public void readFromStream(@NonNull InputStream inputStream) throws IllegalArgumentException { + GPXFile gpxFile = GPXUtilities.loadGPXFile(inputStream); + if (gpxFile.error != null) { + warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType()))); + SettingsHelper.LOG.error("Failed read gpx file", gpxFile.error); + } else { + Map flatGroups = new LinkedHashMap<>(); + List favourites = asFavourites(app, gpxFile.getPoints(), fileName, false); + for (FavouritePoint point : favourites) { + FavoriteGroup group = flatGroups.get(point.getCategory()); + if (group == null) { + group = new FavoriteGroup(point.getCategory(), point.isVisible(), point.getColor()); + flatGroups.put(group.getName(), group); + items.add(group); + } + group.getPoints().add(point); + } + } + } + }; + } + + private List getPointsFromGroups(List groups) { + List favouritePoints = new ArrayList<>(); + for (FavoriteGroup group : groups) { + favouritePoints.addAll(group.getPoints()); + } + return favouritePoints; + } + + @Nullable + @Override + SettingsItemWriter getWriter() { + return new SettingsItemWriter(this) { + + @Override + public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException { + List favourites = getPointsFromGroups(items); + GPXFile gpxFile = favoritesHelper.asGpxFile(favourites); + Exception error = GPXUtilities.writeGpx(new OutputStreamWriter(outputStream, "UTF-8"), gpxFile); + if (error != null) { + warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType()))); + SettingsHelper.LOG.error("Failed write to gpx file", error); + return false; + } + return true; + } + }; + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GlobalSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GlobalSettingsItem.java index d30c4d94d8..bcf837de54 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GlobalSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GlobalSettingsItem.java @@ -19,6 +19,10 @@ public class GlobalSettingsItem extends OsmandSettingsItem { super(settings); } + public GlobalSettingsItem(@NonNull OsmandSettings settings, @NonNull JSONObject json) throws JSONException { + super(SettingsItemType.GLOBAL, settings, json); + } + @NonNull @Override public SettingsItemType getType() { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MapSourcesSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MapSourcesSettingsItem.java index 82cf840b94..4c38a07892 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MapSourcesSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MapSourcesSettingsItem.java @@ -236,6 +236,6 @@ public class MapSourcesSettingsItem extends CollectionSettingsItem @Nullable @Override SettingsItemWriter getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java index 03e1e39ad5..287f6dc9de 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java @@ -194,6 +194,6 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmNotesSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmNotesSettingsItem.java index afe23c2059..edcaa350e3 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmNotesSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmNotesSettingsItem.java @@ -167,6 +167,6 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem @Nullable @Override SettingsItemWriter getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java index 8d1c464761..29e20679d9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java @@ -173,6 +173,6 @@ public class PoiUiFiltersSettingsItem extends CollectionSettingsItem getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/QuickActionsSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/QuickActionsSettingsItem.java index b2e597ab60..499ac2a833 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/QuickActionsSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/QuickActionsSettingsItem.java @@ -178,6 +178,6 @@ public class QuickActionsSettingsItem extends CollectionSettingsItem getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java index e912c670b4..d198c81502 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -13,6 +13,7 @@ import net.osmand.data.LatLon; import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.map.TileSourceManager.TileSourceTemplate; +import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.SQLiteTileSource; @@ -47,8 +48,8 @@ import java.util.Map; import java.util.Set; import static net.osmand.IndexConstants.OSMAND_SETTINGS_FILE_EXT; -import static net.osmand.plus.activities.LocalIndexHelper.*; import static net.osmand.plus.settings.backend.backup.FileSettingsItem.*; +import static net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; /* Usage: @@ -536,6 +537,10 @@ public class SettingsHelper { if (!files.isEmpty()) { dataList.put(ExportSettingsType.OFFLINE_MAPS, files); } + List favoriteGroups = app.getFavorites().getFavoriteGroups(); + if (!favoriteGroups.isEmpty()) { + dataList.put(ExportSettingsType.FAVORITES, favoriteGroups); + } List localVoiceFileList = getVoiceIndexInfo(); files = getFilesByType(localVoiceFileList, LocalIndexType.TTS_VOICE_DATA); if (!files.isEmpty()) { @@ -596,6 +601,7 @@ public class SettingsHelper { List tileSourceTemplates = new ArrayList<>(); List avoidRoads = new ArrayList<>(); List appModeBeans = new ArrayList<>(); + List favoriteGroups = new ArrayList<>(); List osmNotesPointList = new ArrayList<>(); List osmEditsPointList = new ArrayList<>(); @@ -608,8 +614,7 @@ public class SettingsHelper { tileSourceTemplates.add((ITileSource) object); } else if (object instanceof File) { try { - FileSettingsItem fileItem = new FileSettingsItem(app, (File) object); - settingsItems.add(fileItem); + settingsItems.add(new FileSettingsItem(app, (File) object)); } catch (IllegalArgumentException e) { LOG.warn("Trying to export unsuported file type", e); } @@ -621,6 +626,8 @@ public class SettingsHelper { osmNotesPointList.add((OsmNotesPoint) object); } else if (object instanceof OpenstreetmapPoint) { osmEditsPointList.add((OpenstreetmapPoint) object); + } else if (object instanceof FavoriteGroup) { + favoriteGroups.add((FavoriteGroup) object); } } if (!quickActions.isEmpty()) { @@ -649,6 +656,9 @@ public class SettingsHelper { if (!osmEditsPointList.isEmpty()) { settingsItems.add(new OsmEditsSettingsItem(app, osmEditsPointList)); } + if (!favoriteGroups.isEmpty()) { + settingsItems.add(new FavoritesSettingsItem(app, favoriteGroups)); + } return settingsItems; } @@ -669,6 +679,8 @@ public class SettingsHelper { List globalSettingsItems = new ArrayList<>(); List notesPointList = new ArrayList<>(); List editsPointList = new ArrayList<>(); + List favoriteGroups = new ArrayList<>(); + for (SettingsItem item : settingsItems) { switch (item.getType()) { case PROFILE: @@ -743,6 +755,10 @@ public class SettingsHelper { editsPointList.addAll(osmEditsSettingsItem.getItems()); } break; + case FAVOURITES: + FavoritesSettingsItem favoritesSettingsItem = (FavoritesSettingsItem) item; + favoriteGroups.addAll(favoritesSettingsItem.getItems()); + break; default: break; } @@ -787,6 +803,9 @@ public class SettingsHelper { if (!mapFilesList.isEmpty()) { settingsToOperate.put(ExportSettingsType.OFFLINE_MAPS, mapFilesList); } + if (!favoriteGroups.isEmpty()) { + settingsToOperate.put(ExportSettingsType.FAVORITES, favoriteGroups); + } if (!ttsVoiceFilesList.isEmpty()) { settingsToOperate.put(ExportSettingsType.TTS_VOICE, ttsVoiceFilesList); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java index 301c4f8882..75c5ba6500 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java @@ -143,7 +143,6 @@ public abstract class SettingsItem { } json.put("file", fileName); } - writeItemsToJson(json); } String toJson() throws JSONException { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java index a513dc748c..bb6b68b3ce 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java @@ -15,4 +15,5 @@ public enum SettingsItemType { DOWNLOADS, OSM_NOTES, OSM_EDITS, + FAVOURITES } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java index 8545b37503..9669099003 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java @@ -90,7 +90,7 @@ class SettingsItemsFactory { OsmandSettings settings = app.getSettings(); switch (type) { case GLOBAL: - item = new GlobalSettingsItem(settings); + item = new GlobalSettingsItem(settings, json); break; case PROFILE: item = new ProfileSettingsItem(app, json); @@ -131,6 +131,9 @@ class SettingsItemsFactory { case OSM_EDITS: item = new OsmEditsSettingsItem(app, json); break; + case FAVOURITES: + item = new FavoritesSettingsItem(app, json); + break; } return item; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SuggestedDownloadsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SuggestedDownloadsItem.java index d2dd9a8554..d6411fb89d 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SuggestedDownloadsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SuggestedDownloadsItem.java @@ -123,6 +123,6 @@ public class SuggestedDownloadsItem extends SettingsItem { @Nullable @Override SettingsItemWriter getWriter() { - return null; + return getJsonWriter(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/CoordinatesFormatFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/CoordinatesFormatFragment.java index 51b5d817a0..fd62f6df3c 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/CoordinatesFormatFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/CoordinatesFormatFragment.java @@ -31,11 +31,13 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { public static final String TAG = CoordinatesFormatFragment.class.getSimpleName(); private static final String UTM_FORMAT_WIKI_LINK = "https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system"; + private static final String MGRS_FORMAT_WIKI_LINK = "https://en.wikipedia.org/wiki/Military_Grid_Reference_System"; private static final String FORMAT_DEGREES = "format_degrees"; private static final String FORMAT_MINUTES = "format_minutes"; private static final String FORMAT_SECONDS = "format_seconds"; private static final String UTM_FORMAT = "utm_format"; + private static final String MGRS_FORMAT = "mgrs_format"; private static final String OLC_FORMAT = "olc_format"; @Override @@ -44,6 +46,7 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { CheckBoxPreference minutesPref = (CheckBoxPreference) findPreference(FORMAT_MINUTES); CheckBoxPreference secondsPref = (CheckBoxPreference) findPreference(FORMAT_SECONDS); CheckBoxPreference utmPref = (CheckBoxPreference) findPreference(UTM_FORMAT); + CheckBoxPreference mgrsPref = (CheckBoxPreference) findPreference(MGRS_FORMAT); CheckBoxPreference olcPref = (CheckBoxPreference) findPreference(OLC_FORMAT); Location loc = app.getLocationProvider().getLastKnownLocation(); @@ -52,6 +55,7 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { minutesPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_MINUTES)); secondsPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_SECONDS)); utmPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.UTM_FORMAT)); + mgrsPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.MGRS_FORMAT)); olcPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.OLC_FORMAT)); int currentFormat = settings.COORDINATES_FORMAT.getModeValue(getSelectedAppMode()); @@ -69,6 +73,12 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { summaryView.setOnTouchListener(new ClickableSpanTouchListener()); } } + if (MGRS_FORMAT.equals(preference.getKey())) { + TextView summaryView = (TextView) holder.findViewById(android.R.id.summary); + if (summaryView != null) { + summaryView.setOnTouchListener(new ClickableSpanTouchListener()); + } + } } private CharSequence getCoordinatesFormatSummary(Location loc, int format) { @@ -106,6 +116,36 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { return spannableBuilder; } + if (format == PointDescription.MGRS_FORMAT) { + SpannableStringBuilder spannableBuilder = new SpannableStringBuilder(); + String combined = getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_example), formattedCoordinates); + spannableBuilder.append(combined); + spannableBuilder.append("\n"); + spannableBuilder.append(getString(R.string.mgrs_format_descr)); + + int start = spannableBuilder.length(); + spannableBuilder.append(" "); + spannableBuilder.append(getString(R.string.shared_string_read_more)); + + ClickableSpan clickableSpan = new ClickableSpan() { + @Override + public void onClick(@NonNull View widget) { + Context ctx = getContext(); + if (ctx != null) { + WikipediaDialogFragment.showFullArticle(ctx, Uri.parse(MGRS_FORMAT_WIKI_LINK), isNightMode()); + } + } + + @Override + public void updateDrawState(@NonNull TextPaint ds) { + super.updateDrawState(ds); + ds.setUnderlineText(false); + } + }; + spannableBuilder.setSpan(clickableSpan, start, spannableBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + + return spannableBuilder; + } return getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_example), formattedCoordinates); } @@ -159,6 +199,8 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { return PointDescription.FORMAT_SECONDS; case UTM_FORMAT: return PointDescription.UTM_FORMAT; + case MGRS_FORMAT: + return PointDescription.MGRS_FORMAT; case OLC_FORMAT: return PointDescription.OLC_FORMAT; default: @@ -176,6 +218,8 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment { return FORMAT_SECONDS; case PointDescription.UTM_FORMAT: return UTM_FORMAT; + case PointDescription.MGRS_FORMAT: + return MGRS_FORMAT; case PointDescription.OLC_FORMAT: return OLC_FORMAT; default: diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java index 8160e81e6e..d90f4b7429 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java @@ -13,6 +13,7 @@ import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.map.ITileSource; +import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.audionotes.AudioVideoNotesPlugin; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.settings.backend.ApplicationMode; @@ -148,6 +149,10 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter multimediaFilesList = new ArrayList<>(); List trackFilesList = new ArrayList<>(); List avoidRoads = new ArrayList<>(); + List favoriteGroups = new ArrayList<>(); for (Object object : duplicatesList) { if (object instanceof ApplicationMode.ApplicationModeBean) { @@ -217,6 +219,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { } } else if (object instanceof AvoidRoadInfo) { avoidRoads.add((AvoidRoadInfo) object); + } else if (object instanceof FavoriteGroup) { + favoriteGroups.add((FavoriteGroup) object); } } if (!profiles.isEmpty()) { @@ -255,6 +259,10 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { duplicates.add(getString(R.string.avoid_road)); duplicates.addAll(avoidRoads); } + if (!favoriteGroups.isEmpty()) { + duplicates.add(getString(R.string.shared_string_favorites)); + duplicates.addAll(favoriteGroups); + } return duplicates; } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java index 2ecaad38e4..f9960db436 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java @@ -33,6 +33,7 @@ import net.osmand.PlatformUtil; import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager.TileSourceTemplate; import net.osmand.plus.AppInitializer; +import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.SQLiteTileSource; @@ -46,6 +47,8 @@ import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; import net.osmand.plus.settings.backend.ExportSettingsType; +import net.osmand.plus.settings.backend.backup.FavoritesSettingsItem; +import net.osmand.plus.settings.backend.backup.GlobalSettingsItem; import net.osmand.plus.settings.backend.backup.OsmEditsSettingsItem; import net.osmand.plus.settings.backend.backup.OsmNotesSettingsItem; import net.osmand.plus.settings.backend.backup.SettingsHelper; @@ -432,6 +435,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { List avoidRoads = new ArrayList<>(); List osmNotesPointList = new ArrayList<>(); List osmEditsPointList = new ArrayList<>(); + List favoriteGroups = new ArrayList<>(); for (Object object : data) { if (object instanceof ApplicationModeBean) { appModeBeans.add((ApplicationModeBean) object); @@ -451,6 +455,10 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { osmNotesPointList.add((OsmNotesPoint) object); } else if (object instanceof OpenstreetmapPoint) { osmEditsPointList.add((OpenstreetmapPoint) object); + } else if (object instanceof FavoriteGroup) { + favoriteGroups.add((FavoriteGroup) object); + } else if (object instanceof GlobalSettingsItem) { + settingsItems.add((GlobalSettingsItem) object); } } if (!appModeBeans.isEmpty()) { @@ -478,6 +486,10 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { OsmEditsSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_EDITS, OsmEditsSettingsItem.class); settingsItems.add(new OsmEditsSettingsItem(app, baseItem, osmEditsPointList)); } + if (!favoriteGroups.isEmpty()) { + FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class); + settingsItems.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups)); + } return settingsItems; } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java index 7acd88ee4b..d50b00ae6f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java @@ -122,6 +122,18 @@ public class ImportedSettingsItemsAdapter extends holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_info_dark, activeColorRes)); holder.title.setText(R.string.osm_edit_modified_poi); break; + case FAVORITES: + holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_favorite, activeColorRes)); + holder.title.setText(R.string.shared_string_favorites); + break; + case OFFLINE_MAPS: + holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_map, activeColorRes)); + holder.title.setText(R.string.shared_string_local_maps); + break; + case GLOBAL: + holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_settings, activeColorRes)); + holder.title.setText(R.string.general_settings_2); + break; } } diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java index 79e47de648..b58dc807a8 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainLayer.java @@ -35,7 +35,7 @@ import static net.osmand.plus.srtmplugin.TerrainMode.HILLSHADE; public class TerrainLayer extends MapTileLayer { private final static Log log = PlatformUtil.getLog(TerrainLayer.class); - private Map resources = new LinkedHashMap(); + private Map resources = new LinkedHashMap(); private final static String HILLSHADE_CACHE = "hillshade.cache"; private final static String SLOPE_CACHE = "slope.cache"; private int ZOOM_BOUNDARY = 15; @@ -68,7 +68,6 @@ public class TerrainLayer extends MapTileLayer { } else { // ignore } - } private void indexTerrainFiles(final OsmandApplication app) { @@ -77,7 +76,6 @@ public class TerrainLayer extends MapTileLayer { private String type = mode.name().toLowerCase(); @Override protected Void doInBackground(Void... params) { - File tilesDir = app.getAppPath(IndexConstants.TILES_INDEX_DIR); File cacheDir = app.getCacheDir(); // fix http://stackoverflow.com/questions/26937152/workaround-for-nexus-9-sqlite-file-write-operations-on-external-dirs @@ -91,17 +89,21 @@ public class TerrainLayer extends MapTileLayer { sqliteDb = null; } if (sqliteDb != null) { - if (sqliteDb.getVersion() == 0) { - sqliteDb.setVersion(1); - } - sqliteDb.execSQL("CREATE TABLE IF NOT EXISTS TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)"); + try { + if (sqliteDb.getVersion() == 0) { + sqliteDb.setVersion(1); + } + sqliteDb.execSQL("CREATE TABLE IF NOT EXISTS TILE_SOURCES(filename varchar2(256), date_modified int, left int, right int, top int, bottom int)"); - Map fileModified = new HashMap(); - Map rs = readFiles(app, tilesDir, fileModified); - indexCachedResources(fileModified, rs); - indexNonCachedResources(fileModified, rs); - sqliteDb.close(); - resources = rs; + Map fileModified = new HashMap(); + Map rs = readFiles(app, tilesDir, fileModified); + indexCachedResources(fileModified, rs); + indexNonCachedResources(fileModified, rs); + sqliteDb.close(); + resources = rs; + } catch (RuntimeException e) { + log.error(e.getMessage(), e); + } } return null; } @@ -150,7 +152,6 @@ public class TerrainLayer extends MapTileLayer { indexedResources.insert(filename, new QuadRect(left, top, right, bottom)); fileModified.remove(filename); } - } while(cursor.moveToNext()); } cursor.close(); @@ -172,7 +173,6 @@ public class TerrainLayer extends MapTileLayer { } return rs; } - }; executeTaskInBackground(task); } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 565fb872c0..d8101b487d 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -33,6 +33,7 @@ import androidx.core.graphics.drawable.DrawableCompat; import com.google.android.material.snackbar.Snackbar; import com.jwetherell.openmap.common.LatLonPoint; +import com.jwetherell.openmap.common.MGRSPoint; import com.jwetherell.openmap.common.UTMPoint; import net.osmand.AndroidUtils; @@ -1251,6 +1252,13 @@ public class MapInfoWidgetsFactory { UTMPoint pnt = new UTMPoint(new LatLonPoint(lat, lon)); String utmLocation = pnt.zone_number + "" + pnt.zone_letter + " " + ((long) pnt.easting) + " " + ((long) pnt.northing); latitudeText.setText(utmLocation); + } else if (f == PointDescription.MGRS_FORMAT) { + AndroidUiHelper.updateVisibility(lonCoordinatesContainer, false); + AndroidUiHelper.updateVisibility(coordinatesDivider, false); + AndroidUiHelper.updateVisibility(latitudeIcon, true); + latitudeIcon.setImageDrawable(iconsCache.getIcon(nightMode ? R.drawable.widget_coordinates_utm_night : R.drawable.widget_coordinates_utm_day)); + MGRSPoint pnt = new MGRSPoint(new LatLonPoint(lat, lon)); + latitudeText.setText(pnt.toFlavoredString(5)); } else if (f == PointDescription.OLC_FORMAT) { AndroidUiHelper.updateVisibility(lonCoordinatesContainer, false); AndroidUiHelper.updateVisibility(coordinatesDivider, false);