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

This commit is contained in:
Chumva 2018-05-17 10:23:49 +03:00
commit f0740b984a
64 changed files with 378 additions and 337 deletions

View file

@ -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<String, PoiType> 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<AbstractPoiType> getAllTypesTranslatedNames(StringMatcher matcher) {
List<AbstractPoiType> tm = new ArrayList<AbstractPoiType>();
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")));

View file

@ -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;

View file

@ -172,7 +172,7 @@
<receiver android:name="net.osmand.plus.audionotes.MediaRemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.CAMERA_BUTTON" />
<action android:name="android.intent.action.MEDIA_BUTTON" />
<!-- <action android:name="android.intent.action.MEDIA_BUTTON" /> -->
</intent-filter>
</receiver>

View file

@ -1966,8 +1966,6 @@
<string name="empty_state_my_tracks">İzlər əlavə et və qeyd et</string>
<string name="empty_state_my_tracks_desc">Baxmaq üçün izləri qeyd edin və ya idxal edin.</string>
<string name="enter_the_file_name">Fayl adını daxil edin.</string>
<string name="release_3_0">
\n</string>
<string name="distance_indication_descr">Aktiv işarələrə qədər məsafənin necə göstəriləcəyini seçin.</string>
<string name="tunnel_warning">İrəlidə tunel</string>
<string name="show_guide_line_descr">Mövqeyinizdən aktiv işarə məkanlarına bələdçi xətlərini göstər.</string>

View file

@ -1050,15 +1050,11 @@ Puntos</string>
<string name="additional_actions">Más aiciones</string>
<string name="av_locations_selected_desc">Ficheru GPX con coordenaes y datos de les notes esbillaes.</string>
<string name="av_locations_all_desc">Ficheru GPX con coordenaes y datos de toles notes.</string>
<string name="release_3_0">\\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
<string name="release_3_0">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</string>
<string name="modify_the_search_query">Cambiar la consulta de la gueta.</string>
<string name="shared_string_actions">Aiciones</string>

View file

@ -2918,9 +2918,6 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd
<string name="empty_state_av_notes">Rabi natatki!</string>
<string name="empty_state_av_notes_desc">Dadajcie aŭdyjo-, videa- ci fotanatatku na lubuju kropku na mapie, vykarystoŭvajučy vidžet ci kantekstnaje mieniu.</string>
<string name="modify_the_search_query">Źmianicie pošukavy zapyt.</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="what_is_here">Što tut:</string>
<string name="parked_at">pryparkavany na</string>
<string name="pick_up_till">Uziać da</string>

View file

@ -3004,9 +3004,6 @@
<string name="empty_state_av_notes">Рабі нататкі!</string>
<string name="empty_state_av_notes_desc">Дадайце аўдыё-, відэа- ці фотанататку на любую кропку на мапе, выкарыстоўваючы віджэт ці кантэкстнае меню.</string>
<string name="modify_the_search_query">Зьмяніце пошукавы запыт.</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="what_is_here">Што тут:</string>
<string name="parked_at">прыпаркаваны на</string>
<string name="pick_up_till">Узяць да</string>
@ -3014,11 +3011,6 @@
<string name="context_menu_read_full_article">Чытаць увесь артыкул</string>
<string name="context_menu_read_article">Чытаць артыкул</string>
<string name="context_menu_points_of_group">Усе кропкі групы</string>
<string name="additional_actions">Дадатковыя дзеяньні</string>
<string name="av_locations_selected_desc">GPX-файл з каардынатамі і данымі выбраных нататак.</string>
<string name="av_locations_all_desc">GPX-файл з каардынатамі і данымі ўсіх нататак.</string>

View file

@ -2204,8 +2204,6 @@
<string name="additional_actions">Допълнителни действия</string>
<string name="av_locations_selected_desc">GPX файл с координати и данни от избрани бележки.</string>
<string name="av_locations_all_desc">GPX файл с координати и данни от всички бележки.</string>
<string name="release_3_0">\\022
\n</string>
<string name="modify_the_search_query">Променете заявката за търсене.</string>
<string name="shared_string_actions">Действия</string>
<string name="shared_string_marker">Маркер</string>

View file

@ -2724,7 +2724,7 @@ Abasta l\'àrea: %1$s x %2$s</string>
<string name="by_date">Per data</string>
<string name="by_type">Per tipus</string>
<string name="modify_the_search_query">Modifica la consulta de cerca.</string>
<string name="release_3_0">\\022 Nou menú Viatge: consulta articles de Viquiviatges sense internet
<string name="release_3_0"> Nou menú Viatge: consulta articles de Viquiviatges sense internet
\n
\n• Viquipèdia: nova imatge, enllaços actius, imatges
\n

View file

@ -2725,9 +2725,6 @@ Zobrazená oblast: %1$s x %2$s</string>
<string name="empty_state_markers_active_desc">Klepnutím nebo přidržením označte \'Místa\', pak klepněte na tlačítko značky s vlajkou.</string>
<string name="modify_the_search_query">Upravit vyhledávací dotaz.</string>
<string name="one_tap_active">Jedním klepnutím aktivní</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="rendering_attr_hidePOILabels_name">Popisky bodů</string>
<string name="shared_string_without_name">Bez názvu</string>
<string name="what_is_here">Co je zde:</string>

View file

@ -2974,9 +2974,6 @@ Abgedeckte Fläche: %1$s x %2$s</string>
<string name="empty_state_av_notes_desc">Audio-, Video- oder Fotonotizen zu jedem Punkt auf der Karte über Bedienelement oder Kontextmenü hinzufügen.</string>
<string name="notes_by_date">Notizen nach Datum</string>
<string name="tap_on_map_to_hide_interface_descr">Ein Tippen auf die Karte schaltet die Steuerschaltflächen und Bedienelemente um.</string>
<string name="release_3_0">
\n
\n</string>
<string name="one_tap_active">Mit einem Tippen aktiv</string>
<string name="what_is_here">Was ist hier:</string>
<string name="without_time_limit">Ohne Zeitbegrenzung</string>

View file

@ -1814,7 +1814,7 @@
<string name="additional_actions">Πρόσθετες ενέργειες</string>
<string name="av_locations_selected_desc">Αρχείο GPX με συντεταγμένες και δεδομένα από τις επιλεγμένες σημειώσεις.</string>
<string name="av_locations_all_desc">Αρχείο GPX με συντεταγμένες και δεδομένα από όλες τις σημειώσεις.</string>
<string name="release_3_0">\\022 Νέο ταξιδιωτικό μενού: προβολή άρθρων βικιταξίδια χωρίς χρήση διαδικτύου
<string name="release_3_0">Νέο ταξιδιωτικό μενού: προβολή άρθρων βικιταξίδια χωρίς χρήση διαδικτύου
\n
\n • Βικιπαίδεια: νέα όψη, ενεργοί σύνδεσμοι, εικόνες
\n

View file

@ -2945,9 +2945,6 @@ Area honi dagokio: %1$s x %2$s</string>
<string name="shared_string_without_name">Izenik gabe</string>
<string name="av_locations_selected_desc">Hautatutako oharren koordenatuak eta datuak dituen GPX fitxategia.</string>
<string name="av_locations_all_desc">Ohar guztien koordenatuak eta datuak dituen GPX fitxategia.</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="modify_the_search_query">Aldatu bilaketaren galdera.</string>
<string name="shared_string_actions">Ekintzak</string>
<string name="shared_string_marker">Markatzailea</string>

View file

@ -3038,7 +3038,7 @@ représentant la zone : %1$s x %2$s</string>
<string name="by_date">Par date</string>
<string name="by_type">Par type</string>
<string name="modify_the_search_query">Modifier la recherche.</string>
<string name="release_3_0">\\022 Nouveau Menu Voyage : consulter les articles WikiVoyage hors connexion
<string name="release_3_0">Nouveau Menu Voyage : consulter les articles WikiVoyage hors connexion
\n
\n • Wikipedia : nouvelle apparence, images
\n

View file

@ -2536,7 +2536,7 @@
<string name="animate_my_location_desc">הפעלת הנפשת גלישת מפה של ה‚מיקום שלי’ במהלך ניווט.</string>
<string name="shared_string_in_name">ב־%1$s</string>
<string name="one_tap_active_descr">ניתן לגעת בסמן על המפה כדי להעביר אותו לראש הסמנים הפעילים מבלי לפתוח את תפריט ההקשר.</string>
<string name="release_3_0">\\022 תפריט טיולים חדש: הצגת ערכים מוויקימסע ללא שימוש באינטרנט
<string name="release_3_0">תפריט טיולים חדש: הצגת ערכים מוויקימסע ללא שימוש באינטרנט
\n
\n • ויקיפדיה: מראה חדש, קישורים פעילים, תמונות
\n

View file

@ -2882,9 +2882,6 @@ Kérlek adj meg egy teljes kódot</string>
<string name="additional_actions">További műveletek</string>
<string name="av_locations_selected_desc">GPX fájl a kijelölt megjegyzések koordinátáival és adataival.</string>
<string name="av_locations_all_desc">GPX fájl az összes megjegyzés koordinátáival és adataival.</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="modify_the_search_query">Keresési kifejezés módosítása.</string>
<string name="shared_string_actions">Műveletek</string>
<string name="shared_string_marker">Jelölő</string>

View file

@ -2632,8 +2632,7 @@
<string name="additional_actions">Լրացուցիչ գործողություններ</string>
<string name="av_locations_selected_desc">GPX ֆայլը կոորդինատներով և ընտրված գրառումների տվյալներով:</string>
<string name="av_locations_all_desc">GPX ֆայլը կոորդինատներով և բոլոր նշումների տվյալները։</string>
<string name="release_3_0">\\022
\n
<string name="release_3_0">
\nՆոր Ճամփորդության մենյու. Դիտեք WikiVoyage- ի հոդվածները առանց ինտերնետի օգտագործման
\n
\n • Wikipedia՝ նոր տեսք, ակտիվ հղումներ, պատկերներ

View file

@ -73,7 +73,7 @@
<string name="osm_live_ask_for_purchase">Harap beli berlangganan OSM Live terlebih dahulu</string>
<string name="sort_by">Urutkan dengan</string>
<string name="release_3_0">\\022 mendeteksi tanda Berhenti sekarang dan beranggapan itu arah mengemudi.
<string name="release_3_0"> mendeteksi tanda Berhenti sekarang dan beranggapan itu arah mengemudi.
\n
\n• algoritma baru memberikan nilai pendakian/turunan yang bermakna trek GPX.
\n

View file

@ -2567,7 +2567,7 @@ Stendur fyrir svæði: %1$s x %2$s</string>
<string name="non_optimal_route_calculation">Reikna leiðir yfir langar fjarlægðir sem hugsanlega eru ekki þær bestu</string>
<string name="av_locations_selected_desc">GPX-skrá með hnitum og gögnum valinna minnispunkta.</string>
<string name="av_locations_all_desc">GPX-skrá með hnitum og gögnum allra minnispunkta.</string>
<string name="release_3_0">\\022 Ný ferðavalmynd: skoða WikiVoyage-greinar án internet-tengingar
<string name="release_3_0">Ný ferðavalmynd: skoða WikiVoyage-greinar án internet-tengingar
\n
\n • Wikipedia: nýtt útlit, virkir tenglar, myndir
\n

View file

@ -2980,9 +2980,6 @@ Rappresenta l\'area: %1$s x %2$s</string>
<string name="notes_by_date">Note ordinate per data</string>
<string name="by_date">Per data</string>
<string name="by_type">Per tipo</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="modify_the_search_query">Modifica la richiesta di ricerca.</string>
<string name="osmand_extended_description_part6">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</string>
<string name="what_is_here">Cosa c\'è qui:</string>

View file

@ -141,9 +141,6 @@
<string name="north_abbreviation">Bk</string>
<string name="all_data">Hemû daneyan</string>
<string name="context_menu_read_article">"Gotarê bixwîne "</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="shared_string_deleted">Jêbirî</string>
<string name="shared_string_edited">"Guhertî "</string>
<string name="shared_string_more_without_dots">Bêhtir</string>

View file

@ -2801,7 +2801,7 @@ Tai yra puikus būdas paremti OsmAnd ir OSM, jei jie jums patinka.</string>
<string name="additional_actions">Papildomi veiksmai</string>
<string name="av_locations_selected_desc">GPX failas su koordinačių ir pasirinktų pastabų duomenimis.</string>
<string name="av_locations_all_desc">GPX failas su koordinačių ir visų pastabų duomenimis.</string>
<string name="release_3_0">\\022 Stop ženklo nutatymas atliekamas atsižvelgiant į judėjimo kryptį
<string name="release_3_0">Stop ženklo nutatymas atliekamas atsižvelgiant į judėjimo kryptį
\n
\n• Naujas algoritmas, pateikiantis prasmingas pakilimo/nusileidimo vertes GPX trekams
\n

View file

@ -2604,9 +2604,6 @@
<string name="distance_indication_descr">Velg hvordan avstanden til aktive markører skal vises.</string>
<string name="active_markers_descr">Velg antall aktive markører som skal vises.</string>
<string name="tap_on_map_to_hide_interface_descr">Et trykk på kartet skjuler/viser kontrollknappene og miniprogrammene.</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="mark_passed">Marker som passert</string>
<string name="osn_modify_dialog_error">Kunne ikke endre notatet</string>
<string name="quick_action_auto_zoom_desc">Trykking på denne handlingsknappen slår av/på automatisk kartforstørrelse i henhold til hastigheten din.</string>

View file

@ -2922,9 +2922,6 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="will_open_at">Zostanie otwarty o</string>
<string name="will_open_on">Zostanie otwarty o</string>
<string name="additional_actions">Dodatkowe czynności</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="shared_string_actions">Czynności</string>
<string name="shared_string_marker">Znacznik</string>
<string name="marker_activated">Uaktywniono znacznik %s.</string>

View file

@ -1912,7 +1912,6 @@
<string name="additional_actions">Acțiuni adiționale</string>
<string name="av_locations_selected_desc">Fișier GPX cu datele și coordonatele notelor selectate.</string>
<string name="av_locations_all_desc">Fișier GPX cu datele și coordonatele tuturor notelor.</string>
<string name="release_3_0">\\022</string>
<string name="modify_the_search_query">Modifică criteriul de căutare.</string>
<string name="shared_string_actions">Acțiuni</string>
<string name="shared_string_marker">Marcaj</string>

View file

@ -3017,7 +3017,7 @@ Pro praghere iscrie su còdighe intreu</string>
<string name="by_date">Pro data</string>
<string name="by_type">Pro casta</string>
<string name="modify_the_search_query">Modìfica sa rechesta de chirca.</string>
<string name="release_3_0">\\022 Menù de biàgiu nou: abbàida sos artìculos de WikiVoyage chene impreare sa connessione a ìnternet
<string name="release_3_0"> 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

View file

@ -2859,7 +2859,7 @@ Zodpovedá oblasti: %1$s x %2$s</string>
<string name="by_type">Podľa typu</string>
<string name="one_tap_active">Jedno stlačenie aktívne</string>
<string name="modify_the_search_query">Upraviť vyhľadávacie kritériá.</string>
<string name="release_3_0">\\022 Nové menu Cestovanie: zobrazte si články WikiVoyage bez použitia Internetu
<string name="release_3_0"> 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

View file

@ -2924,9 +2924,6 @@ Koda predstavlja območje: %1$s x %2$s</string>
\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</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="empty_state_osm_edits_descr">Ustvari ali spremeni točke POI, ureja opombe OSM in omogoča objavljanje zabeleženih sledi GPX.</string>
<string name="coordinate_input_accuracy_description">Samodejno preklopi na naslednje polje, ko je vpisana %1$d decimalka.</string>

View file

@ -1749,7 +1749,7 @@
<string name="first_intermediate_dest_description">Додаје прво стајање</string>
<string name="switch_osm_notes_visibility_desc">Прикажи/Сакриј ОСМ белешке на карти.</string>
<string name="gpx_file">GPX фајл</string>
<string name="release_3_0">\\022 Нови турустички мени: гледајте WikiVoyage чланке без коришћења интернета
<string name="release_3_0">Нови турустички мени: гледајте WikiVoyage чланке без коришћења интернета
\n
\n • Википедија: нови изглед, активне везе, слике
\n

View file

@ -2729,9 +2729,6 @@ Vänligen tillhandahåll fullständig kod</string>
<string name="additional_actions">Ytterligare åtgärder</string>
<string name="av_locations_selected_desc">GPX-fil med koordinater och data för valda anteckningar.</string>
<string name="av_locations_all_desc">GPX-fil med koordinater och data för alla anteckningar.</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="shared_string_actions">Åtgärder</string>
<string name="shared_string_marker">Markör</string>
<string name="one_tap_active_descr">Tryck på en markör på kartan för att flytta den till toppen av de aktiva markörerna utan att öppna sammanhangsmenyn.</string>

View file

@ -3095,7 +3095,6 @@
<string name="by_date">За датою</string>
<string name="by_type">За типом</string>
<string name="modify_the_search_query">Змінити пошуковий запит.</string>
<string name="release_3_0">"• "</string>
<string name="what_is_here">Що тут:</string>
<string name="parked_at">припаркований біля</string>
<string name="pick_up_till">Забрати до</string>

View file

@ -2668,9 +2668,6 @@
<string name="additional_actions">额外的活动</string>
<string name="av_locations_selected_desc">GPX文件包含所选笔记的坐标和数据。</string>
<string name="av_locations_all_desc">GPX文件包含所有注释的坐标和数据。</string>
<string name="release_3_0">\\022
\n
\n</string>
<string name="modify_the_search_query">修改搜索查询。</string>
<string name="shared_string_actions">操作</string>
<string name="shared_string_marker">标记</string>

View file

@ -3019,7 +3019,7 @@
<string name="by_type">按照類型</string>
<string name="one_tap_active_descr">輕點在地圖上的標記,將其移動到活動標記的頂端,而不用打開內容選單。</string>
<string name="modify_the_search_query">變更搜尋的查詢。</string>
<string name="release_3_0">\\022 新的旅行選單:檢視不用網路的維基導遊文章
<string name="release_3_0">新的旅行選單:檢視不用網路的維基導遊文章
\n
\n• 維基百科:嶄新的面貌、活動連結、圖片
\n

View file

@ -57,30 +57,27 @@
<string name="in_app_purchase_desc_ex">Once purchased, it will be permanently available to you.</string>
<string name="purchase_unlim_title">Buy - %1$s</string>
<string name="purchase_subscription_title">Subscribe - %1$s</string>
<string name="wikivoyage_offline">Wikivoyage offline</string>
<string name="unlimited_downloads">Unlimited downloads</string>
<string name="wikipedia_offline">Wikipedia offline</string>
<string name="contour_lines_hillshade_maps">Contour lines &amp; Hillshade maps</string>
<string name="unlock_all_features">Unlock all OsmAnd features</string>
<string name="purchase_dialog_title">Choose plan</string>
<string name="purchase_dialog_travel_description">Purchase one of the following to read travel articles offline:</string>
<string name="purchase_dialog_subtitle">Choose suitable item:</string>
<string name="shared_string_dont">Don\'t</string>
<string name="shared_string_do">Do</string>
<string name="shared_string_only_with_wifi">Only on Wi-Fi</string>
<string name="wikivoyage_download_pics">Download Pictures</string>
<string name="wikivoyage_download_pics_descr">Images from articles can be downloaded for offline use.\n
<string name="wikivoyage_download_pics">Download images</string>
<string name="wikivoyage_download_pics_descr">Images for articles can be downloaded for offline use.\n
You can always change the setting in \'Explore\' → \'Options\'.</string>
<string name="shared_string_wifi_only">Only on Wi-Fi</string>
<string name="select_travel_book">Select travel book</string>
<string name="shared_string_travel_book">Travel book</string>
<string name="online_webpage_warning">Page only available online. Open in web browser?</string>
<string name="images_cache">Images cache</string>
<string name="images_cache">Image cache</string>
<string name="delete_search_history">Delete search history</string>
<string name="download_images">Show images</string>
<string name="download_images">Download images</string>
<string name="download_maps_travel">Travel guides</string>
<string name="shared_string_wikivoyage">Wikivoyage</string>
<string name="article_removed">Article removed</string>
@ -153,11 +150,11 @@
<string name="av_locations_selected_desc">GPX file with coordinates and data of the selected notes.</string>
<string name="av_locations_all_desc">GPX file with coordinates and data of all notes.</string>
<string name="release_3_0">
\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
</string>
<string name="modify_the_search_query">Modify the search query.</string>
<string name="shared_string_actions">Actions</string>
@ -175,19 +172,19 @@
<string name="notes_by_date">Notes by date</string>
<string name="by_date">By date</string>
<string name="by_type">By type</string>
<string name="looking_for_tracks_with_waypoints">Looking for tracks with waypoints</string>
<string name="looking_for_tracks_with_waypoints">Looking for GPX files with waypoints</string>
<string name="shared_string_more_without_dots">More</string>
<string name="appearance_on_the_map">Appearance on the map</string>
<string name="add_track_to_markers_descr">Waypoints can be added to markers by selecting one of these tracks that has them.</string>
<string name="add_track_to_markers_descr">Select a GPX file to add its waypoints to the markers.</string>
<string name="add_favourites_group_to_markers_descr">Select a favorite category to add to the markers.</string>
<string name="track_waypoints">Track waypoints</string>
<string name="track_waypoints">GPX waypoints</string>
<string name="favourites_group">Favorites category</string>
<string name="add_group">Add a group</string>
<string name="add_group_descr">Import groups from favorites or track waypoints.</string>
<string name="add_group_descr">Import groups from favorites or GPX waypoints.</string>
<string name="empty_state_markers_active">Create map markers!</string>
<string name="empty_state_markers_active_desc">Long or short tap \'Places\', then tap the marker flag button.</string>
<string name="empty_state_markers_groups">Import groups</string>
<string name="empty_state_markers_groups_desc">Import favorite groups or track waypoints as markers.</string>
<string name="empty_state_markers_groups_desc">Import favorite groups or GPX waypoints as markers.</string>
<string name="empty_state_markers_history_desc">Markers marked as passed will appear on this screen.</string>
<string name="shared_string_two">Two</string>
<string name="shared_string_one">One</string>
@ -207,7 +204,7 @@
<string name="tap_on_map_to_hide_interface_descr">A tap on the map toggles the control buttons and widgets.</string>
<string name="tap_on_map_to_hide_interface">Fullscreen mode</string>
<string name="mark_passed">Mark passed</string>
<string name="import_gpx_file_description">can be imported as favorite, or track file.</string>
<string name="import_gpx_file_description">can be imported as favorite or GPX file.</string>
<string name="import_as_gpx">Import as GPX file</string>
<string name="import_as_favorites">Import as favorite</string>
<string name="import_file">Import file</string>
@ -243,8 +240,8 @@
<string name="shared_string_sort">Sort</string>
<string name="coordinate_input">Coordinate input</string>
<string name="is_saved">is saved</string>
<string name="marker_save_as_track_descr">Export your markers to a file you can specify here:</string>
<string name="marker_save_as_track">Save as track</string>
<string name="marker_save_as_track_descr">Export your markers to the following GPX file:</string>
<string name="marker_save_as_track">Save as GPX file</string>
<string name="move_to_history">Move to history</string>
<string name="group_will_be_removed_after_restart">The group will be gone the next time you start the app.</string>
<string name="show_guide_line">Show directional lines</string>
@ -417,7 +414,7 @@
<string name="points_delete_multiple">You are going to delete %1$d point(s). Are you sure?</string>
<string name="route_points_category_name">Turns to pass on this route</string>
<string name="track_points_category_name">Waypoints, points of interest, named features</string>
<string name="gpx_track">Track</string>
<string name="gpx_track">GPX file</string>
<string name="max_speed">Maximum speed</string>
<string name="average_speed">Average speed</string>
<string name="shared_string_time_moving">Time moving</string>
@ -426,7 +423,7 @@
<string name="shared_string_start_time">Departure</string>
<string name="shared_string_end_time">Arrival</string>
<string name="shared_string_color">Color</string>
<string name="select_gpx_folder">Select track folder</string>
<string name="select_gpx_folder">Select GPX file folder</string>
<string name="file_can_not_be_moved">File can not be moved.</string>
<string name="shared_string_move">Move</string>
<string name="shared_string_tracks">Tracks</string>
@ -440,7 +437,7 @@
<string name="total_distance">Total distance</string>
<string name="routing_attr_relief_smoothness_factor_name">Select elevation fluctuation</string>
<string name="routing_attr_height_obstacles_name">Use elevation data</string>
<string name="routing_attr_height_obstacles_description">Use terrain elevation data provided by SRTM, ASTER, and EU-DEM.</string>
<string name="routing_attr_height_obstacles_description">Factor in terrain elevation (via SRTM, ASTER, and EU-DEM data).</string>
<string name="rendering_attr_depthContours_description">Show depth contours and points.</string>
<string name="rendering_attr_depthContours_name">Nautical depth contours</string>
<string name="release_2_6">
@ -501,9 +498,9 @@
<string name="route_roundabout_short">Take %1$d exit and go</string>
<string name="upload_poi">Upload POI</string>
<string name="route_calculation">Route calculation</string>
<string name="gpx_no_tracks_title">You do not have any tracks yet</string>
<string name="gpx_no_tracks_title_folder">You may also add tracks to the folder</string>
<string name="gpx_add_track">Add track</string>
<string name="gpx_no_tracks_title">You do not have any GPX files yet</string>
<string name="gpx_no_tracks_title_folder">You may also add GPX files to the folder</string>
<string name="gpx_add_track">Add GPX file</string>
<string name="gpx_appearance">Appearance</string>
<string name="trip_rec_notification_settings">Enable recording quick start</string>
<string name="trip_rec_notification_settings_desc">Display a system notification allowing to start trip recording.</string>
@ -572,7 +569,7 @@
<string name="no_inet_connection_desc_map">Required to download maps.</string>
<string name="search_location">Searching for location…</string>
<string name="storage_free_space">Free space</string>
<string name="storage_place_description">OsmAnd\'s data storage (for maps, tracks, etc.): %1$s.</string>
<string name="storage_place_description">OsmAnd\'s data storage (for maps, GPX files, etc.): %1$s.</string>
<string name="give_permission">Grant permission</string>
<string name="allow_access_location">Allow location access</string>
<string name="first_usage_greeting">Get directions and discover new places without a connection to the Internet</string>
@ -1064,7 +1061,7 @@
<string name="shared_string_clear">Clear</string>
<string name="shared_string_clear_all">Clear all</string>
<string name="shared_string_save">Save</string>
<string name="shared_string_save_as_gpx">Save as new GPX track</string>
<string name="shared_string_save_as_gpx">Save as new GPX file</string>
<string name="shared_string_rename">Rename</string>
<string name="shared_string_delete">Delete</string>
<string name="shared_string_delete_all">Delete all</string>
@ -1100,7 +1097,7 @@
<string name="shared_string_my_location">My Position</string>
<string name="shared_string_my_places">My Places</string>
<string name="shared_string_my_favorites">Favorites</string>
<string name="shared_string_my_tracks">Tracks</string>
<string name="shared_string_my_tracks">GPX files</string>
<string name="shared_string_currently_recording_track">Currently recording track</string>
<string name="shared_string_audio">Audio</string>
<string name="shared_string_video">Video</string>
@ -1278,8 +1275,8 @@
<string name="save_track_to_gpx_globally">Log track to GPX file</string>
<string name="save_track_to_gpx_globally_headline">On demand track logging</string>
<string name="save_track_to_gpx_globally_descr">General position logging to a GPX file can be turned on or off using the GPX logging widget on the map screen.</string>
<string name="save_current_track_descr">Save current track to memory card now.</string>
<string name="save_current_track">Save current GPX track</string>
<string name="save_current_track_descr">Save current track as GPX file now.</string>
<string name="save_current_track">Save current track</string>
<string name="save_track_to_gpx">Auto-record track during navigation</string>
<string name="save_track_to_gpx_descrp">A GPX track is automatically saved to the tracks folder during navigation.</string>
<string name="save_track_interval_globally">Logging interval</string>
@ -1346,7 +1343,7 @@
<string name="rendering_attr_showCycleRoutes_name">Show cycle routes</string>
<string name="no_index_file_to_download">Downloads not found, please check your connection to the Internet.</string>
<string name="select_index_file_to_download">Nothing was found. If you can\'t find your region, you can make it yourself (see https://osmand.net).</string>
<string name="none_selected_gpx">No GPX files selected. To select one long-tap an available track.</string>
<string name="none_selected_gpx">No GPX files selected. Select one by long-tapping.</string>
<string name="local_index_select_gpx_file">Select to show</string>
<string name="gpx_split_interval">Split interval</string>
<string name="sort_by_distance">Sort by distance</string>
@ -1381,7 +1378,7 @@
<string name="gpx_selection_route_points">%1$s \nRoute points %2$s</string>
<string name="gpx_selection_points">%1$s \nPoints</string>
<string name="gpx_selection_track">%1$s \nTrack %2$s</string>
<string name="gpx_file_is_empty">Empty GPX track</string>
<string name="gpx_file_is_empty">Empty GPX file</string>
<string name="osmo_edit_color">Display color</string>
<string name="osmo_connect_menu">Connect</string>
<string name="osmo_group_description">Description</string>
@ -1591,7 +1588,7 @@
<string name="distance_measurement_finish_editing">Finish editing</string>
<string name="distance_measurement_finish_subtrack">Begin a new subtrack</string>
<string name="distance_measurement_clear_route">Clear all points</string>
<string name="distance_measurement_load_gpx">Open existing GPX track</string>
<string name="distance_measurement_load_gpx">Open existing GPX file</string>
<string name="wait_current_task_finished">Please wait until current task is finished</string>
<string name="use_kalman_filter_compass_descr">Reduces noise in compass readings but adds inertia.</string>
<string name="use_kalman_filter_compass">Use Kalman filter</string>
@ -2421,7 +2418,7 @@
<string name="no_vector_map_loaded">Vector maps were not loaded</string>
<!-- string name="map_route_by_gpx">Navigate using GPX</string-->
<string name="gpx_files_not_found">No GPX files found in the tracks folder</string>
<string name="layer_gpx_layer">GPX track</string>
<string name="layer_gpx_layer">GPX files</string>
<string name="error_reading_gpx">Could not read GPX data</string>
<string name="vector_data">Offline vector maps</string>
<string name="transport_context_menu">Search transport at stop</string>
@ -2567,7 +2564,7 @@
<string name="loading_streets">Loading streets…</string>
<string name="loading_cities">Loading cities…</string>
<string name="poi">POI</string>
<string name="error_occurred_saving_gpx">Could not save GPX track</string>
<string name="error_occurred_saving_gpx">Could not save GPX file</string>
<string name="error_calculating_route">Could not calculate route</string>
<string name="error_calculating_route_occured">Could not calculate route</string>
<string name="empty_route_calculated">Calculated route is empty</string>
@ -2578,7 +2575,7 @@
<string name="loading_data">Loading data…</string>
<string name="reading_indexes">Reading local data…</string>
<string name="previous_run_crashed">Last OsmAnd run crashed. Log file is at {0}. Please report the issue and attach the log file.</string>
<string name="saving_gpx_tracks">Saving GPX tracks to SD</string>
<string name="saving_gpx_tracks">Saving GPX file</string>
<string name="finished_task">Finished</string>
<string name="use_online_routing_descr">Use the Internet to calculate a route.</string>
<string name="use_online_routing">Use online navigation</string>
@ -2880,14 +2877,14 @@
<string name="save_route_point">Save Route Point</string>
<string name="waypoint_one">Waypoint 1</string>
<string name="route_point_one">Route Point 1</string>
<string name="empty_state_my_tracks">Add and Record Tracks</string>
<string name="empty_state_my_tracks_desc">Record or import tracks to view.</string>
<string name="empty_state_my_tracks">Add GPX Files</string>
<string name="empty_state_my_tracks_desc">Import GPX files, or record tracks.</string>
<string name="empty_state_favourites">Add Favorites</string>
<string name="empty_state_favourites_desc">Import or mark favorites on the map.</string>
<string name="import_track">Import track</string>
<string name="empty_state_favourites_desc">Import favorites, or add via marking points on the map.</string>
<string name="import_track">Import GPX file</string>
<string name="import_track_desc">File %1$s does not contain waypoints, import it as a track?</string>
<string name="move_point">Move Point</string>
<string name="add_segment_to_the_track">Add to a GPX track</string>
<string name="add_segment_to_the_track">Add to a GPX file</string>
<string name="osm_recipients_label">OSM recipients</string>
<string name="total_donations">Total donations</string>
<string name="day_off_label">off</string>

View file

@ -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<String, Boolean> cached = new HashMap<>();
private PicassoUtils(OsmandApplication app){
File cacheDir = createDefaultCacheDir(app);
private static Map<String, Boolean> 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();
}

View file

@ -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);

