diff --git a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java index 2ad32c681f..86fb413d21 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java @@ -179,23 +179,28 @@ public class MapPoiTypes { if (skipNonEditable && pc.isNotEditableOsm()) { continue; } - for (PoiType pt : pc.getPoiTypes()) { - if (pt.isReference()) { - continue; - } - if (pt.getBaseLangType() != null) { - continue; - } - if (skipNonEditable && pt.isNotEditableOsm()) { - continue; - } - translation.put(pt.getKeyName().replace('_', ' ').toLowerCase(), pt); - translation.put(pt.getTranslation().toLowerCase(), pt); - } + addPoiTypesTranslation(skipNonEditable, translation, pc); } return translation; } + + private void addPoiTypesTranslation(boolean skipNonEditable, Map translation, PoiFilter pf) { + for (PoiType pt : pf.getPoiTypes()) { + if (pt.isReference()) { + continue; + } + if (pt.getBaseLangType() != null) { + continue; + } + if (skipNonEditable && pt.isNotEditableOsm()) { + continue; + } + translation.put(pt.getKeyName().replace('_', ' ').toLowerCase(), pt); + translation.put(pt.getTranslation().toLowerCase(), pt); + } + } + public List getAllTypesTranslatedNames(StringMatcher matcher) { List tm = new ArrayList(); for (PoiCategory pc : categories) { @@ -584,6 +589,9 @@ public class MapPoiTypes { tp.setLang(lang); tp.setOsmTag(otag); tp.setOsmValue(parser.getAttributeValue("", "value")); + tp.setOsmEditTagValue(parser.getAttributeValue("", "edit_tag"), + parser.getAttributeValue("", "edit_value")); + tp.setOsmTag2(parser.getAttributeValue("", "tag2")); tp.setOsmValue2(parser.getAttributeValue("", "value2")); tp.setText("text".equals(parser.getAttributeValue("", "type"))); diff --git a/OsmAnd-java/src/net/osmand/osm/PoiType.java b/OsmAnd-java/src/net/osmand/osm/PoiType.java index 42b48042fc..b19747fdf8 100644 --- a/OsmAnd-java/src/net/osmand/osm/PoiType.java +++ b/OsmAnd-java/src/net/osmand/osm/PoiType.java @@ -13,6 +13,9 @@ public class PoiType extends AbstractPoiType { private String osmTag2; private String osmValue; private String osmValue2; + + private String editTag; + private String editValue; private boolean filterOnly; @@ -57,6 +60,31 @@ public class PoiType extends AbstractPoiType { } return osmTag; } + + public void setOsmEditTagValue(String osmTag, String editValue) { + this.editTag = osmTag; + this.editValue = editValue; + } + + public String getEditOsmTag() { + if(isReference()) { + return referenceType.getEditOsmTag(); + } + if(editTag == null) { + return getOsmTag(); + } + return editTag; + } + + public String getEditOsmValue() { + if(isReference()) { + return referenceType.getEditOsmValue(); + } + if(editValue == null) { + return getOsmValue(); + } + return editValue; + } public void setOsmTag(String osmTag) { this.osmTag = osmTag; diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 6eaa64d670..703034e5fa 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -172,7 +172,7 @@ - + diff --git a/OsmAnd/res/values-az/strings.xml b/OsmAnd/res/values-az/strings.xml index 8b90c759a1..8091df0ac8 100644 --- a/OsmAnd/res/values-az/strings.xml +++ b/OsmAnd/res/values-az/strings.xml @@ -1966,8 +1966,6 @@ İzlər əlavə et və qeyd et Baxmaq üçün izləri qeyd edin və ya idxal edin. Fayl adını daxil edin. - • -\n Aktiv işarələrə qədər məsafənin necə göstəriləcəyini seçin. İrəlidə tunel Mövqeyinizdən aktiv işarə məkanlarına bələdçi xətlərini göstər. diff --git a/OsmAnd/res/values-b+ast/strings.xml b/OsmAnd/res/values-b+ast/strings.xml index 98a6112fbd..a0eb50f084 100644 --- a/OsmAnd/res/values-b+ast/strings.xml +++ b/OsmAnd/res/values-b+ast/strings.xml @@ -1050,15 +1050,11 @@ Puntos Más aiciones Ficheru GPX con coordenaes y datos de les notes esbillaes. Ficheru GPX con coordenaes y datos de toles notes. - \\022 Nuevu menú Viaxe : consultar los artículos de WikiVoyage ensin conexón -\n -\n • Wikipedia : nuevu aspeutu, imaxes -\n -\n • Interfazd\'apertura de traces : ver grupos de puntos de ruta -\n -\n • Marcadores del mapa : importar grupos seleicionaos dende ficheros GPX, nuevu aspeutu de la entrada de coordenaes -\n -\n • La suscripción a OsmAnd Live agora incluye toles funciones d\'OsmAnd + Nuevu menú Viaxe : consultar los artículos de WikiVoyage ensin conexón +\u2022 Wikipedia, Wikivoyage : nuevu aspeutu, imaxes +\u2022 Interfazd\'apertura de traces : ver grupos de puntos de ruta +\u2022 Marcadores del mapa : importar grupos seleicionaos dende ficheros GPX, nuevu aspeutu de la entrada de coordenaes +\u2022 La suscripción a OsmAnd Live agora incluye toles funciones d\'OsmAnd \n Cambiar la consulta de la gueta. Aiciones diff --git a/OsmAnd/res/values-be-rBY/strings.xml b/OsmAnd/res/values-be-rBY/strings.xml index 65b8e852f6..67ccd60ebf 100644 --- a/OsmAnd/res/values-be-rBY/strings.xml +++ b/OsmAnd/res/values-be-rBY/strings.xml @@ -2918,9 +2918,6 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd Rabi natatki! Dadajcie aŭdyjo-, videa- ci fotanatatku na lubuju kropku na mapie, vykarystoŭvajučy vidžet ci kantekstnaje mieniu. Źmianicie pošukavy zapyt. - \\022 -\n -\n Što tut: pryparkavany na Uziać da diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 72047f5ae3..e6af9bc3c5 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -3004,9 +3004,6 @@ Рабі нататкі! Дадайце аўдыё-, відэа- ці фотанататку на любую кропку на мапе, выкарыстоўваючы віджэт ці кантэкстнае меню. Зьмяніце пошукавы запыт. - \\022 -\n -\n Што тут: прыпаркаваны на Узяць да @@ -3014,11 +3011,6 @@ Чытаць увесь артыкул Чытаць артыкул Усе кропкі групы - - - - - Дадатковыя дзеяньні GPX-файл з каардынатамі і данымі выбраных нататак. GPX-файл з каардынатамі і данымі ўсіх нататак. diff --git a/OsmAnd/res/values-bg/strings.xml b/OsmAnd/res/values-bg/strings.xml index c664e054b4..ce94ae343e 100644 --- a/OsmAnd/res/values-bg/strings.xml +++ b/OsmAnd/res/values-bg/strings.xml @@ -2204,8 +2204,6 @@ Допълнителни действия GPX файл с координати и данни от избрани бележки. GPX файл с координати и данни от всички бележки. - \\022 -\n Променете заявката за търсене. Действия Маркер diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 8f1360febc..8eb6a0b938 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -2724,7 +2724,7 @@ Abasta l\'àrea: %1$s x %2$s Per data Per tipus Modifica la consulta de cerca. - \\022 Nou menú Viatge: consulta articles de Viquiviatges sense internet + Nou menú Viatge: consulta articles de Viquiviatges sense internet \n \n• Viquipèdia: nova imatge, enllaços actius, imatges \n diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 8baee63e98..ff920da30a 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -2725,9 +2725,6 @@ Zobrazená oblast: %1$s x %2$s Klepnutím nebo přidržením označte \'Místa\', pak klepněte na tlačítko značky s vlajkou. Upravit vyhledávací dotaz. Jedním klepnutím aktivní - \\022 -\n -\n Popisky bodů Bez názvu Co je zde: diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 2f539d410d..e25c1bb2f5 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -45,7 +45,7 @@ GPX-Aufzeichnung bei Bedarf Generelle Positionserfassung kann mit der Schaltfläche \'GPX-Aufzeichnung\' direkt auf dem Kartenbildschirm aktiviert oder deaktiviert werden. Track jetzt speichern - Aktuellen Track jetzt auf Speicherkarte speichern. + Aktuellen Track jetzt als GPX-Datei speichern. Während Navigation autom. Track aufzeichnen Während der Navigation wird automatisch ein GPX-Track im Track-Ordner gespeichert. Aufzeichnungsintervall @@ -393,7 +393,7 @@ Aktueller Kartenmittelpunkt Ausgangspunkt: In der Nähe suchen - Als neuen GPX-Track speichern + Als neue GPX-Datei speichern Route erfolgreich gespeichert als \'%1$s\'. Dateiname: Datei mit gleichem Namen besteht bereits. @@ -618,7 +618,7 @@ Sprachansage Offline-Daten wurden nicht geladen - GPX-Track… + GPX-Dateien… GPX-Daten konnten nicht gelesen werden Offline-Vektor-Karten Suche nach Verbindung an Haltestelle @@ -785,7 +785,7 @@ Lade Orte… POI - GPX-Spur konnte nicht gespeichert werden + GPX-Datei konnte nicht gespeichert werden Route konnte nicht berechnet werden Route konnte nicht berechnet werden Berechnete Route ist leer @@ -797,7 +797,7 @@ Daten werden geladen… Lese lokale Daten… Die vorherige Programminstanz war abgestürzt. Logdatei unter {0}. Fehler bitte melden und Logdatei anhängen. - GPX-Track wird auf der SD-Karte gespeichert… + GPX-Datei wird gespeichert… Abgeschlossen Internet zur Routenberechnung verwenden. @@ -1173,7 +1173,7 @@ Proportionaler Speicher %4$s MB (Android Limit %5$s MB, Dalvik %6$s MB).Entfernungsmesser & Streckenplaner Nicht erneut anzeigen - Vorhandene GPX-Spur öffnen + Vorhandene GPX-Datei öffnen Straßennamen in benachbarten Orten suchen Tür-zu-Tür sortieren * Tippen, um einen Punkt zu setzen. @@ -1332,7 +1332,7 @@ Proportionaler Speicher %4$s MB (Android Limit %5$s MB, Dalvik %6$s MB).Zoomtasten bei Navigation anzeigen. Zoomtasten anzeigen Keine Downloads gefunden, bitte die Internet-Verbindung überprüfen. - Keine GPX-Datei ausgewählt. Zum Auswählen lange auf einen vorhandenen Track drücken. + Keine GPX-Datei ausgewählt. Auswahl durch langes Drücken auf eine vorhandenen Datei. Zum Anzeigen auswählen Gebäude @@ -1496,7 +1496,7 @@ Proportionaler Speicher %4$s MB (Android Limit %5$s MB, Dalvik %6$s MB).Darstellungsfarbe - GPX-Track ist leer + GPX-Datei ist leer Wegpunkte: %1$s Strecke: %1$s (%2$s Punkte) Startzeit: %1$tF, %1$tT @@ -2299,7 +2299,7 @@ Derzeit sind nur {2} MB verfügbar. Erforderlich, um Karten herunterzuladen. Standort wird gesucht … Freier Speicherplatz - OsmAnd speichert Daten (Karten, Tracks, usw.) in \'%1$s\'. + OsmAnd speichert Daten (Karten, GPX-Dateien, usw.) in \'%1$s\'. Berechtigung erteilen Standortbestimmung zulassen Erhalten Sie Wegbeschreibungen und entdecken Sie neue Orte ohne Internetverbindung @@ -2373,9 +2373,9 @@ Derzeit sind nur {2} MB verfügbar. Aussehen Routenberechnung - Sie haben noch keine Tracks - Tracks können dem Ordner hinzugefügt werden - Track hinzufügen + Sie haben noch keine GPX-Dateien + GPX-Dateien können dem Ordner hinzugefügt werden + GPX-Datei hinzufügen POI hochladen Nehmen Sie die %1$d Ausfahrt Suche Stadt oder Region @@ -2518,7 +2518,7 @@ Abgedeckte Fläche: %1$s x %2$s Gesamtstrecke Fahrweise - Track-Ordner wählen + GPX-Datei-Ordner wählen Datei kann nicht verschoben werden. Verschieben Spuren @@ -2530,7 +2530,7 @@ Abgedeckte Fläche: %1$s x %2$s Farbe Höchstgeschwindigkeit Durchschnittsgeschwindigkeit - Spur + GPX-Datei Punkt(e) gelöscht. Es werden %1$d Punkt(e) gelöscht. Fortfahren? Wegpunkte, POI, markierte Orte @@ -2828,14 +2828,14 @@ Abgedeckte Fläche: %1$s x %2$s Navigationsprofil wählen Routenpunkte hinzufügen Strecke hinzufügen - Tracks hinzufügen und aufzeichnen - Tracks aufzeichnen oder importieren. + GPX-Dateien hinzufügen + GPX-Dateien importieren oder Tracks aufzeichnen. Favoriten hinzufügen - Importieren oder markieren Sie Favoriten auf der Karte. - Track importieren + Favoriten importieren, oder durch Markieren von Punkten auf der Karte erstellen. + GPX-Datei importieren Die Datei %1$s enthält keine Wegpunkte, soll sie als Track importiert werden? Punkt verschieben - Zu einem GPX-Track hinzufügen + Zu einer GPX-Datei hinzufügen Keine Animationen Deaktiviert Animationen in der App. Weiterhin auf der Karte anzeigen @@ -2873,8 +2873,8 @@ Abgedeckte Fläche: %1$s x %2$s Sortieren Koordinateneingabe gespeichert - Markierungen in die hier festgelegte Datei exportieren: - Als Track speichern + Markierungen in die hier festgelegte GPX-Datei exportieren: + Als GPX-Datei speichern In den Verlauf verschieben Die Gruppe wird beim nächsten Start der App entfernt. Passierte anzeigen @@ -2958,7 +2958,7 @@ Abgedeckte Fläche: %1$s x %2$s Nächstes Feld Markierung umbenennen Markierung passiert - Track-Wegpunkte + GPX-Wegpunkte Suchanfrage verändern. Erstellen oder ändern von OSM-Objekten OSM-POI erstellen oder verändern, OSM-Notizen eröffnen oder bearbeiten, und aufgezeichnete GPX-Dateien hinzufügen. @@ -2970,7 +2970,7 @@ Abgedeckte Fläche: %1$s x %2$s Machen Sie sich Notizen! Nach Datum Nach Typ - kann als Favorit oder Track importiert werden. + kann als Favoriten oder GPX-Datei importiert werden. Audio-, Video- oder Fotonotizen zu jedem Punkt auf der Karte über Bedienelement oder Kontextmenü hinzufügen. Notizen nach Datum Ein Tippen auf die Karte schaltet die Steuerschaltflächen und Bedienelemente um. @@ -2997,11 +2997,11 @@ Abgedeckte Fläche: %1$s x %2$s GPX-Datei mit Koordinaten und Daten aller Notizen. Aktionen Markierung - Durch Auswahl eines dieser Tracks können die darin enthaltenen Wegpunkte zu den Markierungen hinzuzugefügt werden. + Wählen Sie eine GPX-Datei für das Hinzufügen der enthaltenen Punkte zu den Markierungen. Wählen Sie eine Favoritenkategorie aus, die Sie den Markierungen hinzufügen möchten. - Importieren Sie Gruppen aus Favoriten oder Track-Wegpunkten. + Importieren Sie Gruppen aus Favoriten oder GPX-Wegpunkten. Tippen Sie \'Orte\' lang oder kurz an, tippen Sie anschließend auf das Markierungszeichen. - Importieren Sie Favoritengruppen oder Track-Wegpunkte als Markierungen. + Importieren Sie Favoritengruppen oder GPX-Wegpunkte als Markierungen. Richtungsanzeiger von Ihrem Standort zu aktiven Markierungspunkten einblenden. Ein oder zwei Pfeile anzeigen, die die Richtung zu den aktiven Markierungen angeben. Wählen Sie aus, wie der Abstand zu aktiven Markierungen angezeigt werden soll. diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml index 0881824788..b5f1d7b444 100644 --- a/OsmAnd/res/values-el/strings.xml +++ b/OsmAnd/res/values-el/strings.xml @@ -1814,7 +1814,7 @@ Πρόσθετες ενέργειες Αρχείο GPX με συντεταγμένες και δεδομένα από τις επιλεγμένες σημειώσεις. Αρχείο GPX με συντεταγμένες και δεδομένα από όλες τις σημειώσεις. - \\022 Νέο ταξιδιωτικό μενού: προβολή άρθρων βικιταξίδια χωρίς χρήση διαδικτύου + Νέο ταξιδιωτικό μενού: προβολή άρθρων βικιταξίδια χωρίς χρήση διαδικτύου \n \n • Βικιπαίδεια: νέα όψη, ενεργοί σύνδεσμοι, εικόνες \n diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml index 15e887d5de..941d549716 100644 --- a/OsmAnd/res/values-eu/strings.xml +++ b/OsmAnd/res/values-eu/strings.xml @@ -2945,9 +2945,6 @@ Area honi dagokio: %1$s x %2$s Izenik gabe Hautatutako oharren koordenatuak eta datuak dituen GPX fitxategia. Ohar guztien koordenatuak eta datuak dituen GPX fitxategia. - \\022 -\n -\n Aldatu bilaketaren galdera. Ekintzak Markatzailea diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index f89391279a..6d2e23ae3a 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -3038,7 +3038,7 @@ représentant la zone : %1$s x %2$s Par date Par type Modifier la recherche. - \\022 Nouveau Menu Voyage : consulter les articles WikiVoyage hors connexion + Nouveau Menu Voyage : consulter les articles WikiVoyage hors connexion \n \n • Wikipedia : nouvelle apparence, images \n diff --git a/OsmAnd/res/values-he/strings.xml b/OsmAnd/res/values-he/strings.xml index 958064829b..0e331c19a2 100644 --- a/OsmAnd/res/values-he/strings.xml +++ b/OsmAnd/res/values-he/strings.xml @@ -2536,7 +2536,7 @@ הפעלת הנפשת גלישת מפה של ה‚מיקום שלי’ במהלך ניווט. ב־%1$s ניתן לגעת בסמן על המפה כדי להעביר אותו לראש הסמנים הפעילים מבלי לפתוח את תפריט ההקשר. - \\022 תפריט טיולים חדש: הצגת ערכים מוויקימסע ללא שימוש באינטרנט + תפריט טיולים חדש: הצגת ערכים מוויקימסע ללא שימוש באינטרנט \n \n • ויקיפדיה: מראה חדש, קישורים פעילים, תמונות \n diff --git a/OsmAnd/res/values-hy/strings.xml b/OsmAnd/res/values-hy/strings.xml index 637d289caf..afd824b91d 100644 --- a/OsmAnd/res/values-hy/strings.xml +++ b/OsmAnd/res/values-hy/strings.xml @@ -2633,8 +2633,7 @@ Լրացուցիչ գործողություններ GPX ֆայլը կոորդինատներով և ընտրված գրառումների տվյալներով: GPX ֆայլը կոորդինատներով և բոլոր նշումների տվյալները։ - \\022 -\n + \nՆոր Ճամփորդության մենյու. Դիտեք WikiVoyage- ի հոդվածները առանց ինտերնետի օգտագործման \n \n • Wikipedia՝ նոր տեսք, ակտիվ հղումներ, պատկերներ diff --git a/OsmAnd/res/values-id/strings.xml b/OsmAnd/res/values-id/strings.xml index 3598bfdf34..cb9e8bbb91 100644 --- a/OsmAnd/res/values-id/strings.xml +++ b/OsmAnd/res/values-id/strings.xml @@ -73,7 +73,7 @@ Harap beli berlangganan OSM Live terlebih dahulu Urutkan dengan - \\022 mendeteksi tanda Berhenti sekarang dan beranggapan itu arah mengemudi. + mendeteksi tanda Berhenti sekarang dan beranggapan itu arah mengemudi. \n \n• algoritma baru memberikan nilai pendakian/turunan yang bermakna trek GPX. \n diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index 1a649316ee..13d0ede602 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -2567,7 +2567,7 @@ Stendur fyrir svæði: %1$s x %2$s Reikna leiðir yfir langar fjarlægðir sem hugsanlega eru ekki þær bestu GPX-skrá með hnitum og gögnum valinna minnispunkta. GPX-skrá með hnitum og gögnum allra minnispunkta. - \\022 Ný ferðavalmynd: skoða WikiVoyage-greinar án internet-tengingar + Ný ferðavalmynd: skoða WikiVoyage-greinar án internet-tengingar \n \n • Wikipedia: nýtt útlit, virkir tenglar, myndir \n diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 57187968c4..2ed0963bbb 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2980,9 +2980,6 @@ Rappresenta l\'area: %1$s x %2$s Note ordinate per data Per data Per tipo - \\022 -\n -\n Modifica la richiesta di ricerca. Pedone, escursionismo, visita della città • La mappa mostra i percorsi pedonali ed escursionistici • Wikipedia nel tuo linguaggio preferito può dirti molto nelle visite alle città • Fermate dei trasporti pubblici (bus, tram, treni), inclusi i nomi delle linee, aiuta a navigare in una nuova città • Nella navigazione GPS nella modalità pedone costruisce il tuo percorso usando i sentieri • Puoi caricare e seguire un percorso GPX o registrarne uno e condividerlo Cosa c\'è qui: diff --git a/OsmAnd/res/values-ku/strings.xml b/OsmAnd/res/values-ku/strings.xml index ed149d6d6b..4828d836c3 100644 --- a/OsmAnd/res/values-ku/strings.xml +++ b/OsmAnd/res/values-ku/strings.xml @@ -141,9 +141,6 @@ Bk Hemû daneyan "Gotarê bixwîne " - \\022 -\n -\n Jêbirî "Guhertî " Bêhtir diff --git a/OsmAnd/res/values-lt/strings.xml b/OsmAnd/res/values-lt/strings.xml index d6f5428c7b..de0b723a49 100644 --- a/OsmAnd/res/values-lt/strings.xml +++ b/OsmAnd/res/values-lt/strings.xml @@ -2801,7 +2801,7 @@ Tai yra puikus būdas paremti OsmAnd ir OSM, jei jie jums patinka. Papildomi veiksmai GPX failas su koordinačių ir pasirinktų pastabų duomenimis. GPX failas su koordinačių ir visų pastabų duomenimis. - \\022 Stop ženklo nutatymas atliekamas atsižvelgiant į judėjimo kryptį + Stop ženklo nutatymas atliekamas atsižvelgiant į judėjimo kryptį \n \n• Naujas algoritmas, pateikiantis prasmingas pakilimo/nusileidimo vertes GPX trekams \n diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 3814ca0ea5..73c90c9966 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -2604,9 +2604,6 @@ Velg hvordan avstanden til aktive markører skal vises. Velg antall aktive markører som skal vises. Et trykk på kartet skjuler/viser kontrollknappene og miniprogrammene. - \\022 -\n -\n Marker som passert Kunne ikke endre notatet Trykking på denne handlingsknappen slår av/på automatisk kartforstørrelse i henhold til hastigheten din. diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 090f8f3e00..4a487fd716 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -2922,9 +2922,6 @@ Reprezentuje obszar: %1$s x %2$s Zostanie otwarty o Zostanie otwarty o Dodatkowe czynności - \\022 -\n -\n Czynności Znacznik Uaktywniono znacznik %s. diff --git a/OsmAnd/res/values-ro/strings.xml b/OsmAnd/res/values-ro/strings.xml index 472de26241..6353786034 100644 --- a/OsmAnd/res/values-ro/strings.xml +++ b/OsmAnd/res/values-ro/strings.xml @@ -1912,7 +1912,6 @@ Acțiuni adiționale Fișier GPX cu datele și coordonatele notelor selectate. Fișier GPX cu datele și coordonatele tuturor notelor. - \\022 Modifică criteriul de căutare. Acțiuni Marcaj diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index 2caa3b36a7..c523069192 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -3017,7 +3017,7 @@ Pro praghere iscrie su còdighe intreu Pro data Pro casta Modìfica sa rechesta de chirca. - \\022 Menù de biàgiu nou: abbàida sos artìculos de WikiVoyage chene impreare sa connessione a ìnternet + Menù de biàgiu nou: abbàida sos artìculos de WikiVoyage chene impreare sa connessione a ìnternet \n \n • Wikipedia: aspetu nou, ligàmenes ativos, immàgines \n diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 1ec67aa686..83a7170b8e 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -2859,7 +2859,7 @@ Zodpovedá oblasti: %1$s x %2$s Podľa typu Jedno stlačenie aktívne Upraviť vyhľadávacie kritériá. - \\022 Nové menu Cestovanie: zobrazte si články WikiVoyage bez použitia Internetu + Nové menu Cestovanie: zobrazte si články WikiVoyage bez použitia Internetu \n \n • Wikipédia: nový vzhľad, aktívne linky, obrázky \n diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml index c348461886..563fd19c1f 100644 --- a/OsmAnd/res/values-sl/strings.xml +++ b/OsmAnd/res/values-sl/strings.xml @@ -2924,9 +2924,6 @@ Koda predstavlja območje: %1$s x %2$s \n • Orodje za merjenje razdalje sedaj omogoča prilagajanje potem in shranjevanje točk kot sledi \n \n • OsmAnd Live: razrešeni hrošči in posodobitve, ki so samodejno vključene v navigacijo, se objavljajo vsakih 30 minut -\n - \\022 -\n \n Ustvari ali spremeni točke POI, ureja opombe OSM in omogoča objavljanje zabeleženih sledi GPX. Samodejno preklopi na naslednje polje, ko je vpisana %1$d decimalka. diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml index 0f45acc177..83693179cd 100644 --- a/OsmAnd/res/values-sr/strings.xml +++ b/OsmAnd/res/values-sr/strings.xml @@ -1749,7 +1749,7 @@ Додаје прво стајање Прикажи/Сакриј ОСМ белешке на карти. GPX фајл - \\022 Нови турустички мени: гледајте WikiVoyage чланке без коришћења интернета + Нови турустички мени: гледајте WikiVoyage чланке без коришћења интернета \n \n • Википедија: нови изглед, активне везе, слике \n diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml index 9c2afcb0ec..cc3e3c567f 100644 --- a/OsmAnd/res/values-sv/strings.xml +++ b/OsmAnd/res/values-sv/strings.xml @@ -2729,9 +2729,6 @@ Vänligen tillhandahåll fullständig kod Ytterligare åtgärder GPX-fil med koordinater och data för valda anteckningar. GPX-fil med koordinater och data för alla anteckningar. - \\022 -\n -\n Åtgärder Markör Tryck på en markör på kartan för att flytta den till toppen av de aktiva markörerna utan att öppna sammanhangsmenyn. diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 0bb32db523..2dc5706dcc 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -3095,7 +3095,6 @@ За датою За типом Змінити пошуковий запит. - "• " Що тут: припаркований біля Забрати до diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index 92b9ed32f4..5725bfca5d 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -2668,9 +2668,6 @@ 额外的活动 GPX文件,包含所选笔记的坐标和数据。 GPX文件,包含所有注释的坐标和数据。 - \\022 -\n -\n 修改搜索查询。 操作 标记 diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 528f07ac70..07f554c080 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -3019,7 +3019,7 @@ 按照類型 輕點在地圖上的標記,將其移動到活動標記的頂端,而不用打開內容選單。 變更搜尋的查詢。 - \\022 新的旅行選單:檢視不用網路的維基導遊文章 + 新的旅行選單:檢視不用網路的維基導遊文章 \n \n• 維基百科:嶄新的面貌、活動連結、圖片 \n diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2b5fd1c8d7..e51d42d890 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -57,30 +57,27 @@ Once purchased, it will be permanently available to you. Buy - %1$s Subscribe - %1$s - Wikivoyage offline - Unlimited downloads Wikipedia offline Contour lines & Hillshade maps Unlock all OsmAnd features - Choose plan Purchase one of the following to read travel articles offline: Choose suitable item: Don\'t Do Only on Wi-Fi - Download Pictures - Images from articles can be downloaded for offline use.\n + Download images + Images for articles can be downloaded for offline use.\n You can always change the setting in \'Explore\' → \'Options\'. Only on Wi-Fi Select travel book Travel book Page only available online. Open in web browser? - Images cache + Image cache Delete search history - Show images + Download images Travel guides Wikivoyage Article removed @@ -153,11 +150,11 @@ GPX file with coordinates and data of the selected notes. GPX file with coordinates and data of all notes. - \u2022 New Travel menu: view WikiVoyage articles without using the internet\n\n - \u2022 Wikipedia: new look, active links, images\n\n - \u2022 Open Track UI: display waypoint groups\n\n - \u2022 Map markers: import of selected groups from GPX files, coordinate input new look\n\n - \u2022 OsmAnd Live subscription now includes all OsmAnd features\n\n + \u2022 New travel guide functionality: Global offline Wikivoyage articles\n\n + \u2022 Wikipedia: New look, active links, images now supported\n\n + \u2022 Open Track UI: Support for waypoint groups\n\n + \u2022 Map markers: Import of selected groups from GPX files, coordinate input, new look\n\n + \u2022 OsmAnd Live data (subscription) now supports all OsmAnd features\n\n Modify the search query. Actions @@ -175,19 +172,19 @@ Notes by date By date By type - Looking for tracks with waypoints + Looking for GPX files with waypoints More Appearance on the map - Waypoints can be added to markers by selecting one of these tracks that has them. + Select a GPX file to add its waypoints to the markers. Select a favorite category to add to the markers. - Track waypoints + GPX waypoints Favorites category Add a group - Import groups from favorites or track waypoints. + Import groups from favorites or GPX waypoints. Create map markers! Long or short tap \'Places\', then tap the marker flag button. Import groups - Import favorite groups or track waypoints as markers. + Import favorite groups or GPX waypoints as markers. Markers marked as passed will appear on this screen. Two One @@ -207,7 +204,7 @@ A tap on the map toggles the control buttons and widgets. Fullscreen mode Mark passed - can be imported as favorite, or track file. + can be imported as favorite or GPX file. Import as GPX file Import as favorite Import file @@ -243,8 +240,8 @@ Sort Coordinate input is saved - Export your markers to a file you can specify here: - Save as track + Export your markers to the following GPX file: + Save as GPX file Move to history The group will be gone the next time you start the app. Show directional lines @@ -417,7 +414,7 @@ You are going to delete %1$d point(s). Are you sure? Turns to pass on this route Waypoints, points of interest, named features - Track + GPX file Maximum speed Average speed Time moving @@ -426,7 +423,7 @@ Departure Arrival Color - Select track folder + Select GPX file folder File can not be moved. Move Tracks @@ -440,7 +437,7 @@ Total distance Select elevation fluctuation Use elevation data - Use terrain elevation data provided by SRTM, ASTER, and EU-DEM. + Factor in terrain elevation (via SRTM, ASTER, and EU-DEM data). Show depth contours and points. Nautical depth contours @@ -501,9 +498,9 @@ Take %1$d exit and go Upload POI Route calculation - You do not have any tracks yet - You may also add tracks to the folder - Add track + You do not have any GPX files yet + You may also add GPX files to the folder + Add GPX file Appearance Enable recording quick start Display a system notification allowing to start trip recording. @@ -572,7 +569,7 @@ Required to download maps. Searching for location… Free space - OsmAnd\'s data storage (for maps, tracks, etc.): %1$s. + OsmAnd\'s data storage (for maps, GPX files, etc.): %1$s. Grant permission Allow location access Get directions and discover new places without a connection to the Internet @@ -1064,7 +1061,7 @@ Clear Clear all Save - Save as new GPX track + Save as new GPX file Rename Delete Delete all @@ -1100,7 +1097,7 @@ My Position My Places Favorites - Tracks + GPX files Currently recording track Audio Video @@ -1278,8 +1275,8 @@ Log track to GPX file On demand track logging General position logging to a GPX file can be turned on or off using the GPX logging widget on the map screen. - Save current track to memory card now. - Save current GPX track + Save current track as GPX file now. + Save current track Auto-record track during navigation A GPX track is automatically saved to the tracks folder during navigation. Logging interval @@ -1346,7 +1343,7 @@ Show cycle routes Downloads not found, please check your connection to the Internet. Nothing was found. If you can\'t find your region, you can make it yourself (see https://osmand.net). - No GPX files selected. To select one long-tap an available track. + No GPX files selected. Select one by long-tapping. Select to show Split interval Sort by distance @@ -1381,7 +1378,7 @@ %1$s \nRoute points %2$s %1$s \nPoints %1$s \nTrack %2$s - Empty GPX track + Empty GPX file Display color Connect Description @@ -1591,7 +1588,7 @@ Finish editing Begin a new subtrack Clear all points - Open existing GPX track + Open existing GPX file Please wait until current task is finished Reduces noise in compass readings but adds inertia. Use Kalman filter @@ -2421,7 +2418,7 @@ Vector maps were not loaded No GPX files found in the tracks folder - GPX track… + GPX files… Could not read GPX data Offline vector maps Search transport at stop @@ -2567,7 +2564,7 @@ Loading streets… Loading cities… POI - Could not save GPX track + Could not save GPX file Could not calculate route Could not calculate route Calculated route is empty @@ -2578,7 +2575,7 @@ Loading data… Reading local data… Last OsmAnd run crashed. Log file is at {0}. Please report the issue and attach the log file. - Saving GPX tracks to SD… + Saving GPX file… Finished Use the Internet to calculate a route. Use online navigation @@ -2880,14 +2877,14 @@ Save Route Point Waypoint 1 Route Point 1 - Add and Record Tracks - Record or import tracks to view. + Add GPX Files + Import GPX files, or record tracks. Add Favorites - Import or mark favorites on the map. - Import track + Import favorites, or add via marking points on the map. + Import GPX file File %1$s does not contain waypoints, import it as a track? Move Point - Add to a GPX track + Add to a GPX file OSM recipients Total donations off diff --git a/OsmAnd/src/net/osmand/PicassoUtils.java b/OsmAnd/src/net/osmand/PicassoUtils.java index 3f8fb836ce..1389c2dcfe 100644 --- a/OsmAnd/src/net/osmand/PicassoUtils.java +++ b/OsmAnd/src/net/osmand/PicassoUtils.java @@ -13,9 +13,9 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import net.osmand.plus.OsmandApplication; import okhttp3.Cache; import okhttp3.OkHttpClient; - import static android.os.Build.VERSION.SDK_INT; import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2; @@ -24,33 +24,36 @@ public class PicassoUtils { private static final String PICASSO_CACHE = "picasso-cache"; private static final int MIN_DISK_CACHE_SIZE = 5 * 1024 * 1024; // 5MB private static final int MAX_DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB + private static PicassoUtils INSTANCE; - private static Cache diskCache; - private static LruCache memoryCache; + private Cache diskCache; + private LruCache memoryCache; - private static boolean initialized; + private Map cached = new HashMap<>(); + + private PicassoUtils(OsmandApplication app){ + File cacheDir = createDefaultCacheDir(app); - private static Map cached = new HashMap<>(); + diskCache = new Cache(cacheDir, calculateDiskCacheSize(cacheDir)); + memoryCache = new LruCache(app); - public static void setupPicasso(@NonNull Context context) { - if (!initialized) { - File cacheDir = createDefaultCacheDir(context); + Picasso picasso = new Picasso.Builder(app) + .downloader(new OkHttp3Downloader(new OkHttpClient.Builder().cache(diskCache).build())) + .memoryCache(memoryCache) + .build(); - diskCache = new Cache(cacheDir, calculateDiskCacheSize(cacheDir)); - memoryCache = new LruCache(context); + Picasso.setSingletonInstance(picasso); - Picasso picasso = new Picasso.Builder(context) - .downloader(new OkHttp3Downloader(new OkHttpClient.Builder().cache(diskCache).build())) - .memoryCache(memoryCache) - .build(); - - Picasso.setSingletonInstance(picasso); - - initialized = true; - } } - public static void clearAllPicassoCache() { + public static PicassoUtils getPicasso(@NonNull OsmandApplication app) { + if(INSTANCE == null) { + INSTANCE = new PicassoUtils(app); + } + return INSTANCE; + } + + public void clearAllPicassoCache() { if (memoryCache != null) { memoryCache.clear(); } @@ -64,19 +67,19 @@ public class PicassoUtils { cached.clear(); } - public static Boolean isCached(@NonNull String key) { + public Boolean isURLLoaded(@NonNull String key) { return cached.get(key); } - public static void setCached(@NonNull String key, boolean val) { + public void setResultLoaded(@NonNull String key, boolean val) { cached.put(key, val); } - public static void clearCachedMap() { + public void clearCachedMap() { cached.clear(); } - public static long getDiskCacheSizeBytes() throws IOException { + public long getDiskCacheSizeBytes() throws IOException { return diskCache.size(); } diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index c8ba9f2dcc..9f6403fdcc 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -396,7 +396,7 @@ public class TrackActivity extends TabActivity { } OsmandFragmentPagerAdapter pagerAdapter = (OsmandFragmentPagerAdapter) viewPager.getAdapter(); if (pagerAdapter != null && pagerAdapter.getCount() == 0) { - pagerAdapter.addTab(getTabIndicator(R.string.gpx_track, TrackSegmentFragment.class)); + pagerAdapter.addTab(getTabIndicator(R.string.shared_string_tracks, TrackSegmentFragment.class)); pagerAdapter.addTab(getTabIndicator(R.string.points, TrackPointFragment.class)); if (openPointsTab || !hasTrackPoints()) { viewPager.setCurrentItem(1, false); diff --git a/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java b/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java index c0d2a2a974..98aa5cfd1b 100644 --- a/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java +++ b/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java @@ -50,6 +50,8 @@ public interface SQLiteAPI { byte[] getBlob(int ind); boolean isNull(int ind); + + int getColumnIndex(String columnName); void close(); diff --git a/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java b/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java index e30033785e..8ed2827e6b 100644 --- a/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java +++ b/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java @@ -1,11 +1,12 @@ package net.osmand.plus.api; -import net.osmand.plus.OsmandApplication; import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; +import net.osmand.plus.OsmandApplication; + public class SQLiteAPIImpl implements SQLiteAPI { private OsmandApplication app; @@ -84,6 +85,11 @@ public class SQLiteAPIImpl implements SQLiteAPI { return c.isNull(ind); } + @Override + public int getColumnIndex(String columnName) { + return c.getColumnIndex(columnName); + } + @Override public double getDouble(int ind) { diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java index 9a60d06d75..428627128f 100644 --- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java +++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java @@ -361,19 +361,18 @@ public class InAppPurchaseHelper { Purchase liveUpdatesPurchase = inventory.getPurchase(SKU_LIVE_UPDATES); boolean subscribedToLiveUpdates = (liveUpdatesPurchase != null && liveUpdatesPurchase.getPurchaseState() == 0); OsmandPreference subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME; - if (!subscribedToLiveUpdates) { + if (!subscribedToLiveUpdates && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) { if (subscriptionCancelledTime.get() == 0) { subscriptionCancelledTime.set(System.currentTimeMillis()); ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN.set(false); ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN.set(false); - } else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC - && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) { + } else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC) { ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); if (!isDepthContoursPurchased(ctx)) { ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); } } - } else { + } else if (subscribedToLiveUpdates) { subscriptionCancelledTime.set(0L); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index ead498bb4d..75f3e9c747 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -447,7 +447,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter s : editPoiData.getAllTranslatedSubTypes().entrySet()) { - addMapEntryAdapter(subCategories, s.getKey(), s.getValue()); + if(!s.getKey().contains("osmand")) { + addMapEntryAdapter(subCategories, s.getKey(), s.getValue()); + } } final ArrayAdapter adapter; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index a168788001..5b3143da5e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -96,8 +96,8 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { AbstractPoiType abstractPoi = MapPoiTypes.getDefault().getAnyPoiAdditionalTypeByKey(entry.getKey()); if (abstractPoi != null && abstractPoi instanceof PoiType) { PoiType p = (PoiType) abstractPoi; - if (!p.isNotEditableOsm() && !Algorithms.isEmpty(p.getOsmTag())) { - entity.putTagNoLC(p.getOsmTag(), entry.getValue()); + if (!p.isNotEditableOsm() && !Algorithms.isEmpty(p.getEditOsmTag())) { + entity.putTagNoLC(p.getEditOsmTag(), entry.getValue()); } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java index fa8a086283..901d8f2ec1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java @@ -394,8 +394,8 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil { // check whether this is node (because id of node could be the same as relation) if (entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50) { PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType()); - if(poiType.getOsmValue().equals(entity.getTag(poiType.getOsmTag()))) { - entity.removeTag(poiType.getOsmTag()); + if(poiType.getEditOsmValue().equals(entity.getTag(poiType.getEditOsmTag()))) { + entity.removeTag(poiType.getEditOsmTag()); entity.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiType.getTranslation()); } else { // later we could try to determine tags diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java index 75f02de5cd..d264656730 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java @@ -112,7 +112,7 @@ public class AddPOIAction extends QuickAction { if (tag.getKey().equals(EditPoiData.POI_TYPE_TAG)) { final PoiType poiType = editPoiData.getAllTranslatedSubTypes().get(tag.getValue().trim().toLowerCase()); if (poiType != null) { - newNode.putTagNoLC(poiType.getOsmTag(), poiType.getOsmValue()); + newNode.putTagNoLC(poiType.getEditOsmTag(), poiType.getEditOsmValue()); if (poiType.getOsmTag2() != null) { newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index 5fbc18ba4c..e17c31b794 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -260,10 +260,6 @@ public class RouteInfoWidgetsFactory { public TextInfoWidget createTimeControl(final MapActivity map, final boolean intermediate){ final RoutingHelper routingHelper = map.getRoutingHelper(); - final int time = R.drawable.widget_time_day; - final int timeN = R.drawable.widget_time_night; - final int timeToGo = R.drawable.widget_time_to_distance_day; - final int timeToGoN = R.drawable.widget_time_to_distance_night; final OsmandApplication ctx = map.getMyApplication(); final OsmandPreference showArrival = intermediate ? ctx.getSettings().SHOW_INTERMEDIATE_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java index 96d7ea475b..2579405f86 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java @@ -61,7 +61,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme private static final String EMPTY_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4//"; - private long cityId = NO_VALUE; + private long tripId = NO_VALUE; private ArrayList langs; private String selectedLang; private TravelArticle article; @@ -187,10 +187,10 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme updateWebSettings(); populateArticle(); } else if (requestCode == WikivoyageArticleNavigationFragment.OPEN_ARTICLE_REQUEST_CODE) { - long cityId = data.getLongExtra(WikivoyageArticleNavigationFragment.CITY_ID_KEY, -1); + long tripId = data.getLongExtra(WikivoyageArticleNavigationFragment.TRIP_ID_KEY, -1); String selectedLang = data.getStringExtra(WikivoyageArticleNavigationFragment.SELECTED_LANG_KEY); - if (cityId != -1 && !TextUtils.isEmpty(selectedLang)) { - this.cityId = cityId; + if (tripId != -1 && !TextUtils.isEmpty(selectedLang)) { + this.tripId = tripId; this.selectedLang = selectedLang; populateArticle(); } @@ -275,26 +275,26 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme } protected void populateArticle() { - if (cityId == NO_VALUE || langs == null) { + if (tripId == NO_VALUE || langs == null) { Bundle args = getArguments(); if (args != null) { - cityId = args.getLong(CITY_ID_KEY); + tripId = args.getLong(CITY_ID_KEY); langs = args.getStringArrayList(LANGS_KEY); } } - if (cityId == NO_VALUE || langs == null || langs.isEmpty()) { + if (tripId == NO_VALUE || langs == null || langs.isEmpty()) { return; } if (selectedLang == null) { selectedLang = langs.get(0); } articleToolbarText.setText(""); - article = getMyApplication().getTravelDbHelper().getArticle(cityId, selectedLang); + article = getMyApplication().getTravelDbHelper().getArticle(tripId, selectedLang); if (article == null) { return; } articleToolbarText.setText(article.getTitle()); - if (article.getGpxFile() != null) { + if (article.getGpxFile() != null && article.getGpxFile().getPointsSize() > 0) { trackButton.setText(getString(R.string.points) + " (" + article.getGpxFile().getPointsSize() + ")"); webViewClient.setArticle(article); } @@ -350,6 +350,14 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme return sb.toString(); } + public static boolean showInstance(@NonNull OsmandApplication app, + @NonNull FragmentManager fm, + @NonNull String title, + @NonNull String lang) { + long cityId = app.getTravelDbHelper().getArticleId(title, lang); + return showInstance(app, fm, cityId, lang); + } + public static boolean showInstance(@NonNull OsmandApplication app, @NonNull FragmentManager fm, long cityId, @@ -393,7 +401,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme return; } WikivoyageArticleNavigationFragment.showInstance(fm, - WikivoyageArticleDialogFragment.this, cityId, selectedLang); + WikivoyageArticleDialogFragment.this, tripId, selectedLang); } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java index 13b807e514..a827a103a8 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java @@ -36,7 +36,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr public static final String TAG = WikivoyageArticleNavigationFragment.class.getSimpleName(); - public static final String CITY_ID_KEY = "city_id_key"; + public static final String TRIP_ID_KEY = "trip_id_key"; public static final String SELECTED_LANG_KEY = "selected_lang_key"; public static final int OPEN_ARTICLE_REQUEST_CODE = 2; @@ -59,12 +59,12 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr if (savedInstanceState != null) { selectedLang = savedInstanceState.getString(SELECTED_LANG_KEY); - cityId = savedInstanceState.getLong(CITY_ID_KEY); + cityId = savedInstanceState.getLong(TRIP_ID_KEY); } else { Bundle args = getArguments(); if (args != null) { selectedLang = args.getString(SELECTED_LANG_KEY); - cityId = args.getLong(CITY_ID_KEY); + cityId = args.getLong(TRIP_ID_KEY); } } @@ -132,7 +132,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - outState.putLong(CITY_ID_KEY, cityId); + outState.putLong(TRIP_ID_KEY, cityId); outState.putString(SELECTED_LANG_KEY, selectedLang); } @@ -156,7 +156,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr @NonNull String selectedLang) { try { Bundle args = new Bundle(); - args.putLong(CITY_ID_KEY, cityId); + args.putLong(TRIP_ID_KEY, cityId); args.putString(SELECTED_LANG_KEY, selectedLang); WikivoyageArticleNavigationFragment fragment = new WikivoyageArticleNavigationFragment(); if (targetFragment != null) { diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java index b067031273..e84b41be28 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java @@ -1,10 +1,13 @@ package net.osmand.plus.wikivoyage.data; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; + import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.Size; import android.text.TextUtils; - import net.osmand.plus.GPXUtilities.GPXFile; import org.apache.commons.codec.binary.Hex; @@ -14,9 +17,8 @@ public class TravelArticle { private static final String IMAGE_ROOT_URL = "https://upload.wikimedia.org/wikipedia/commons/"; private static final String THUMB_PREFIX = "320px-"; - private static final String REGULAR_PREFIX = "800px-"; + private static final String REGULAR_PREFIX = "1280px-";//1280, 1024, 800 - String id; String title; String content; String isPartOf; @@ -30,9 +32,6 @@ public class TravelArticle { String contentsJson; String aggregatedPartOf; - public String getId() { - return id; - } public String getTitle() { return title; @@ -103,7 +102,17 @@ public class TravelArticle { @NonNull public static String getImageUrl(@NonNull String imageTitle, boolean thumbnail) { + try { + imageTitle = URLDecoder.decode(imageTitle, "UTF-8"); + } catch (UnsupportedEncodingException e) { + System.err.println(e.getMessage()); + } String[] hash = getHash(imageTitle); + try { + imageTitle = URLEncoder.encode(imageTitle, "UTF-8"); + } catch (UnsupportedEncodingException e) { + System.err.println(e.getMessage()); + } String prefix = thumbnail ? THUMB_PREFIX : REGULAR_PREFIX; return IMAGE_ROOT_URL + "thumb/" + hash[0] + "/" + hash[1] + "/" + imageTitle + "/" + prefix + imageTitle; } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index ab8b849d6b..f1fd2e6046 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Random; @@ -47,7 +48,6 @@ public class TravelDbHelper { private static final String ARTICLES_TABLE_NAME = "travel_articles"; private static final String POPULAR_TABLE_NAME = "popular_articles"; - private static final String ARTICLES_COL_ID = "article_id"; private static final String ARTICLES_POP_INDEX = "popularity_index"; private static final String ARTICLES_POP_ORDER = "order_index"; private static final String ARTICLES_COL_TITLE = "title"; @@ -64,7 +64,6 @@ public class TravelDbHelper { private static final String ARTICLES_COL_AGGREGATED_PART_OF = "aggregated_part_of"; private static final String ARTICLES_TABLE_SELECT = "SELECT " + - ARTICLES_COL_ID + ", " + ARTICLES_COL_TITLE + ", " + ARTICLES_COL_CONTENT + ", " + ARTICLES_COL_IS_PART_OF + ", " + @@ -417,7 +416,8 @@ public class TravelDbHelper { } @NonNull - public LinkedHashMap> getNavigationMap(final TravelArticle article) { + public LinkedHashMap> getNavigationMap( + final TravelArticle article) { String lang = article.getLang(); String title = article.getTitle(); if (TextUtils.isEmpty(lang) || TextUtils.isEmpty(title)) { @@ -437,24 +437,25 @@ public class TravelDbHelper { } Map> navMap = new HashMap<>(); SQLiteConnection conn = openConnection(); - Set headers = null; + Set headers = new LinkedHashSet(); Map headerObjs = new HashMap<>(); if (conn != null) { List params = new ArrayList<>(); - StringBuilder query = new StringBuilder("SELECT a.trip_id, a.title, a.lang, a.is_part_of " + - "FROM travel_articles a WHERE is_part_of = ? and lang = ? "); + StringBuilder query = new StringBuilder("SELECT a.trip_id, a.title, a.lang, a.is_part_of " + + "FROM travel_articles a WHERE is_part_of = ? and lang = ? "); params.add(title); params.add(lang); + if (parts != null && parts.length > 0) { - headers = new HashSet<>(Arrays.asList(parts)); + headers.addAll(Arrays.asList(parts)); headers.add(title); - query.append("UNION SELECT a.trip_id, a.title, a.lang, a.is_part_of " + - "FROM travel_articles a WHERE title = ? and lang = ? "); + query.append("UNION SELECT a.trip_id, a.title, a.lang, a.is_part_of " + + "FROM travel_articles a WHERE title = ? and lang = ? "); params.add(parts[0]); params.add(lang); for (String part : parts) { - query.append("UNION SELECT a.trip_id, a.title, a.lang, a.is_part_of " + - "FROM travel_articles a WHERE is_part_of = ? and lang = ? "); + query.append("UNION SELECT a.trip_id, a.title, a.lang, a.is_part_of " + + "FROM travel_articles a WHERE is_part_of = ? and lang = ? "); params.add(part); params.add(lang); } @@ -482,23 +483,21 @@ public class TravelDbHelper { cursor.close(); } LinkedHashMap> res = new LinkedHashMap<>(); - if (parts != null) { - for (String header : parts) { - WikivoyageSearchResult searchResult = headerObjs.get(header); - List results = navMap.get(header); - if (results != null) { - Collections.sort(results, new Comparator() { - @Override - public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) { - return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0)); - } - }); - WikivoyageSearchResult emptyResult = new WikivoyageSearchResult(); - emptyResult.articleTitles.add(header); - emptyResult.tripId = -1; - searchResult = searchResult != null ? searchResult : emptyResult; - res.put(searchResult, results); - } + for (String header : headers) { + WikivoyageSearchResult searchResult = headerObjs.get(header); + List results = navMap.get(header); + if (results != null) { + Collections.sort(results, new Comparator() { + @Override + public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) { + return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0)); + } + }); + WikivoyageSearchResult emptyResult = new WikivoyageSearchResult(); + emptyResult.articleTitles.add(header); + emptyResult.tripId = -1; + searchResult = searchResult != null ? searchResult : emptyResult; + res.put(searchResult, results); } } return res; @@ -567,24 +566,23 @@ public class TravelDbHelper { private TravelArticle readArticle(SQLiteCursor cursor) { TravelArticle res = new TravelArticle(); - res.id = cursor.getString(0); - res.title = cursor.getString(1); + res.title = cursor.getString(0); try { - res.content = Algorithms.gzipToString(cursor.getBlob(2)); + res.content = Algorithms.gzipToString(cursor.getBlob(1)); } catch (IOException e) { LOG.error(e.getMessage(), e); } - res.isPartOf = cursor.getString(3); - res.lat = cursor.isNull(4) ? Double.NaN : cursor.getDouble(4); - res.lon = cursor.isNull(5) ? Double.NaN : cursor.getDouble(5); - res.imageTitle = cursor.getString(6); - res.tripId = cursor.getLong(8); - res.originalId = cursor.isNull(9) ? 0 : cursor.getLong(9); - res.lang = cursor.getString(10); - res.contentsJson = cursor.getString(11); - res.aggregatedPartOf = cursor.getString(12); + res.isPartOf = cursor.getString(2); + res.lat = cursor.isNull(3) ? Double.NaN : cursor.getDouble(3); + res.lon = cursor.isNull(4) ? Double.NaN : cursor.getDouble(4); + res.imageTitle = cursor.getString(5); + res.tripId = cursor.getLong(7); + res.originalId = cursor.isNull(8) ? 0 : cursor.getLong(8); + res.lang = cursor.getString(9); + res.contentsJson = cursor.getString(10); + res.aggregatedPartOf = cursor.getString(11); try { - String gpxContent = Algorithms.gzipToString(cursor.getBlob(7)); + String gpxContent = Algorithms.gzipToString(cursor.getBlob(6)); res.gpxFile = GPXUtilities.loadGPXFile(application, new ByteArrayInputStream(gpxContent.getBytes("UTF-8"))); } catch (IOException e) { LOG.error(e.getMessage(), e); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java index cdba65ad8f..9cfc383277 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java @@ -98,7 +98,6 @@ public class TravelLocalDataHelper { public void addArticleToSaved(@NonNull TravelArticle article) { if (!isArticleSaved(article)) { TravelArticle saved = new TravelArticle(); - saved.tripId = article.tripId; saved.title = article.title; saved.lang = article.lang; saved.aggregatedPartOf = article.aggregatedPartOf; @@ -121,7 +120,7 @@ public class TravelLocalDataHelper { } public void removeArticleFromSaved(@NonNull TravelArticle article) { - TravelArticle savedArticle = getArticle(article.tripId, article.lang); + TravelArticle savedArticle = getArticle(article.title, article.lang); if (savedArticle != null) { savedArticles.remove(savedArticle); dbHelper.removeSavedArticle(savedArticle); @@ -130,7 +129,7 @@ public class TravelLocalDataHelper { } public boolean isArticleSaved(@NonNull TravelArticle article) { - return getArticle(article.tripId, article.lang) != null; + return getArticle(article.title, article.lang) != null; } private void notifySavedUpdated() { @@ -140,9 +139,9 @@ public class TravelLocalDataHelper { } @Nullable - private TravelArticle getArticle(long cityId, String lang) { + private TravelArticle getArticle(String title, String lang) { for (TravelArticle article : savedArticles) { - if (article.tripId == cityId && article.lang != null && article.lang.equals(lang)) { + if (article.title != null && article.title.equals(title) && article.lang != null && article.lang.equals(lang)) { return article; } } @@ -185,7 +184,6 @@ public class TravelLocalDataHelper { " FROM " + HISTORY_TABLE_NAME; private static final String BOOKMARKS_TABLE_NAME = "wikivoyage_saved_articles"; - private static final String BOOKMARKS_COL_CITY_ID = "city_id"; private static final String BOOKMARKS_COL_ARTICLE_TITLE = "article_title"; private static final String BOOKMARKS_COL_LANG = "lang"; private static final String BOOKMARKS_COL_IS_PART_OF = "is_part_of"; @@ -197,7 +195,6 @@ public class TravelLocalDataHelper { private static final String BOOKMARKS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + BOOKMARKS_TABLE_NAME + " (" + - BOOKMARKS_COL_CITY_ID + " long, " + BOOKMARKS_COL_ARTICLE_TITLE + " TEXT, " + BOOKMARKS_COL_LANG + " TEXT, " + BOOKMARKS_COL_IS_PART_OF + " TEXT, " + @@ -208,7 +205,6 @@ public class TravelLocalDataHelper { BOOKMARKS_COL_LON + " double);"; private static final String BOOKMARKS_TABLE_SELECT = "SELECT " + - BOOKMARKS_COL_CITY_ID + ", " + BOOKMARKS_COL_ARTICLE_TITLE + ", " + BOOKMARKS_COL_LANG + ", " + BOOKMARKS_COL_IS_PART_OF + ", " + @@ -286,6 +282,7 @@ public class TravelLocalDataHelper { res.put(item.cityId, item); } while (cursor.moveToNext()); } + cursor.close(); } finally { conn.close(); } @@ -401,10 +398,19 @@ public class TravelLocalDataHelper { SQLiteConnection conn = openConnection(false); if (conn != null) { try { - conn.execSQL("INSERT INTO " + BOOKMARKS_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", - new Object[]{article.tripId, article.title, article.lang, - article.aggregatedPartOf, article.imageTitle, article.content, - travelBook, article.lat, article.lon}); + String query = "INSERT INTO " + BOOKMARKS_TABLE_NAME + " (" + + BOOKMARKS_COL_ARTICLE_TITLE + ", " + + BOOKMARKS_COL_LANG + ", " + + BOOKMARKS_COL_IS_PART_OF + ", " + + BOOKMARKS_COL_IMAGE_TITLE + ", " + + BOOKMARKS_COL_PARTIAL_CONTENT + ", " + + BOOKMARKS_COL_TRAVEL_BOOK + ", " + + BOOKMARKS_COL_LAT + ", " + + BOOKMARKS_COL_LON + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; + conn.execSQL(query, new Object[]{article.title, article.lang, + article.aggregatedPartOf, article.imageTitle, article.content, + travelBook, article.lat, article.lon}); } finally { conn.close(); } @@ -420,10 +426,10 @@ public class TravelLocalDataHelper { if (conn != null) { try { conn.execSQL("DELETE FROM " + BOOKMARKS_TABLE_NAME + - " WHERE " + BOOKMARKS_COL_CITY_ID + " = ?" + + " WHERE " + BOOKMARKS_COL_ARTICLE_TITLE + " = ?" + " AND " + BOOKMARKS_COL_LANG + " = ?" + " AND " + BOOKMARKS_COL_TRAVEL_BOOK + " = ?", - new Object[]{article.tripId, article.lang, travelBook}); + new Object[]{article.title, article.lang, travelBook}); } finally { conn.close(); } @@ -442,11 +448,11 @@ public class TravelLocalDataHelper { private WikivoyageSearchHistoryItem readHistoryItem(SQLiteCursor cursor) { WikivoyageSearchHistoryItem res = new WikivoyageSearchHistoryItem(); - res.cityId = cursor.getLong(0); - res.articleTitle = cursor.getString(1); - res.lang = cursor.getString(2); - res.isPartOf = cursor.getString(3); - res.lastAccessed = cursor.getLong(4); + res.cityId = cursor.getLong(cursor.getColumnIndex(HISTORY_COL_CITY_ID)); + res.articleTitle = cursor.getString(cursor.getColumnIndex(HISTORY_COL_ARTICLE_TITLE)); + res.lang = cursor.getString(cursor.getColumnIndex(HISTORY_COL_LANG)); + res.isPartOf = cursor.getString(cursor.getColumnIndex(HISTORY_COL_IS_PART_OF)); + res.lastAccessed = cursor.getLong(cursor.getColumnIndex(HISTORY_COL_LAST_ACCESSED)); return res; } @@ -454,14 +460,13 @@ public class TravelLocalDataHelper { private TravelArticle readSavedArticle(SQLiteCursor cursor) { TravelArticle res = new TravelArticle(); - res.tripId = cursor.getLong(0); - res.title = cursor.getString(1); - res.lang = cursor.getString(2); - res.aggregatedPartOf = cursor.getString(3); - res.imageTitle = cursor.getString(4); - res.content = cursor.getString(5); - res.lat = cursor.getDouble(6); - res.lon = cursor.getDouble(7); + res.title = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_ARTICLE_TITLE)); + res.lang = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_LANG)); + res.aggregatedPartOf = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_IS_PART_OF)); + res.imageTitle = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_IMAGE_TITLE)); + res.content = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_PARTIAL_CONTENT)); + res.lat = cursor.getDouble(cursor.getColumnIndex(BOOKMARKS_COL_LAT)); + res.lon = cursor.getDouble(cursor.getColumnIndex(BOOKMARKS_COL_LON)); return res; } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index 9af1da3336..a6892c847b 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -31,6 +31,8 @@ public class ExploreRvAdapter extends RecyclerView.Adapter items = new ArrayList<>(); + private TravelDownloadUpdateCard downloadCard; + private TravelNeededMapsCard neededMapsCard; @NonNull @Override @@ -137,13 +139,21 @@ public class ExploreRvAdapter extends RecyclerView.Adapter position && items.get(position).getCardType() == TravelNeededMapsCard.TYPE; } - public void setDownloadUpdateCard(TravelDownloadUpdateCard card) { + public void addDownloadUpdateCard(TravelDownloadUpdateCard card) { + this.downloadCard = card; if (addItem(getDownloadUpdateCardPosition(), card)) { notifyDataSetChanged(); } } - public void updateDownloadUpdateCard() { + public void updateDownloadUpdateCard(boolean onlyProgress) { + if(onlyProgress) { + TravelDownloadUpdateCard dc = this.downloadCard; + if(dc != null) { + dc.updateProgresBar(); + } + return; + } int pos = getDownloadUpdateCardPosition(); if (downloadUpdateCardExists(pos)) { notifyItemChanged(pos); @@ -183,6 +202,7 @@ public class ExploreRvAdapter extends RecyclerView.Adapter ref; private ClickListener listener; @@ -62,6 +63,7 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { if (viewHolder instanceof DownloadUpdateVH) { boolean loading = isLoading(); DownloadUpdateVH holder = (DownloadUpdateVH) viewHolder; + this.ref = new WeakReference(holder); holder.title.setText(getTitle(loading)); holder.icon.setImageDrawable(getIcon()); holder.description.setText(getDescription()); @@ -73,18 +75,29 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { holder.fileTitle.setText(getFileTitle()); holder.fileDescription.setText(getFileDescription()); holder.progressBar.setVisibility(loading ? View.VISIBLE : View.GONE); - if (isLoadingInProgress()) { - int progress = app.getDownloadThread().getCurrentDownloadingItemProgress(); - holder.progressBar.setProgress(progress < 0 ? 0 : progress); - } else { - holder.progressBar.setProgress(0); - } + updateProgressBar(holder); } boolean primaryBtnVisible = updatePrimaryButton(holder, loading); boolean secondaryBtnVisible = updateSecondaryButton(holder, loading); holder.buttonsDivider.setVisibility(primaryBtnVisible && secondaryBtnVisible ? View.VISIBLE : View.GONE); } } + + public void updateProgresBar() { + DownloadUpdateVH holder = ref.get(); + if (holder != null && holder.itemView.isShown()) { + updateProgressBar(holder); + } + } + + private void updateProgressBar(DownloadUpdateVH holder) { + if (isLoadingInProgress()) { + int progress = app.getDownloadThread().getCurrentDownloadingItemProgress(); + holder.progressBar.setProgress(progress < 0 ? 0 : progress); + } else { + holder.progressBar.setProgress(0); + } + } @Override public int getCardType() { diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java index 0b722b7e5d..28636655bf 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java @@ -10,14 +10,15 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; - import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.IndexItem; +import net.osmand.plus.wikivoyage.explore.travelcards.TravelDownloadUpdateCard.DownloadUpdateVH; +import java.lang.ref.WeakReference; import java.util.List; public class TravelNeededMapsCard extends BaseTravelCard { @@ -29,7 +30,7 @@ public class TravelNeededMapsCard extends BaseTravelCard { private Drawable downloadIcon; private Drawable cancelIcon; - + private WeakReference ref; private CardListener listener; private View.OnClickListener onItemClickListener; @@ -57,64 +58,75 @@ public class TravelNeededMapsCard extends BaseTravelCard { public void bindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) { if (viewHolder instanceof NeededMapsVH) { NeededMapsVH holder = (NeededMapsVH) viewHolder; - + ref = new WeakReference(holder); holder.description.setText(isInternetAvailable() ? R.string.maps_you_need_descr : R.string.no_index_file_to_download); adjustChildCount(holder.itemsContainer); - boolean paidVersion = Version.isPaidVersion(app); - - for (int i = 0; i < items.size(); i++) { - IndexItem item = items.get(i); - boolean downloading = downloadThread.isDownloading(item); - boolean currentDownloading = downloading && downloadThread.getCurrentDownloadingItem() == item; - boolean lastItem = i == items.size() - 1; - View view = holder.itemsContainer.getChildAt(i); - - if (item.isDownloaded()) { - view.setOnClickListener(null); - } else { - view.setTag(item); - view.setOnClickListener(onItemClickListener); - } - - ((ImageView) view.findViewById(R.id.icon)) - .setImageDrawable(getActiveIcon(item.getType().getIconResource())); - ((TextView) view.findViewById(R.id.title)) - .setText(item.getVisibleName(app, app.getRegions(), false)); - ((TextView) view.findViewById(R.id.description)).setText(getItemDescription(item)); - - ImageView iconAction = (ImageView) view.findViewById(R.id.icon_action); - Button buttonAction = (Button) view.findViewById(R.id.button_action); - if (item.isDownloaded()) { - iconAction.setVisibility(View.GONE); - buttonAction.setVisibility(View.GONE); - } else { - boolean showBtn = !paidVersion && item.getType() == DownloadActivityType.WIKIPEDIA_FILE; - iconAction.setVisibility(showBtn ? View.GONE : View.VISIBLE); - buttonAction.setVisibility(showBtn ? View.VISIBLE : View.GONE); - if (!showBtn) { - iconAction.setImageDrawable(downloading ? cancelIcon : downloadIcon); - } - } - - ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); - progressBar.setVisibility(downloading ? View.VISIBLE : View.GONE); - if (currentDownloading) { - int progress = downloadThread.getCurrentDownloadingItemProgress(); - progressBar.setProgress(progress < 0 ? 0 : progress); - } else { - progressBar.setProgress(0); - } - - view.findViewById(R.id.divider).setVisibility(lastItem ? View.GONE : View.VISIBLE); - } + updateView(holder); boolean primaryBtnVisible = updatePrimaryButton(holder); boolean secondaryBtnVisible = updateSecondaryButton(holder); holder.buttonsDivider.setVisibility(primaryBtnVisible && secondaryBtnVisible ? View.VISIBLE : View.GONE); } } + + public void updateView() { + NeededMapsVH holder = ref.get(); + if (holder != null && holder.itemView.isShown()) { + updateView(holder); + } + } + + private void updateView(NeededMapsVH holder) { + boolean paidVersion = Version.isPaidVersion(app); + + for (int i = 0; i < items.size(); i++) { + IndexItem item = items.get(i); + boolean downloading = downloadThread.isDownloading(item); + boolean currentDownloading = downloading && downloadThread.getCurrentDownloadingItem() == item; + boolean lastItem = i == items.size() - 1; + View view = holder.itemsContainer.getChildAt(i); + + if (item.isDownloaded()) { + view.setOnClickListener(null); + } else { + view.setTag(item); + view.setOnClickListener(onItemClickListener); + } + + ((ImageView) view.findViewById(R.id.icon)) + .setImageDrawable(getActiveIcon(item.getType().getIconResource())); + ((TextView) view.findViewById(R.id.title)) + .setText(item.getVisibleName(app, app.getRegions(), false)); + ((TextView) view.findViewById(R.id.description)).setText(getItemDescription(item)); + + ImageView iconAction = (ImageView) view.findViewById(R.id.icon_action); + Button buttonAction = (Button) view.findViewById(R.id.button_action); + if (item.isDownloaded()) { + iconAction.setVisibility(View.GONE); + buttonAction.setVisibility(View.GONE); + } else { + boolean showBtn = !paidVersion && item.getType() == DownloadActivityType.WIKIPEDIA_FILE; + iconAction.setVisibility(showBtn ? View.GONE : View.VISIBLE); + buttonAction.setVisibility(showBtn ? View.VISIBLE : View.GONE); + if (!showBtn) { + iconAction.setImageDrawable(downloading ? cancelIcon : downloadIcon); + } + } + + ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); + progressBar.setVisibility(downloading ? View.VISIBLE : View.GONE); + if (currentDownloading) { + int progress = downloadThread.getCurrentDownloadingItemProgress(); + progressBar.setProgress(progress < 0 ? 0 : progress); + } else { + progressBar.setProgress(0); + } + + view.findViewById(R.id.divider).setVisibility(lastItem ? View.GONE : View.VISIBLE); + } + } @Override public int getCardType() {