View file

@ -50,6 +50,8 @@ public interface SQLiteAPI {
byte[] getBlob(int ind);
boolean isNull(int ind);
int getColumnIndex(String columnName);
void close();

View file

@ -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) {

View file

@ -361,19 +361,18 @@ public class InAppPurchaseHelper {
Purchase liveUpdatesPurchase = inventory.getPurchase(SKU_LIVE_UPDATES);
boolean subscribedToLiveUpdates = (liveUpdatesPurchase != null && liveUpdatesPurchase.getPurchaseState() == 0);
OsmandPreference<Long> 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);
}

View file

@ -447,7 +447,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
@Override
public void onClick(View v) {
if (mapActivity.getSupportFragmentManager() != null) {
WikivoyageArticleDialogFragment.showInstance(app, mapActivity.getSupportFragmentManager(), article.getTripId(), article.getLang());
WikivoyageArticleDialogFragment.showInstance(app, mapActivity.getSupportFragmentManager(), article.getTitle(), article.getLang());
}
}
};

View file

@ -25,7 +25,7 @@ public class TracksGroupsAdapter extends GroupsAdapter {
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof MapMarkersGroupHeaderViewHolder) {
MapMarkersGroupHeaderViewHolder markersGroupHeaderViewHolder = (MapMarkersGroupHeaderViewHolder) holder;
markersGroupHeaderViewHolder.title.setText(app.getText(R.string.shared_string_tracks));
markersGroupHeaderViewHolder.title.setText(app.getText(R.string.shared_string_my_tracks));
markersGroupHeaderViewHolder.description.setText(app.getText(R.string.add_track_to_markers_descr));
} else if (holder instanceof MapMarkersGroupViewHolder) {
GpxDataItem gpx = getItem(position);

View file

@ -1147,7 +1147,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
StringBuilder t = new StringBuilder();
String groupName = group.replaceAll("_", " ").replace(".gpx", "");
if (groupName.length() == 0) {
groupName = getString(R.string.shared_string_tracks);
groupName = getString(R.string.shared_string_my_tracks);
}
t.append(Algorithms.capitalizeFirstLetter(groupName));
boolean light = app.getSettings().isLightContent();

View file

@ -878,7 +878,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
row.findViewById(R.id.list_divider).setVisibility(View.GONE);
row.setOnClickListener(null);
if (group.getType() == GpxDisplayItemType.TRACK_POINTS) {
groupTitle.setText(getString(R.string.waypoints));
groupTitle.setText(getString(R.string.points));
description.setText(getString(R.string.track_points_category_name));
} else {
groupTitle.setText(getString(R.string.route_points));

View file

@ -140,8 +140,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
private void updatePoiType() {
PoiType pt = getData().getPoiTypeDefined();
if (pt != null) {
amenityTagTextView.setText(pt.getOsmTag());
amenityTextView.setText(pt.getOsmValue());
amenityTagTextView.setText(pt.getEditOsmTag());
amenityTextView.setText(pt.getEditOsmValue());
} else {
amenityTagTextView.setText(getData().getPoiCategory().getDefaultTag());
amenityTextView.setText(getData().getPoiTypeString());
@ -215,6 +215,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
});
valueEditText.setText(vl);
valueEditText.setAdapter(valueAdapter);
valueEditText.setThreshold(3);
valueEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -277,16 +279,17 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
if (poiType.isNotEditableOsm() || poiType.getBaseLangType() != null) {
return;
}
if (poiType.getOsmTag() != null &&
!poiType.getOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) {
stringSet.add(poiType.getOsmTag());
if (poiType.getEditOsmTag() != null &&
!poiType.getEditOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) {
String editOsmTag = poiType.getEditOsmTag();
stringSet.add(editOsmTag);
if (poiType.getOsmTag2() != null) {
stringSet.add(poiType.getOsmTag2());
}
}
if (poiType.getOsmValue() != null) {
values.add(poiType.getOsmValue());
if (poiType.getEditOsmValue() != null) {
values.add(poiType.getEditOsmValue());
}
if (poiType.getOsmValue2() != null) {
values.add(poiType.getOsmValue2());

View file

@ -204,11 +204,11 @@ public class EditPoiData {
retrieveType();
PoiType pt = getPoiTypeDefined();
if(pt != null) {
tagValues.put(REMOVE_TAG_PREFIX+pt.getOsmTag(), REMOVE_TAG_VALUE);
tagValues.put(REMOVE_TAG_PREFIX+pt.getEditOsmTag(), REMOVE_TAG_VALUE);
tagValues.put(REMOVE_TAG_PREFIX+pt.getOsmTag2(), REMOVE_TAG_VALUE);
tagValues.remove(pt.getOsmTag());
tagValues.remove(pt.getEditOsmTag());
tagValues.remove(pt.getOsmTag2());
changedTags.removeAll(Arrays.asList(pt.getOsmTag(), pt.getOsmTag2()));
changedTags.removeAll(Arrays.asList(pt.getEditOsmTag(), pt.getOsmTag2()));
category = pt.getCategory();
}
notifyDatasetChanged(POI_TYPE_TAG);

View file

@ -459,8 +459,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
if (poiTypeTag != null) {
final PoiType poiType = editPoiData.getAllTranslatedSubTypes().get(poiTypeTag.trim().toLowerCase());
if (poiType != null) {
node.putTagNoLC(poiType.getOsmTag(), poiType.getOsmValue());
node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag());
node.putTagNoLC(poiType.getEditOsmTag(), poiType.getEditOsmValue());
node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getEditOsmTag());
if (poiType.getOsmTag2() != null) {
node.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag2());
@ -580,11 +580,16 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
if(!s.getKeyName().contains("osmand")) {
addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s);
}
if(!Algorithms.isEmpty(s.getEditOsmValue())) {
addMapEntryAdapter(subCategories, s.getEditOsmValue().replace('_', ' '), s);
}
}
}
}
for (Map.Entry<String, PoiType> s : editPoiData.getAllTranslatedSubTypes().entrySet()) {
addMapEntryAdapter(subCategories, s.getKey(), s.getValue());
if(!s.getKey().contains("osmand")) {
addMapEntryAdapter(subCategories, s.getKey(), s.getValue());
}
}
final ArrayAdapter<Object> adapter;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

View file

@ -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());
}
}
}

View file

@ -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

View file

@ -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());
}

View file

@ -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<Boolean> showArrival = intermediate
? ctx.getSettings().SHOW_INTERMEDIATE_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME

View file

@ -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<String> 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);
}
}

View file

@ -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) {

View file

@ -19,7 +19,6 @@ public class TravelArticle {
private static final String THUMB_PREFIX = "320px-";
private static final String REGULAR_PREFIX = "1280px-";//1280, 1024, 800
String id;
String title;
String content;
String isPartOf;
@ -33,9 +32,6 @@ public class TravelArticle {
String contentsJson;
String aggregatedPartOf;
public String getId() {
return id;
}
public String getTitle() {
return title;

View file

@ -48,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";
@ -65,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 + ", " +
@ -568,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);

View file

@ -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;
}

View file

@ -31,6 +31,8 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
private static final int SECOND_POSITION = 1;
private final List<BaseTravelCard> items = new ArrayList<>();
private TravelDownloadUpdateCard downloadCard;
private TravelNeededMapsCard neededMapsCard;
@NonNull
@Override
@ -137,13 +139,21 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
return false;
}
public void setNeededMapsCard(TravelNeededMapsCard card) {
public void addNeededMapsCard(TravelNeededMapsCard card) {
this.neededMapsCard = card;
if (addItem(getNeededMapsCardPosition(), card)) {
notifyDataSetChanged();
}
}
public void updateNeededMapsCard() {
public void updateNeededMapsCard(boolean onlyProgress) {
if(onlyProgress) {
TravelNeededMapsCard nd = this.neededMapsCard;
if(nd != null) {
nd.updateView();
}
return;
}
int pos = getNeededMapsCardPosition();
if (neededMapsCardExists(pos)) {
notifyItemChanged(pos);
@ -151,6 +161,7 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
}
public void removeNeededMapsCard() {
this.neededMapsCard = null;
int pos = getNeededMapsCardPosition();
if (neededMapsCardExists(pos)) {
removeItem(pos);
@ -169,13 +180,21 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
return items.size() > 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<RecyclerView.ViewHold
}
public void removeDownloadUpdateCard() {
this.downloadCard = null;
int pos = getDownloadUpdateCardPosition();
if (downloadUpdateCardExists(pos)) {
removeItem(pos);

View file

@ -90,8 +90,8 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
currentDownloadingIndexItem = current;
removeRedundantCards();
}
adapter.updateDownloadUpdateCard();
adapter.updateNeededMapsCard();
adapter.updateDownloadUpdateCard(true);
adapter.updateNeededMapsCard(true);
}
@Override
@ -194,7 +194,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
public void onPrimaryButtonClick() {
if (mainIndexItem != null) {
downloadManager.startDownload(getMyActivity(), mainIndexItem);
adapter.updateDownloadUpdateCard();
adapter.updateDownloadUpdateCard(false);
}
}
@ -202,7 +202,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
public void onSecondaryButtonClick() {
if (downloadUpdateCard.isLoading()) {
downloadThread.cancelDownload(mainIndexItem);
adapter.updateDownloadUpdateCard();
adapter.updateDownloadUpdateCard(false);
} else if (!downloadUpdateCard.isDownload()) {
removeDownloadUpdateCard();
} else if (downloadUpdateCard.isShowOtherMapsBtn()) {
@ -217,7 +217,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
}
});
downloadUpdateCard.setIndexItem(mainIndexItem);
adapter.setDownloadUpdateCard(downloadUpdateCard);
adapter.addDownloadUpdateCard(downloadUpdateCard);
}
}
@ -230,14 +230,14 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
@Override
public void onPrimaryButtonClick() {
downloadManager.startDownload(getMyActivity(), getAllItemsForDownload());
adapter.updateNeededMapsCard();
adapter.updateNeededMapsCard(false);
}
@Override
public void onSecondaryButtonClick() {
if (neededMapsCard.isDownloading()) {
app.getDownloadThread().cancelDownload(neededIndexItems);
adapter.updateNeededMapsCard();
adapter.updateNeededMapsCard(false);
} else {
removeNeededMapsCard();
}
@ -257,11 +257,11 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
} else if (!item.isDownloaded()) {
downloadManager.startDownload(getMyActivity(), item);
}
adapter.updateNeededMapsCard();
adapter.updateNeededMapsCard(false);
}
}
});
adapter.setNeededMapsCard(neededMapsCard);
adapter.addNeededMapsCard(neededMapsCard);
}
}

View file

@ -43,6 +43,7 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
private final Drawable readIcon;
private final Drawable deleteIcon;
private PicassoUtils picasso;
public void setListener(Listener listener) {
this.listener = listener;
@ -51,6 +52,7 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
SavedArticlesRvAdapter(OsmandApplication app) {
this.app = app;
this.settings = app.getSettings();
picasso = PicassoUtils.getPicasso(app);
int colorId = settings.isLightContent()
? R.color.wikivoyage_active_light : R.color.wikivoyage_active_dark;
@ -78,28 +80,27 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
final ItemVH holder = (ItemVH) viewHolder;
TravelArticle article = (TravelArticle) getItem(position);
final String url = TravelArticle.getImageUrl(article.getImageTitle(), false);
Boolean cached = PicassoUtils.isCached(url);
Boolean loaded = picasso.isURLLoaded(url);
boolean lastItem = position == getItemCount() - 1;
RequestCreator rc = Picasso.get()
.load(url);
RequestCreator rc = Picasso.get().load(url);
WikivoyageUtils.setupNetworkPolicy(settings, rc);
rc.transform(new CropCircleTransformation())
.into(holder.icon, new Callback() {
@Override
public void onSuccess() {
holder.icon.setVisibility(View.VISIBLE);
PicassoUtils.setCached(url, true);
picasso.setResultLoaded(url, true);
}
@Override
public void onError(Exception e) {
holder.icon.setVisibility(View.GONE);
PicassoUtils.setCached(url, false);
picasso.setResultLoaded(url, false);
}
});
holder.icon.setVisibility(cached != null && cached ? View.VISIBLE : View.GONE);
holder.icon.setVisibility(loaded == null || loaded.booleanValue() ? View.VISIBLE : View.GONE);
holder.title.setText(article.getTitle());
holder.content.setText(article.getContent());
holder.partOf.setText(article.getGeoDescription());

View file

@ -49,7 +49,7 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Trav
FragmentActivity activity = getActivity();
if (activity != null) {
FragmentManager fm = activity.getSupportFragmentManager();
WikivoyageArticleDialogFragment.showInstance(app, fm, article.getTripId(), article.getLang());
WikivoyageArticleDialogFragment.showInstance(app, fm, article.getTitle(), article.getLang());
}
}
});

View file

@ -45,13 +45,12 @@ public class WikivoyageExploreDialogFragment extends WikiBaseDialogFragment impl
private ExploreTabFragment exploreTabFragment;
private SavedArticlesTabFragment savedArticlesTabFragment;
private PicassoUtils utils;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Context context = getContext();
if (context != null) {
PicassoUtils.setupPicasso(context);
}
utils = PicassoUtils.getPicasso(getMyApplication());
}
@Nullable
@ -145,12 +144,7 @@ public class WikivoyageExploreDialogFragment extends WikiBaseDialogFragment impl
populateData();
}
@Override
public void onDestroy() {
super.onDestroy();
PicassoUtils.clearCachedMap();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

View file

@ -103,7 +103,7 @@ public class WikivoyageOptionsBottomSheetDialogFragment extends MenuBottomSheetD
@Override
public void onClick(View v) {
new WebView(getContext()).clearCache(true);
PicassoUtils.clearAllPicassoCache();
PicassoUtils.getPicasso(getMyApplication()).clearAllPicassoCache();
sendResult(CACHE_CLEARED);
dismiss();
}

View file

@ -31,11 +31,14 @@ public class ArticleTravelCard extends BaseTravelCard {
private FragmentManager fragmentManager;
private boolean isLastItem;
private PicassoUtils picasso;
public ArticleTravelCard(OsmandApplication app, boolean nightMode, TravelArticle article, FragmentManager fragmentManager) {
super(app, nightMode);
this.article = article;
readIcon = getActiveIcon(R.drawable.ic_action_read_article);
this.fragmentManager = fragmentManager;
picasso = PicassoUtils.getPicasso(app);
}
@Override
@ -43,7 +46,7 @@ public class ArticleTravelCard extends BaseTravelCard {
if (viewHolder instanceof ArticleTravelVH) {
final ArticleTravelVH holder = (ArticleTravelVH) viewHolder;
final String url = TravelArticle.getImageUrl(article.getImageTitle(), false);
Boolean cached = PicassoUtils.isCached(url);
Boolean loaded = picasso.isURLLoaded(url);
RequestCreator rc = Picasso.get()
.load(url);
@ -53,17 +56,17 @@ public class ArticleTravelCard extends BaseTravelCard {
@Override
public void onSuccess() {
holder.icon.setVisibility(View.VISIBLE);
PicassoUtils.setCached(url, true);
picasso.setResultLoaded(url, true);
}
@Override
public void onError(Exception e) {
holder.icon.setVisibility(View.GONE);
PicassoUtils.setCached(url, false);
picasso.setResultLoaded(url, false);
}
});
holder.icon.setVisibility(cached != null && cached ? View.VISIBLE : View.GONE);
holder.icon.setVisibility(loaded == null || loaded.booleanValue() ? View.VISIBLE : View.GONE);
holder.title.setText(article.getTitle());
holder.content.setText(WikiArticleHelper.getPartialContent(article.getContent()));
holder.partOf.setText(article.getGeoDescription());

View file

@ -10,11 +10,11 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.download.IndexItem;
import java.lang.ref.WeakReference;
import java.text.DateFormat;
public class TravelDownloadUpdateCard extends BaseTravelCard {
@ -23,6 +23,7 @@ public class TravelDownloadUpdateCard extends BaseTravelCard {
private boolean download;
private boolean showOtherMapsBtn;
private WeakReference<DownloadUpdateVH> 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<TravelDownloadUpdateCard.DownloadUpdateVH>(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() {

View file

@ -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<NeededMapsVH> 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<NeededMapsVH>(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() {