From f25a6bc001e46d1c3522374bfe7d1929720b78a7 Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Wed, 6 Jan 2021 08:33:54 +0000 Subject: [PATCH 01/37] Translated using Weblate (French) Currently translated at 100.0% (3606 of 3606 strings) --- OsmAnd/res/values-fr/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 633470a815..dd175df3ba 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4019,4 +4019,7 @@ Vélo Automobile Erreur, vérifiez les paramètres + Ajouter un moteur de routage en ligne + Modifier le moteur de routage en ligne + L\'URL avec tous les paramètres sera de la forme : \ No newline at end of file From c39d62d441ccf063c51821c437db00dbb33aa4cc Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 6 Jan 2021 20:00:22 +0000 Subject: [PATCH 02/37] Translated using Weblate (German) Currently translated at 99.9% (3603 of 3606 strings) --- OsmAnd/res/values-de/strings.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 870673e61e..19175d85be 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -4032,4 +4032,16 @@ Gewässer erlauben, die nicht ständig Wasser führen Gewässer erlauben, die nicht ständig Wasser führen Zeiten der Sprachansagen + Online Routenplaner hinzufügen + Online Routenplaner bearbeiten + Fahrzeug + API Schlüssel + Server URL + Parameter eingeben + Die URL mit allen Parametern wird so aussehen: + Routenberechnung testen + Zu Fuß + Fahrrad + Auto + Fehler, Parameter erneut prüfen \ No newline at end of file From 05767e3b7a09d34e90645d5f6a464a65bf3e993e Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Thu, 7 Jan 2021 00:34:52 +0000 Subject: [PATCH 03/37] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3606 of 3606 strings) --- OsmAnd/res/values-uk/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 4e70eb1284..dfe36591a5 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -4031,7 +4031,7 @@ Ключ API URL-адреса сервера Введіть параметр - Залиште порожнім, якщо ні + Залиште порожнім, якщо не маєте ключа API URL-адреса з усіма параметрами виглядатиме так: Тестове обчислення маршруту Водіння From b318a7cdaf8a10baf79e6ca72286243ec90bceaa Mon Sep 17 00:00:00 2001 From: Temuri Doghonadze Date: Wed, 6 Jan 2021 07:15:23 +0000 Subject: [PATCH 04/37] Translated using Weblate (Georgian) Currently translated at 64.8% (2340 of 3606 strings) --- OsmAnd/res/values-ka/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-ka/strings.xml b/OsmAnd/res/values-ka/strings.xml index a39fb02b7b..723edda859 100644 --- a/OsmAnd/res/values-ka/strings.xml +++ b/OsmAnd/res/values-ka/strings.xml @@ -2350,4 +2350,6 @@ ბაზური პროფილი ტიპი: %s რეჟიმი: %s + საცალფეხო გზების არიდება + საცალფეხო ფზების არიდება \ No newline at end of file From 01165f370afb78f25a9a2708b143cbd58e524c02 Mon Sep 17 00:00:00 2001 From: ace shadow Date: Wed, 6 Jan 2021 23:18:04 +0000 Subject: [PATCH 05/37] Translated using Weblate (Slovak) Currently translated at 100.0% (3606 of 3606 strings) --- OsmAnd/res/values-sk/strings.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 27d1976a65..3af8231c15 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -4028,4 +4028,19 @@ Povoliť dočasné vodné toky Povoliť dočasné vodné toky Časy hlasových pokynov + Pridať online navigačnú službu + Upraviť online navigačnú službu + Podtyp + Vozidlo + Kľúč API + Adresa URL serveru + Zadajte parameter + Ak nie, ponechajte prázdne + Adresa URL so všetkými parametrami bude vyzerať nasledovne: + Vyskúšať výpočet trasy + Vedenie vozidla + Chôdza + Bicykel + Auto + Chyba, skontrolujte parametre \ No newline at end of file From 7f4340a85a8a97419822503d457166ccb18e32b1 Mon Sep 17 00:00:00 2001 From: iman Date: Wed, 6 Jan 2021 17:44:51 +0000 Subject: [PATCH 06/37] Translated using Weblate (Persian) Currently translated at 99.3% (3581 of 3606 strings) --- OsmAnd/res/values-fa/strings.xml | 81 ++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index fe55b9e35f..7b7362011a 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -163,7 +163,7 @@ پشتیبان‌گیری در قالب تغییر OSM حذف نقطه استفاده از پالایهٔ Kalman - حذف مسیر + کنارگذاشتن مسیر؟ هیچ‌کدام افزونهٔ دراپ‌باکس برای فیلم‌برداری از ضبط‌کنندهٔ سیستم استفاده شود. @@ -644,7 +644,7 @@ توقف اعلام خودکار برای نمایش ردها و مسیرها از رنگ‌های شب‌نما استفاده شود. ویرایش آفلاین - ویرایش‌ها را همیشه آفلاین انجام می‌دهم. + اگر ویرایش آفلاین فعال باشد، تغییرات ابتدا روی دستگاه ذخیره می‌شود و با درخواست شما آپلود می‌گردد. در غیر این صورت دردَم آپلود خواهد شد. در حال آپلود… تعداد {0} یادداشت/POI آپلود شد تغییراتی که به‌وسیلهٔ برنامه روی POIها انجام می‌دهید روی نقشه‌های دانلود‌شده تأثیری ندارد. تغییرات روی فایل دیگری در دستگاه ذخیره می‌شود. @@ -1687,7 +1687,7 @@ بیان‌کردن جهت مقصد با لرزش. مسیریابی با استفاده از به‌روزرسانی‌های OsmAnd Live فعال شود. مسیریابی با OsmAnd Live - مقصد تنظیم نشده + افزونهٔ قابلیت دسترسی: مقصدی تنظیم نشده سویهٔ مغناطیسی سویهٔ نسبی اگر از مسیر خارج شدم، مسیر تازه‌ای پیدا نکن @@ -2151,7 +2151,7 @@ تعداد مشارکت‌کنندگان تعداد ویرایش‌ها گزارش برای - در نام فایل از نویسهٔ غیرمجاز استفاده شده است + نویسهٔ غیرمجاز در نام فایل کنش فوری کنش %d صفحهٔ %d @@ -2301,7 +2301,7 @@ دکمه‌ای برای آشکار/پنهان کردن یادداشت‌های OSM بر روی نقشه. مرتب‌شده بر اساس مسافت جست‌وجو در علاقه‌مندی‌ها - «لایهٔ سایه‌روشن» را دانلود کنید تا سایه‌های عمودی را ببینید. + لایهٔ «سایه‌روشن» را دانلود کنید تا سایه‌زنی‌های عمودی را ببینید. افزونهٔ «منحنی‌های میزان» را نصب کنید تا طبقه‌بندی عمودی محدوده‌ها را ببینید. از این زوم پنهان شود نقشهٔ «منحنی میزان» را برای استفاده در این منطقه دانلود کنید. @@ -2664,7 +2664,7 @@ کپی موقعیت/نام POI مکان بی‌نام دیدن یادداشت‌های بسته - پنهان/آشکارکردن یادداشت‌های OSM. + پنهان یا آشکارکردن یادداشت‌های OSM. ‏GPX - مناسب برای استفاده در JOSM یا سایر ویرایشگرهای OSM. ‏OSC - مناسب برای استفاده در OSM. فایل GPX @@ -3188,9 +3188,9 @@ محدوده‌های کاهش آلودگی هوای شهر را روی نقشه نشان بده. روی مسیریابی اثر نمی‌گذارد. محدوده‌های کاهش در نظر گرفتن محدودیت‌های موقت در مسیریابی - اسکی آلپاین/دان‌هیل + اسکی آلپاین و دانهیل سراشیبی‌های اسکی آلپاین یا دان‌هیل و دسترسی به بالابرهای اسکی. - اسکی کراس/نوردیک + اسکی کراس‌کانتری و نوردیک مسیرهای اسکی کراس یا نوردیک. شکست باز کن @@ -3456,7 +3456,7 @@ امتیاز بدهید ناوبری، صحت ردنگاری اندازهٔ عکس، کیفیت صدا و ویدئو - ثبت ورود، گذرواژه، ویرایش آفلاین + نام کاربری، گذرواژه، ویرایش آفلاین انتخاب نماد، رنگ و نام ردیابی آنلاین صحت ردنگاری @@ -3464,7 +3464,7 @@ یادداشت‌های عکسی محاسبهٔ مجدد مسیر نام کاربری و گذرواژه - این تنظیمات افزونه، سراسری است و روی همهٔ پروفایل‌ها به کار گرفته می‌شود. + این تنظیمات افزونه، سراسری است و روی همهٔ پروفایل‌ها به کار گرفته می‌شود ویرایش OSM OSM نمادی که هنگام حرکت یا ناوبری نمایش داده می‌شود. @@ -3594,7 +3594,7 @@ ناهمواری‌ها نقشهٔ سایه‌روشن که شیب‌ها، بلندی‌ها و پستی‌ها را با استفاده از سایه‌های تیره نمایان می‌کند. کمینه و بیشینهٔ زوم برای نمایش لایه را مشخص کنید. - برای مشاهدهٔ سایه‌روشن‌ها روی نقشه باید نقشهٔ دیگری را نیز دانلود کنید. + "باید نقشهٔ دیگری را نیز دانلود کنید تا سایه‌روشن‌ها را روی نقشه ببینید." برای مشاهدهٔ شیب‌ها روی نقشه باید نقشهٔ دیگری را نیز دانلود کنید. دربارهٔ شیب‌ها می‌توانید در %1$s بیشتر بخوانید. شفافیت @@ -3604,7 +3604,7 @@ سایه‌روشن %1$s از %2$s شیب‌ها - آشکار/پنهان کردن ناهمواری‌ها + آشکار یا پنهان کردن ناهمواری‌ها پنهان‌کردن ناهمواری‌ها نمایش ناهمواری‌ها دکمه‌ای برای آشکار یا پنهان کردن لایهٔ ناهمواری‌ها روی نقشه. @@ -3717,12 +3717,12 @@ \n \n بازگشت به ویرایش - ایجاد / ویرایش POI - افزودن / ویرایش علاقه‌مندی + ایجاد یا ویرایش POI + افزودن یا ویرایش علاقه‌مندی برای دسترسی به این کنش‌ها می‌توانید روی دکمهٔ «%1$s» بزنید. مخفی‌کردن حمل‌ونقل عمومی نمایش حمل‌ونقل عمومی - آشکار/پنهان کردن حمل‌ونقل عمومی + آشکار یا پنهان کردن حمل‌ونقل عمومی دکمه‌ای برای آشکار یا پنهان کردن حمل‌ونقل عمومی روی نقشه. با لمس دکمهٔ عملیاتی بین پروفایل‌های انتخاب‌شده جابه‌جا شوید. افزودن پروفایل @@ -3823,7 +3823,7 @@ حذف نزدیک‌ترین مقصد لطفاً نام نقطه را بنویسید دانلود نقشه‌های ویکی‌پدیا - از ویکی‌پدیا دربارهٔ نقاط توجه اطلاعات کسب کنید؛ مانند یک راهنمای آفلاین جیبی. کافی است افزونهٔ ویکی‌پدیا را فعال کنید و از مقاله‌های مربوط به چیزهای دوروبرتان لذت ببرید. + دربارهٔ نقاط توجه، از ویکی‌پدیا اطلاعات کسب کنید. یک راهنمای آفلاینِ جیبی که مقاله‌هایی دربارهٔ مکان‌ها و مقصدها دارد. صندلی چرخ‌دار یادداشت اُاِس‌اِمی بسته نقطهٔ اضافه‌شده روی نقشه دیده نمی‌شود، زیرا گروه انتخاب‌شده پنهان است. آن را در «%s» پیدا می‌کنید. @@ -3864,11 +3864,11 @@ \n حذفِ قبل حذفِ بعد - تغییر نوع مسیرِ بعد آن - تغییر نوع مسیرِ قبل آن + تغییر نوع مسیرِ بعد + تغییر نوع مسیرِ قبل تک‌رنگ طول وسیلهٔ نقلیهٔ خود را مشخص کنید. ممکن است محدودیت‌های مسیر برای وسایل نقلیهٔ طویل اِعمال شود. - مقصد کنونی مسیر حذف خواهد شد. اگر این قرار است مقصد باشد، ناوبری متوقف می‌شود. + مقصد بعدیِ مسیر شما را حذف خواهد کرد. البته اگر مقصد نهایی باشد، ناوبری را متوقف می‌کند. افزودن به یک رد ذخیره به‌عنوان رد جدید برعکس‌کردن مسیر @@ -3886,7 +3886,7 @@ پروفایل ناوبری یک فایل رد انتخاب کنید تا پارهٔ جدید را به آن بیفزایید. تصاویر نمای خیابان - آیا می‌خواهید خارج شوید و همهٔ تغییرات مسیر طراحی‌شده را از بین ببرید؟ + آیا می‌خواهید همهٔ تغییرات در مسیر طراحی‌شده از بین برود؟ اگر برعکس حرکت کردم ابتدای رد انتخاب فایل رد برای دنبال‌کردن @@ -3963,15 +3963,15 @@ \nنمودار پس از بازمحاسبهٔ مسیر فراهم می‌شود. %1$s — %2$s دست‌کم دو نقطه اضافه کنید - ثبت ورود در اوپن‌استریت‌مپ - ثبت ورود در OpenStreetMap.org + ورود به اوپن‌استریت‌مپ + ورود به OpenStreetMap.org ثبت ورود از طریق اوپن‌استریت‌مپ - برای آپلود تغییرات جدید باید ثبت ورود (login) کنید. + برای آپلود تغییرات جدید باید وارد شوید (login). \n -\nبرای ثبت ورود می‌توانید از روش امن OAuth یا روش نام کاربری و گذرواژه استفاده کنید. +\nبرای ورود می‌توانید از روش امن OAuth یا روش نام کاربری و گذرواژه استفاده کنید. استفاده از نام کاربری و گذرواژه حساب - ثبت ورود + ورود مدیریت اشتراک روی دکمه بزنید و یک شیوهٔ پرداخت در گوگل‌پلی تنظیم کنید تا اشتراک خود را اصلاح نمایید. تاریخچهٔ نشانه‌ها @@ -4006,4 +4006,35 @@ افزودن یک بخش جدید نمایهٔ OsmAnd نمایهٔ کاربر + زمان‌های پیام‌های گفتاری + MGRS + MGRS + ‏OsmAnd از MGRS استفاده می‌کند که شبیه قالب UTM NATO است. + سپاسگزاریم که Contour lines را خریدید + برچسب‌ها را بنویسید و با کاما جدا کنید. + بستن یادداشت OSM + نظردادن به یادداشت OSM + می‌توانید با روش ایمن OAuth وارد شوید یا از نام‌کاربری و گذرواژه‌تان استفاده کنید. + قایق‌موتوری + آپلود عکس ناموفق بود، لطفاً بعداً دوباره امتحان کنید + انتخاب تصویر + منابع + اندازهٔ تخمینی فایل + دادهٔ موردنظر برای برون‌برد در فایل را انتخاب کنید. + برای درون‌برد لازم است + برعکس‌کردن همهٔ نقطه‌ها + پروفایلِ هنگام شروع برنامه را انتخاب کنید. + آخرین استفاده + افزودن موتور مسیریابی آنلاین + ویرایش موتور مسیریابی آنلاین + وسیله نقلیه + کلید API + پارامتر را وارد کنید + ‏URL با همهٔ پارامترها شبیه این است: + آزمایش محاسبهٔ مسیر + رانندگی + پا + دوچرخه + خودرو + خطا، پارامترها را بازبینی کنید \ No newline at end of file From f65d0a2deeeb627afcdce32bd80ee6503c71054b Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Wed, 6 Jan 2021 08:38:37 +0000 Subject: [PATCH 07/37] Translated using Weblate (French) Currently translated at 99.9% (3880 of 3881 strings) --- OsmAnd/res/values-fr/phrases.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml index 1d225381f7..83c34749e1 100644 --- a/OsmAnd/res/values-fr/phrases.xml +++ b/OsmAnd/res/values-fr/phrases.xml @@ -3896,8 +3896,11 @@ Vaccination : covid19 Vaccination Tunnel à chauve-souris - Pont à chauve- - Passage à faune - Zone de + Pont à chauve-souris + Passage de faune + Zone de baignade Lavoir + Station de traitement des déchets + Pont de levage + Poste de garde forestier \ No newline at end of file From 41eefeda5dfb4654d1d4c6cb07c41e16b32b74a9 Mon Sep 17 00:00:00 2001 From: Verdulo Date: Wed, 6 Jan 2021 14:25:29 +0000 Subject: [PATCH 08/37] Translated using Weblate (Esperanto) Currently translated at 100.0% (3606 of 3606 strings) --- OsmAnd/res/values-eo/strings.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index bf083e4542..2c1f95858b 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -4028,4 +4028,19 @@ Permesi navigi per periode sekiĝantaj akvovojoj Permesi sezonajn akvovojojn Tempoj de voĉaj anoncoj + Aldoni enretan navigilon + Redakti enretan navigilon + Subspeco + Veturilo + API-ŝlosilo + Ligilo al servilo + Enigu parametron + Se malnecesa, enigu nenion + Ligilo kun ĉiuj parametroj aspektos kiel tiu ĉi: + Stirado + Testi kalkuli kurson + Piediranto + Biciklo + Aŭtomobilo + Eraro, rekontrolu parametrojn \ No newline at end of file From 301efb0252840cee6d50b683ba89231e21adb0c6 Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Thu, 7 Jan 2021 06:24:05 +0000 Subject: [PATCH 09/37] Translated using Weblate (French) Currently translated at 100.0% (3607 of 3607 strings) --- OsmAnd/res/values-fr/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index dd175df3ba..008a82ffa3 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4022,4 +4022,5 @@ Ajouter un moteur de routage en ligne Modifier le moteur de routage en ligne L\'URL avec tous les paramètres sera de la forme : + Copier l\'adresse \ No newline at end of file From 5afed63b53ab7a9aee0ba49b44d80d5565babaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Thu, 7 Jan 2021 04:41:49 +0000 Subject: [PATCH 10/37] Translated using Weblate (Turkish) Currently translated at 100.0% (3607 of 3607 strings) --- OsmAnd/res/values-tr/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml index fccc6158e3..2e1ed5e651 100644 --- a/OsmAnd/res/values-tr/strings.xml +++ b/OsmAnd/res/values-tr/strings.xml @@ -3998,4 +3998,5 @@ Bisiklet Araba Hata, parametreleri tekrar gözden geçirin + Adresi kopyala \ No newline at end of file From cbcee006be2c1785ed0f1d28105c60e390c14270 Mon Sep 17 00:00:00 2001 From: Temuri Doghonadze Date: Thu, 7 Jan 2021 04:37:31 +0000 Subject: [PATCH 11/37] Translated using Weblate (Georgian) Currently translated at 64.9% (2344 of 3607 strings) --- OsmAnd/res/values-ka/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd/res/values-ka/strings.xml b/OsmAnd/res/values-ka/strings.xml index 723edda859..720fa5a374 100644 --- a/OsmAnd/res/values-ka/strings.xml +++ b/OsmAnd/res/values-ka/strings.xml @@ -2352,4 +2352,8 @@ რეჟიმი: %s საცალფეხო გზების არიდება საცალფეხო ფზების არიდება + შენახულია + ბოლო ცვლილება + სახელი: ჰ-ა + სახელი: ა-ჰ \ No newline at end of file From 2487e51a58d5362cd6b69ddbae4591051c2751a3 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Thu, 7 Jan 2021 03:07:00 +0000 Subject: [PATCH 12/37] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (3607 of 3607 strings) --- OsmAnd/res/values-zh-rTW/strings.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 115f04c6d7..9e432f64ed 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -4023,4 +4023,20 @@ 允許間歇水路 允許間歇水路 語音提示時間 + 新增線上路線引擎 + 編輯線上路線引擎 + 子類型 + 車輛 + API 金鑰 + 伺服器 URL + 輸入參數 + 否則請保持空白 + 帶有所有參數的 URL 如下所示: + 測試路線計算 + 駕駛 + 步行 + 自行車 + 汽車 + 錯誤,重新檢查參數 + 複製地址 \ No newline at end of file From 0361b6b773f3009344941d1cd4484882a80ad04b Mon Sep 17 00:00:00 2001 From: Kseniia Date: Thu, 7 Jan 2021 12:11:49 +0200 Subject: [PATCH 13/37] add conditions for restrictions via ways --- .../net/osmand/router/BinaryRoutePlanner.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index 6b8926b413..e641af4145 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -29,7 +29,7 @@ public class BinaryRoutePlanner { protected static final Log log = PlatformUtil.getLog(BinaryRoutePlanner.class); private static final int ROUTE_POINTS = 11; - private static final boolean TRACE_ROUTING = false; + private static final boolean TRACE_ROUTING = true; public static double squareRootDist(int x1, int y1, int x2, int y2) { @@ -647,26 +647,39 @@ public class BinaryRoutePlanner { int type = -1; if (!reverseWay) { for (int i = 0; i < road.getRestrictionLength(); i++) { + int rt = road.getRestrictionType(i); + long rv = road.getRestrictionVia(i); if (road.getRestrictionId(i) == next.road.id) { - if(!via || road.getRestrictionVia(i) == viaId) { - type = road.getRestrictionType(i); + if (!via || rv == viaId) { + type = rt; break; } } + if (rv == viaId && rt == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { + type = MapRenderingTypes.RESTRICTION_NO_STRAIGHT_ON; + break; + } } } else { for (int i = 0; i < next.road.getRestrictionLength(); i++) { int rt = next.road.getRestrictionType(i); + long rv = next.road.getRestrictionVia(i); long restrictedTo = next.road.getRestrictionId(i); if (restrictedTo == road.id) { - if(!via || next.road.getRestrictionVia(i) == viaId) { + if (!via || rv == viaId) { type = rt; break; } } + if (rv == viaId && rt == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { + type = MapRenderingTypes.RESTRICTION_NO_STRAIGHT_ON; + break; + } + // Check if there is restriction only to the other than current road - if (rt == MapRenderingTypes.RESTRICTION_ONLY_RIGHT_TURN || rt == MapRenderingTypes.RESTRICTION_ONLY_LEFT_TURN + if (rt == MapRenderingTypes.RESTRICTION_ONLY_RIGHT_TURN + || rt == MapRenderingTypes.RESTRICTION_ONLY_LEFT_TURN || rt == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { // check if that restriction applies to considered junk RouteSegment foundNext = inputNext; @@ -674,6 +687,8 @@ public class BinaryRoutePlanner { if (foundNext.getRoad().id == restrictedTo) { break; } + + foundNext = foundNext.next; } if (foundNext != null) { @@ -682,7 +697,7 @@ public class BinaryRoutePlanner { } } } - if (type == REVERSE_WAY_RESTRICTION_ONLY) { + if (type == REVERSE_WAY_RESTRICTION_ONLY) { // next = next.next; continue; } else if (type == -1 && exclusiveRestriction) { // next = next.next; continue; From 2c802717a91aaed431a88fbaa84c667587915320 Mon Sep 17 00:00:00 2001 From: Kseniia Date: Thu, 7 Jan 2021 12:15:51 +0200 Subject: [PATCH 14/37] add conditions for restrictions via ways --- .../main/java/net/osmand/router/BinaryRoutePlanner.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index e641af4145..ebfe18940c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -29,7 +29,7 @@ public class BinaryRoutePlanner { protected static final Log log = PlatformUtil.getLog(BinaryRoutePlanner.class); private static final int ROUTE_POINTS = 11; - private static final boolean TRACE_ROUTING = true; + private static final boolean TRACE_ROUTING = false; public static double squareRootDist(int x1, int y1, int x2, int y2) { @@ -678,8 +678,7 @@ public class BinaryRoutePlanner { } // Check if there is restriction only to the other than current road - if (rt == MapRenderingTypes.RESTRICTION_ONLY_RIGHT_TURN - || rt == MapRenderingTypes.RESTRICTION_ONLY_LEFT_TURN + if (rt == MapRenderingTypes.RESTRICTION_ONLY_RIGHT_TURN || rt == MapRenderingTypes.RESTRICTION_ONLY_LEFT_TURN || rt == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { // check if that restriction applies to considered junk RouteSegment foundNext = inputNext; @@ -687,8 +686,6 @@ public class BinaryRoutePlanner { if (foundNext.getRoad().id == restrictedTo) { break; } - - foundNext = foundNext.next; } if (foundNext != null) { @@ -697,7 +694,7 @@ public class BinaryRoutePlanner { } } } - if (type == REVERSE_WAY_RESTRICTION_ONLY) { + if (type == REVERSE_WAY_RESTRICTION_ONLY) { // next = next.next; continue; } else if (type == -1 && exclusiveRestriction) { // next = next.next; continue; From 31ffca2547238809ec0818bbbae416178afc2352 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 7 Jan 2021 11:23:24 +0100 Subject: [PATCH 15/37] Formatting --- OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java | 9 ++++----- .../osmand/plus/routing/data/AnnounceTimeDistances.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java index 2d35556d84..a19ebd3023 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java @@ -673,15 +673,15 @@ public class OsmAndLocationProvider implements SensorEventListener { private void stopLocationRequests() { LocationManager service = (LocationManager) app.getSystemService(Context.LOCATION_SERVICE); - if(gpsStatusListener != null) { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + if (gpsStatusListener != null) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { service.unregisterGnssStatusCallback((GnssStatus.Callback) gpsStatusListener); } else { service.removeGpsStatusListener((Listener) gpsStatusListener); } } service.removeUpdates(gpsListener); - while(!networkListeners.isEmpty()) { + while (!networkListeners.isEmpty()) { service.removeUpdates(networkListeners.poll()); } } @@ -812,8 +812,7 @@ public class OsmAndLocationProvider implements SensorEventListener { setLocation(location); } - private void setLocation(net.osmand.Location location) { - if (location == null) { + private void setLocation(net.osmand.Location location) { if (location == null) { updateGPSInfo(null); } diff --git a/OsmAnd/src/net/osmand/plus/routing/data/AnnounceTimeDistances.java b/OsmAnd/src/net/osmand/plus/routing/data/AnnounceTimeDistances.java index bc00ae7833..497f237158 100644 --- a/OsmAnd/src/net/osmand/plus/routing/data/AnnounceTimeDistances.java +++ b/OsmAnd/src/net/osmand/plus/routing/data/AnnounceTimeDistances.java @@ -73,7 +73,7 @@ public class AnnounceTimeDistances { // Do not play prepare: for pedestrian and slow transport // same check as speed < 150/(90-22) m/s = 2.2 m/s = 8 km/h - // if (DEFAULT_SPEED < 2.3) { + // if (DEFAULT_SPEED < 2.3) { if (PREPARE_DISTANCE_END - TURN_IN_DISTANCE < 150) { PREPARE_DISTANCE_END = PREPARE_DISTANCE * 2; } From 6e584b4913a868e7f317c18fbe8ee5ec060e7b2e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 7 Jan 2021 11:28:53 +0100 Subject: [PATCH 16/37] Fix plan route direction --- .../src/test/java/net/osmand/router/RouteTestingTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java index 06e6ef8fda..612cc4b882 100644 --- a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java +++ b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java @@ -78,6 +78,9 @@ public class RouteTestingTest { } RoutingConfiguration config = builder.build(params.containsKey("vehicle") ? params.get("vehicle") : "car", RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params); + if (params.containsKey("planRoadDirection")) { + config.planRoadDirection = Integer.parseInt(params.get("planRoadDirection")); + } RoutingContext ctx = fe.buildRoutingContext(config, null, binaryMapIndexReaders, RoutePlannerFrontEnd.RouteCalculationMode.NORMAL); ctx.leftSideNavigation = false; From d9e76169fe0166f7d0bfc38aab76d82f93e0fcc9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 7 Jan 2021 11:52:50 +0100 Subject: [PATCH 17/37] Make tests to go all possible combinations --- .../net/osmand/router/RouteTestingTest.java | 80 ++++++++++--------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java index 612cc4b882..0a0601b41a 100644 --- a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java +++ b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java @@ -15,13 +15,11 @@ import java.util.TreeSet; import net.osmand.binary.BinaryMapIndexReader; -import net.osmand.data.LatLon; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -76,44 +74,52 @@ public class RouteTestingTest { } else { binaryMapIndexReaders = new BinaryMapIndexReader[]{new BinaryMapIndexReader(raf, new File(fl))}; } - RoutingConfiguration config = builder.build(params.containsKey("vehicle") ? params.get("vehicle") : "car", - RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params); - if (params.containsKey("planRoadDirection")) { - config.planRoadDirection = Integer.parseInt(params.get("planRoadDirection")); - } - RoutingContext ctx = fe.buildRoutingContext(config, null, binaryMapIndexReaders, - RoutePlannerFrontEnd.RouteCalculationMode.NORMAL); - ctx.leftSideNavigation = false; - List routeSegments = fe.searchRoute(ctx, te.getStartPoint(), te.getEndPoint(), te.getTransitPoint()); - Set reachedSegments = new TreeSet(); - Assert.assertNotNull(routeSegments); - int prevSegment = -1; - for (int i = 0; i <= routeSegments.size(); i++) { - if (i == routeSegments.size() || routeSegments.get(i).getTurnType() != null) { - if (prevSegment >= 0) { - String name = routeSegments.get(prevSegment).getDescription(); - long segmentId = routeSegments.get(prevSegment).getObject().getId() >> (RouteResultPreparation.SHIFT_ID); - System.out.println("segmentId: " + segmentId + " description: " + name); + + for (int planRoadDirection = -1; planRoadDirection <= 1; planRoadDirection++) { + if (params.containsKey("onlyPlanRoadDirection")) { + if (!params.get("onlyPlanRoadDirection").equals(planRoadDirection + "")) { + continue; } - prevSegment = i; } - if (i < routeSegments.size()) { - reachedSegments.add(routeSegments.get(i).getObject().getId() >> (RouteResultPreparation.SHIFT_ID)); - } - } - Map expectedResults = te.getExpectedResults(); - Iterator> it = expectedResults.entrySet().iterator(); - while (it.hasNext()) { - Entry es = it.next(); - if (es.getValue().equals("false")) { - Assert.assertTrue("Expected segment " + (es.getKey()) + " was wrongly reached in route segments " - + reachedSegments.toString(), !reachedSegments.contains(es.getKey())); - } else { - Assert.assertTrue("Expected segment " + (es.getKey()) + " weren't reached in route segments " - + reachedSegments.toString(), reachedSegments.contains(es.getKey())); - } - } + RoutingConfiguration config = builder.build(params.containsKey("vehicle") ? params.get("vehicle") : "car", + RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params); + config.planRoadDirection = planRoadDirection; + RoutingContext ctx = fe.buildRoutingContext(config, null, binaryMapIndexReaders, + RoutePlannerFrontEnd.RouteCalculationMode.NORMAL); + ctx.leftSideNavigation = false; + List routeSegments = fe.searchRoute(ctx, te.getStartPoint(), te.getEndPoint(), + te.getTransitPoint()); + Set reachedSegments = new TreeSet(); + Assert.assertNotNull(routeSegments); + int prevSegment = -1; + for (int i = 0; i <= routeSegments.size(); i++) { + if (i == routeSegments.size() || routeSegments.get(i).getTurnType() != null) { + if (prevSegment >= 0) { + String name = routeSegments.get(prevSegment).getDescription(); + long segmentId = routeSegments.get(prevSegment).getObject() + .getId() >> (RouteResultPreparation.SHIFT_ID); + System.out.println("segmentId: " + segmentId + " description: " + name); + } + prevSegment = i; + } + if (i < routeSegments.size()) { + reachedSegments.add(routeSegments.get(i).getObject().getId() >> (RouteResultPreparation.SHIFT_ID)); + } + } + Map expectedResults = te.getExpectedResults(); + Iterator> it = expectedResults.entrySet().iterator(); + while (it.hasNext()) { + Entry es = it.next(); + if (es.getValue().equals("false")) { + Assert.assertTrue("Expected segment " + (es.getKey()) + " was wrongly reached in route segments " + + reachedSegments.toString(), !reachedSegments.contains(es.getKey())); + } else { + Assert.assertTrue("Expected segment " + (es.getKey()) + " weren't reached in route segments " + + reachedSegments.toString(), reachedSegments.contains(es.getKey())); + } + } + } } } From 3f731c4e508af965f25d044d837363fb3ea17970 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 7 Jan 2021 12:06:35 +0100 Subject: [PATCH 18/37] Fix tests --- .../src/test/java/net/osmand/router/RouteTestingTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java index 0a0601b41a..65b4eb74a5 100644 --- a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java +++ b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java @@ -76,8 +76,8 @@ public class RouteTestingTest { } for (int planRoadDirection = -1; planRoadDirection <= 1; planRoadDirection++) { - if (params.containsKey("onlyPlanRoadDirection")) { - if (!params.get("onlyPlanRoadDirection").equals(planRoadDirection + "")) { + if (params.containsKey("wrongPlanRoadDirection")) { + if (params.get("wrongPlanRoadDirection").equals(planRoadDirection + "")) { continue; } } From 347324ba5d7f9bb756aa1bb18921e4b6383097be Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 7 Jan 2021 14:50:17 +0300 Subject: [PATCH 19/37] Fix search and lang sorting in TravelObfHelper --- .../plus/wikivoyage/data/TravelObfHelper.java | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 94a9d73033..55c5e6ee32 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -6,6 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import net.osmand.Collator; +import net.osmand.CollatorStringMatcher.StringMatcherMode; import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; import net.osmand.IndexConstants; @@ -21,6 +22,7 @@ import net.osmand.data.QuadRect; import net.osmand.osm.PoiCategory; import net.osmand.plus.OsmandApplication; import net.osmand.plus.wikivoyage.data.TravelArticle.TravelArticleIdentifier; +import net.osmand.search.core.SearchPhrase.NameStringMatcher; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -191,10 +193,24 @@ public class TravelObfHelper implements TravelHelper { public List search(@NonNull String searchQuery) { List res = new ArrayList<>(); Map> amenityMap = new HashMap<>(); + final String appLang = app.getLanguage(); + final NameStringMatcher nm = new NameStringMatcher(searchQuery, StringMatcherMode.CHECK_STARTS_FROM_SPACE); for (BinaryMapIndexReader reader : getReaders()) { try { SearchRequest searchRequest = BinaryMapIndexReader.buildSearchPoiRequest(0, 0, searchQuery, - 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, getSearchRouteArticleFilter(), null, null); + 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, getSearchRouteArticleFilter(), new ResultMatcher() { + @Override + public boolean publish(Amenity object) { + List otherNames = object.getAllNames(false); + String localeName = object.getName(appLang); + return nm.matches(localeName) || nm.matches(otherNames); + } + + @Override + public boolean isCancelled() { + return false; + } + }, null); List amenities = reader.searchPoiByName(searchRequest); if (!Algorithms.isEmpty(amenities)) { @@ -205,14 +221,35 @@ public class TravelObfHelper implements TravelHelper { } } if (!Algorithms.isEmpty(amenityMap)) { - String appLang = app.getLanguage(); + final boolean appLangEn = "en".equals(appLang); for (Entry> entry : amenityMap.entrySet()) { File file = entry.getKey(); for (Amenity amenity : entry.getValue()) { Set nameLangs = getLanguages(amenity); if (nameLangs.contains(appLang)) { TravelArticle article = readArticle(file, amenity, appLang); - WikivoyageSearchResult r = new WikivoyageSearchResult(article, new ArrayList<>(nameLangs)); + ArrayList langs = new ArrayList<>(nameLangs); + Collections.sort(langs, new Comparator() { + @Override + public int compare(String l1, String l2) { + if (l1.equals(appLang)) { + l1 = "1"; + } + if (l2.equals(appLang)) { + l2 = "1"; + } + if (!appLangEn) { + if (l1.equals("en")) { + l1 = "2"; + } + if (l2.equals("en")) { + l2 = "2"; + } + } + return l1.compareTo(l2); + } + }); + WikivoyageSearchResult r = new WikivoyageSearchResult(article, langs); res.add(r); } } From eedff9b43c56d6f96e804e5de4e3280929389d64 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 7 Jan 2021 19:11:14 +0300 Subject: [PATCH 20/37] Fix search and lang sorting in TravelObfHelper --- .../data/TravelLocalDataHelper.java | 2 +- .../explore/WikivoyageExploreActivity.java | 28 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java index 288b71dd88..6321eab0d8 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java @@ -508,7 +508,7 @@ public class TravelLocalDataHelper { BOOKMARKS_COL_ROUTE_ID + " = ?, " + BOOKMARKS_COL_CONTENT_JSON + " = ?, " + BOOKMARKS_COL_CONTENT + " = ?, " + - BOOKMARKS_COL_LAST_MODIFIED + " = ?, " + + BOOKMARKS_COL_LAST_MODIFIED + " = ? " + "WHERE " + BOOKMARKS_COL_ARTICLE_TITLE + " = ? " + " AND " + BOOKMARKS_COL_ROUTE_ID + " = ?" + " AND " + BOOKMARKS_COL_LANG + " = ?" + diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java index 202c834d8d..dae47525aa 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java @@ -27,13 +27,14 @@ import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener; import net.osmand.AndroidUtils; +import net.osmand.plus.AppInitializer; import net.osmand.plus.LockableViewPager; import net.osmand.plus.OnDialogFragmentResultListener; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.TabActivity; import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; +import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.wikipedia.WikiArticleHelper; import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment; import net.osmand.plus.wikivoyage.data.TravelArticle; @@ -314,7 +315,24 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv public void populateData() { switchProgressBarVisibility(true); - new LoadWikivoyageData(this).execute(); + if (app.isApplicationInitializing()) { + final WeakReference activityRef = new WeakReference<>(this); + app.getAppInitializer().addListener(new AppInitializer.AppInitializeListener() { + @Override + public void onProgress(AppInitializer init, AppInitializer.InitEvents event) { + } + + @Override + public void onFinish(AppInitializer init) { + WikivoyageExploreActivity activity = activityRef.get(); + if (AndroidUtils.isActivityNotDestroyed(activity)) { + new LoadWikivoyageData(activity).execute(); + } + } + }); + } else { + new LoadWikivoyageData(this).execute(); + } } private void onDataLoaded() { @@ -364,8 +382,8 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv private static class LoadWikivoyageData extends AsyncTask { - private WeakReference activityRef; - private TravelHelper travelHelper; + private final WeakReference activityRef; + private final TravelHelper travelHelper; LoadWikivoyageData(WikivoyageExploreActivity activity) { travelHelper = activity.getMyApplication().getTravelHelper(); @@ -381,7 +399,7 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv @Override protected void onPostExecute(Void result) { WikivoyageExploreActivity activity = activityRef.get(); - if (activity != null) { + if (AndroidUtils.isActivityNotDestroyed(activity)) { activity.onDataLoaded(); } } From c8d0b19d505e93caa93ce22c2ed8f35c78c42f7a Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 7 Jan 2021 14:01:58 +0000 Subject: [PATCH 21/37] Translated using Weblate (German) Currently translated at 99.9% (3606 of 3607 strings) --- OsmAnd/res/values-de/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 19175d85be..4e20ce5f44 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -4044,4 +4044,7 @@ Fahrrad Auto Fehler, Parameter erneut prüfen + Subtyp + Leer lassen, wenn kein API-Schlüssel vorhanden + Adresse kopieren \ No newline at end of file From 9f4221a12591d4f828cf6ef18bb4aa3bedf9bedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Babos=20G=C3=A1bor?= Date: Thu, 7 Jan 2021 07:49:04 +0000 Subject: [PATCH 22/37] Translated using Weblate (Hungarian) Currently translated at 100.0% (3607 of 3607 strings) --- OsmAnd/res/values-hu/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index a9e91052bd..f411c3da1b 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -4035,4 +4035,5 @@ Az összes paraméterrel rendelkező URL így néz ki: Útvonaltervezés kipróbálása Hiba, ellenőrizze újra a paramétereket + Cím másolása \ No newline at end of file From 8a7c935159770290b4d42a17e6e2a0c31ee1e99c Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Thu, 7 Jan 2021 07:46:49 +0000 Subject: [PATCH 23/37] Translated using Weblate (Hebrew) Currently translated at 99.9% (3606 of 3607 strings) --- OsmAnd/res/values-iw/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index f2f971e562..fa7a3545a9 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -4047,4 +4047,5 @@ אופנוע מכונית שגיאה, נא לבדוק את המשתנים מחדש + העתקת כתובת \ No newline at end of file From f6f1ef0354808e125e6af7791522c57f021e0e69 Mon Sep 17 00:00:00 2001 From: WaldiS Date: Thu, 7 Jan 2021 12:54:28 +0000 Subject: [PATCH 24/37] Translated using Weblate (Polish) Currently translated at 99.4% (3587 of 3607 strings) --- OsmAnd/res/values-pl/strings.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 2fcf1a61c4..9ed8923f81 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -4032,4 +4032,17 @@ Zezwalaj na strumienie i dreny Zezwalaj na przerywane drogi wodne Zezwalaj na przerywane drogi wodne + Czas monitów głosowych + Podtyp + Pojazd + Klucz API + Adres URL serwera + Wpisz param + Jeśli nie, zostaw to puste + Adres URL ze wszystkimi parametrami będzie wyglądał następująco: + Obliczanie trasy testowej + Rower + Samochód + Błąd, ponownie sprawdź parametry + Skopiuj adres \ No newline at end of file From 9bf9efe4d3e17a2aa9d2c9613fffbe2d5602bf11 Mon Sep 17 00:00:00 2001 From: Gontzal Manuel Pujana Onaindia Date: Thu, 7 Jan 2021 08:43:05 +0000 Subject: [PATCH 25/37] Translated using Weblate (Basque) Currently translated at 98.6% (3557 of 3607 strings) --- OsmAnd/res/values-eu/strings.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml index 4b641200f9..e1a7e107c2 100644 --- a/OsmAnd/res/values-eu/strings.xml +++ b/OsmAnd/res/values-eu/strings.xml @@ -785,7 +785,7 @@ Ez dago gogoko punturik gordetzeko Inportatu Ezin izan da GPX kargatu. - Bidali informea + Bidali txostena Ezin izan da deskargatutako maparik aurkitu memoria txartelean. Idatzi interesgune bat bilatzeko Edozein @@ -4008,4 +4008,18 @@ Area honi dagokio: %1$s x %2$s Zatitu aurretik Zatitu ondoren Gehitu segmentu berria + Azpimota + Ibilgailua + API gakoa + Zerbitzariaren URLa + Sartu parametroa + Mantendu hutsik hala ez bada + Parametro guztiak dituen URLak itxura hau izango du: + Proba ibilbidearen kalkulua + Gidatzen + Oinez + Bizikleta + Kotxea + Errorea, egiaztatu parametroak berriro + Kopiatu helbidea \ No newline at end of file From 401aa58437ca34a4e38f066b2c93710059dd5ccd Mon Sep 17 00:00:00 2001 From: Ajeje Brazorf Date: Thu, 7 Jan 2021 18:43:03 +0000 Subject: [PATCH 26/37] Translated using Weblate (Sardinian) Currently translated at 99.3% (3583 of 3607 strings) --- OsmAnd/res/values-sc/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index 473e0bae95..4dea386d11 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -618,7 +618,7 @@ Imprea sas mapas in lìnia (iscàrriga e archìvia sos tasseddos in s’ischeda de memòria). Mapas in lìnia Ischerta sas mitzas de sas mapas in lìnia o de sos tasseddos in cache. - Permitit de impreare sas funtzionalidades pro s\'atzessibilidade de su dispositivu ditetamente in OsmAnd, e fatzilitat, pro nàrrere, sa modìfica de sa lestresa de sas boghes de sìntesi vocale, sa cunfiguratzione de su movimentu de s\'ischermu, s’impreu de una trackball pro s\'ismanniamentu o de un’interfàtzia vocale pro cosas che s\'annùntziu de sa positzione tua. + Permitit de impreare sas funtzionalidades pro s\'atzessibilidade de su dispositivu diretamente in OsmAnd, e fatzìlitat, pro nàrrere, sa modìfica de sa lestresa de sas boghes de sìntesi vocale, sa cunfiguratzione de su movimentu de s\'ischermu, s’impreu de una trackball pro s\'ismanniamentu o de un’interfache vocale pro cosas che s\'annùntziu de sa positzione tua. Estensiones Sas estensiones abìlitant funtzionalidades agiuntivas e impostatziones avantzadas. Estensiones @@ -909,7 +909,7 @@ Chirca impreende sa positzione geogràfica Sistema Limba de interfache de s\'aplicatzione (impreada a pustis chi as a torrare a allùghere OsmAnd). - Limba interfàtzia + Limba de interfache non cumpridu Imbeniente Antepostu From 532f08a5098b10e5240fc4f9140a65ef7fe884dd Mon Sep 17 00:00:00 2001 From: WaldiS Date: Thu, 7 Jan 2021 12:58:59 +0000 Subject: [PATCH 27/37] Translated using Weblate (Polish) Currently translated at 99.2% (3852 of 3881 strings) --- OsmAnd/res/values-pl/phrases.xml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-pl/phrases.xml b/OsmAnd/res/values-pl/phrases.xml index 1c3724bfe8..a16c536915 100644 --- a/OsmAnd/res/values-pl/phrases.xml +++ b/OsmAnd/res/values-pl/phrases.xml @@ -121,7 +121,7 @@ Stacja diagnostyczna Myjnia samochodowa Stacja benzynowa;Stacja paliw;CPN;Tanksztela - Stacja ładowania + Stacja ładująca; Stacja ładowania pojazdów elektrycznych; Stacja ładująca EV; Elektryczny punkt ładowania; Punkt ładowania; Elektroniczna stacja ładująca; Sprzęt do zasilania pojazdów elektrycznych Podnośnik Kompresor Parking @@ -3880,4 +3880,20 @@ Rzeka Szczepienia: COVID19 Szczepienia + Kąpielisko + Stacja przeładunkowa + Waga pomostowa + Stacja strażników + Pompa zasilana + Stacja uzdatniania wody + Studnia rurowa + Baza ratowników + Mobilny agent pieniędzy + Subnarodowe + Przedstawicielstwo + Konsul honorowy + Biuro konsularne + Sekcja zainteresowań + Łączność + Łączność \ No newline at end of file From 144b1d5c58b6046a1957ba5de892d8b507927a52 Mon Sep 17 00:00:00 2001 From: Franco Date: Thu, 7 Jan 2021 18:16:21 +0000 Subject: [PATCH 28/37] Translated using Weblate (Spanish (Argentina)) Currently translated at 99.9% (3606 of 3607 strings) --- OsmAnd/res/values-es-rAR/strings.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index cb5bb0ca9b..2b3d261317 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -4033,4 +4033,20 @@ Permite cursos de agua intermitentes Permitir cursos de agua intermitentes Tiempo de los avisos por voz + Añadir motor de navegación en línea + Editar motor de navegación en línea + Subtipo + Vehículo + Clave de la API + URL del servidor + Ingresa parámetro + Si no, mantenerlo vacío + La URL con todos los parámetros se verá así: + Cálculo de la ruta de prueba + Automóvil + Peatón + Bicicleta + Automóvil + Error, vuelve a comprobar los parámetros + Copiar dirección \ No newline at end of file From 9add5f0ef65938f90dce8b30a99f3317f0df6e9a Mon Sep 17 00:00:00 2001 From: Verdulo Date: Thu, 7 Jan 2021 14:48:46 +0000 Subject: [PATCH 29/37] Translated using Weblate (Esperanto) Currently translated at 100.0% (3607 of 3607 strings) --- OsmAnd/res/values-eo/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 2c1f95858b..604d169270 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -4043,4 +4043,5 @@ Biciklo Aŭtomobilo Eraro, rekontrolu parametrojn + Kopii adreson \ No newline at end of file From 5024623d64f2ea49e004dc5bff6c25b8f569183b Mon Sep 17 00:00:00 2001 From: Gontzal Manuel Pujana Onaindia Date: Thu, 7 Jan 2021 08:38:03 +0000 Subject: [PATCH 30/37] Translated using Weblate (Basque) Currently translated at 99.6% (270 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/eu/ --- OsmAnd-telegram/res/values-eu/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd-telegram/res/values-eu/strings.xml b/OsmAnd-telegram/res/values-eu/strings.xml index 1aa22910d7..f6f73a80e6 100644 --- a/OsmAnd-telegram/res/values-eu/strings.xml +++ b/OsmAnd-telegram/res/values-eu/strings.xml @@ -267,4 +267,7 @@ \"Jarraitu\" sakatuz, Telegram eta OsmAnd pribatutasun-politiken baldintzak onartzen dituzu. OsmAnd aztarnariak Telegram plataforma irekia erabiltzen duten bezeroetako bat da. Zure kontaktuek Telegram-eko beste edozein bezero erabil dezakete. Telegram-eko azken eguneratzea: %1$s + Esportatu + Logcat bufferra + Bidali txostena \ No newline at end of file From 371e60b3af447771fb1ffb68e0079936f0fc3c66 Mon Sep 17 00:00:00 2001 From: Kseniia Date: Thu, 7 Jan 2021 21:28:35 +0200 Subject: [PATCH 31/37] add condition for 0 planRoadDirection --- .../src/main/java/net/osmand/router/BinaryRoutePlanner.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index ebfe18940c..5309866f45 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -543,6 +543,10 @@ public class BinaryRoutePlanner { } break; } + + if (from.getRoad().getRestrictionType(i) == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { + return false; + } } } return true; From 80f083cf3a4faa6614791ff95807a0887cd45729 Mon Sep 17 00:00:00 2001 From: Kseniia Date: Thu, 7 Jan 2021 21:30:15 +0200 Subject: [PATCH 32/37] add condition for 0 planRoadDirection --- .../java/net/osmand/router/BinaryRoutePlanner.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index 5309866f45..dabefe81b3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -533,18 +533,17 @@ public class BinaryRoutePlanner { long fid = to.getRoad().getId(); for (int i = 0; i < from.getRoad().getRestrictionLength(); i++) { long id = from.getRoad().getRestrictionId(i); + int tp = from.getRoad().getRestrictionType(i); if (fid == id) { - int tp = from.getRoad().getRestrictionType(i); - if (tp == MapRenderingTypes.RESTRICTION_NO_LEFT_TURN || - tp == MapRenderingTypes.RESTRICTION_NO_RIGHT_TURN || - tp == MapRenderingTypes.RESTRICTION_NO_STRAIGHT_ON || - tp == MapRenderingTypes.RESTRICTION_NO_U_TURN) { + if (tp == MapRenderingTypes.RESTRICTION_NO_LEFT_TURN + || tp == MapRenderingTypes.RESTRICTION_NO_RIGHT_TURN + || tp == MapRenderingTypes.RESTRICTION_NO_STRAIGHT_ON + || tp == MapRenderingTypes.RESTRICTION_NO_U_TURN) { return false; } break; } - - if (from.getRoad().getRestrictionType(i) == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { + if (tp == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) { return false; } } From 71bbd868e24f1630d730b0088707cefdfc0fe14d Mon Sep 17 00:00:00 2001 From: jensMF Date: Thu, 7 Jan 2021 22:38:59 +0100 Subject: [PATCH 33/37] added 'osmand' namespace to header and extensions in gpx files --- OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java index b2cef88e80..bee9fa2b19 100644 --- a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java @@ -1790,6 +1790,7 @@ public class GPXUtilities { serializer.attribute(null, "creator", file.author); //$NON-NLS-1$ } serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1"); //$NON-NLS-1$ //$NON-NLS-2$ + serializer.attribute(null, "xmlns:osmand", "https://osmand.net"); serializer.attribute(null, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); serializer.attribute(null, "xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"); @@ -1938,7 +1939,7 @@ public class GPXUtilities { serializer.startTag(null, "extensions"); if (!extensions.isEmpty()) { for (Entry s : extensions.entrySet()) { - writeNotNullText(serializer, s.getKey(), s.getValue()); + writeNotNullText(serializer,"osmand:" + s.getKey(), s.getValue()); } } if (extensionsWriter != null) { From fa4aa8fde5355071f25d5471cde32ac9a90e819d Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 8 Jan 2021 00:18:12 +0200 Subject: [PATCH 34/37] Add export and import of online routing --- OsmAnd/res/values/strings.xml | 2 + .../onlinerouting/OnlineRoutingEngine.java | 16 +- .../OnlineRoutingEngineFragment.java | 10 +- .../onlinerouting/OnlineRoutingHelper.java | 69 ++++----- .../settings/backend/ExportSettingsType.java | 5 +- .../plus/settings/backend/OsmandSettings.java | 3 +- .../backup/OnlineRoutingSettingsItem.java | 142 ++++++++++++++++++ .../backend/backup/SettingsHelper.java | 19 +++ .../backend/backup/SettingsItemType.java | 3 +- .../backend/backup/SettingsItemsFactory.java | 3 + .../fragments/DuplicatesSettingsAdapter.java | 4 + .../fragments/ExportItemsBottomSheet.java | 5 + .../fragments/ImportDuplicatesFragment.java | 8 + .../fragments/ImportSettingsFragment.java | 9 ++ .../ImportedSettingsItemsAdapter.java | 7 +- 15 files changed, 249 insertions(+), 56 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 4991659469..47645eb555 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,6 +12,8 @@ --> + Online routing engines + Online routing engine Copy address Error, recheck parameters Car diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngine.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngine.java index 10ba169cb1..aae11a39b9 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngine.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngine.java @@ -3,6 +3,7 @@ package net.osmand.plus.onlinerouting; import android.content.Context; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import net.osmand.plus.R; import net.osmand.util.Algorithms; @@ -26,11 +27,13 @@ public class OnlineRoutingEngine { private Map params = new HashMap<>(); public OnlineRoutingEngine(@NonNull String stringKey, - @NonNull ServerType serverType, - @NonNull String vehicleKey, - Map params) { + @NonNull ServerType serverType, + @NonNull String vehicleKey, + @Nullable Map params) { this(stringKey, serverType, vehicleKey); - this.params = params; + if (!Algorithms.isEmpty(params)) { + this.params.putAll(params); + } } public OnlineRoutingEngine(@NonNull String stringKey, @@ -96,8 +99,9 @@ public class OnlineRoutingEngine { } public static OnlineRoutingEngine createNewEngine(@NonNull ServerType serverType, - @NonNull String vehicleKey) { - return new OnlineRoutingEngine(generateKey(), serverType, vehicleKey); + @NonNull String vehicleKey, + @Nullable Map params) { + return new OnlineRoutingEngine(generateKey(), serverType, vehicleKey, params); } private static String generateKey() { diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index 18b24a8762..46e47bc8f2 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -132,8 +132,8 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, - @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { + @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { view = getInflater().inflate( R.layout.online_routing_engine_fragment, container, false); segmentsContainer = (ViewGroup) view.findViewById(R.id.segments_container); @@ -402,7 +402,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { if (isEditingMode()) { engineToSave = new OnlineRoutingEngine(editedEngineKey, engine.serverType, engine.getVehicleKey()); } else { - engineToSave = OnlineRoutingEngine.createNewEngine(engine.serverType, engine.getVehicleKey()); + engineToSave = OnlineRoutingEngine.createNewEngine(engine.serverType, engine.getVehicleKey(), null); } engineToSave.putParameter(EngineParameterType.CUSTOM_SERVER_URL, engine.customServerUrl); @@ -568,8 +568,8 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } public static void showInstance(@NonNull FragmentActivity activity, - @NonNull ApplicationMode appMode, - String editedEngineKey) { + @NonNull ApplicationMode appMode, + String editedEngineKey) { FragmentManager fm = activity.getSupportFragmentManager(); if (!fm.isStateSaved() && fm.findFragmentByTag(OnlineRoutingEngineFragment.TAG) == null) { OnlineRoutingEngineFragment fragment = new OnlineRoutingEngineFragment(); diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingHelper.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingHelper.java index 8a9e42bd54..54a5467bc1 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingHelper.java @@ -91,7 +91,7 @@ public class OnlineRoutingHelper { JSONObject json = new JSONObject(jsonString); readFromJson(json, engines); } catch (JSONException e) { - LOG.debug("Error when create a new JSONObject: " + e.toString()); + LOG.debug("Error when reading engines from JSON ", e); } } return engines; @@ -99,57 +99,50 @@ public class OnlineRoutingHelper { private void saveToSettings() { if (!Algorithms.isEmpty(cachedEngines)) { - JSONObject json = new JSONObject(); - if (writeToJson(json, cachedEngines)) { + try { + JSONObject json = new JSONObject(); + writeToJson(json, cachedEngines); settings.ONLINE_ROUTING_ENGINES.set(json.toString()); + } catch (JSONException e) { + LOG.debug("Error when writing engines to JSON ", e); } } else { settings.ONLINE_ROUTING_ENGINES.set(null); } } - private static void readFromJson(JSONObject json, List engines) { - try { - if (!json.has("items")) { - return; - } - Gson gson = new Gson(); - Type type = new TypeToken>() { - }.getType(); - JSONArray itemsJson = json.getJSONArray("items"); - for (int i = 0; i < itemsJson.length(); i++) { - JSONObject object = itemsJson.getJSONObject(i); - String key = object.getString("key"); - String vehicleKey = object.getString("vehicle"); - ServerType serverType = ServerType.valueOf(object.getString("serverType")); - String paramsString = object.getString("params"); - HashMap params = gson.fromJson(paramsString, type); - engines.add(new OnlineRoutingEngine(key, serverType, vehicleKey, params)); - } - } catch (JSONException e) { - LOG.debug("Error when reading engines from JSON: " + e.toString()); + public static void readFromJson(JSONObject json, List engines) throws JSONException { + if (!json.has("items")) { + return; + } + Gson gson = new Gson(); + Type type = new TypeToken>() { + }.getType(); + JSONArray itemsJson = json.getJSONArray("items"); + for (int i = 0; i < itemsJson.length(); i++) { + JSONObject object = itemsJson.getJSONObject(i); + String key = object.getString("key"); + String vehicleKey = object.getString("vehicle"); + ServerType serverType = ServerType.valueOf(object.getString("serverType")); + String paramsString = object.getString("params"); + HashMap params = gson.fromJson(paramsString, type); + engines.add(new OnlineRoutingEngine(key, serverType, vehicleKey, params)); } } - private static boolean writeToJson(JSONObject json, List engines) { + public static void writeToJson(JSONObject json, List engines) throws JSONException { JSONArray jsonArray = new JSONArray(); Gson gson = new Gson(); Type type = new TypeToken>() { }.getType(); - try { - for (OnlineRoutingEngine engine : engines) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("key", engine.getStringKey()); - jsonObject.put("serverType", engine.getServerType().name()); - jsonObject.put("vehicle", engine.getVehicleKey()); - jsonObject.put("params", gson.toJson(engine.getParams(), type)); - jsonArray.put(jsonObject); - } - json.put("items", jsonArray); - return true; - } catch (JSONException e) { - LOG.debug("Error when writing engines to JSON: " + e.toString()); - return false; + for (OnlineRoutingEngine engine : engines) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("key", engine.getStringKey()); + jsonObject.put("serverType", engine.getServerType().name()); + jsonObject.put("vehicle", engine.getVehicleKey()); + jsonObject.put("params", gson.toJson(engine.getParams(), type)); + jsonArray.put(jsonObject); } + json.put("items", jsonArray); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java index c3b1e63a75..7ee75c4092 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java @@ -24,7 +24,8 @@ public enum ExportSettingsType { MAP_SOURCES(R.string.quick_action_map_source_title, R.drawable.ic_map), OFFLINE_MAPS(R.string.shared_string_maps, R.drawable.ic_map), TTS_VOICE(R.string.local_indexes_cat_tts, R.drawable.ic_action_volume_up), - VOICE(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up); + VOICE(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up), + ONLINE_ROUTING_ENGINES(R.string.online_routing_engines, R.drawable.ic_world_globe_dark); @StringRes private final int titleId; @@ -59,6 +60,6 @@ public enum ExportSettingsType { public boolean isResourcesCategory() { return this == CUSTOM_RENDER_STYLE || this == CUSTOM_ROUTING || this == MAP_SOURCES - || this == OFFLINE_MAPS || this == VOICE || this == TTS_VOICE; + || this == OFFLINE_MAPS || this == VOICE || this == TTS_VOICE || this == ONLINE_ROUTING_ENGINES; } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index efaaff576b..dfaaea9468 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -48,7 +48,6 @@ import net.osmand.plus.helpers.enums.TracksSortByMode; import net.osmand.plus.mapillary.MapillaryPlugin; import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format; import net.osmand.plus.mapmarkers.MapMarkersMode; -import net.osmand.plus.onlinerouting.OnlineRoutingEngine; import net.osmand.plus.profiles.LocationIcon; import net.osmand.plus.profiles.NavigationIcon; import net.osmand.plus.profiles.ProfileIconColors; @@ -1016,7 +1015,7 @@ public class OsmandSettings { ROUTE_SERVICE.setModeDefaultValue(ApplicationMode.AIRCRAFT, RouteService.STRAIGHT); } - public final CommonPreference ONLINE_ROUTING_ENGINES = new StringPreference(this, "online_routing_engines", null); + public final CommonPreference ONLINE_ROUTING_ENGINES = new StringPreference(this, "online_routing_engines", null).makeGlobal(); public final CommonPreference NAVIGATION_ICON = new EnumStringPreference<>(this, "navigation_icon", NavigationIcon.DEFAULT, NavigationIcon.values()).makeProfile().cache(); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java new file mode 100644 index 0000000000..19f29daafe --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java @@ -0,0 +1,142 @@ +package net.osmand.plus.settings.backend.backup; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.onlinerouting.OnlineRoutingEngine; +import net.osmand.plus.onlinerouting.OnlineRoutingEngine.EngineParameterType; +import net.osmand.plus.onlinerouting.OnlineRoutingHelper; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class OnlineRoutingSettingsItem extends CollectionSettingsItem { + + private OnlineRoutingHelper onlineRoutingHelper; + + public OnlineRoutingSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { + super(app, null, items); + } + + public OnlineRoutingSettingsItem(@NonNull OsmandApplication app, @Nullable OnlineRoutingSettingsItem baseItem, @NonNull List items) { + super(app, baseItem, items); + } + + public OnlineRoutingSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { + super(app, json); + } + + @Override + protected void init() { + super.init(); + onlineRoutingHelper = app.getOnlineRoutingHelper(); + existingItems = new ArrayList<>(onlineRoutingHelper.getEngines()); + } + + @NonNull + @Override + public SettingsItemType getType() { + return SettingsItemType.ONLINE_ROUTING_ENGINES; + } + + @NonNull + @Override + public String getName() { + return "online_routing_engines"; + } + + @NonNull + @Override + public String getPublicName(@NonNull Context ctx) { + return ctx.getString(R.string.online_routing_engine); + } + + @Override + public void apply() { + List newItems = getNewItems(); + if (!newItems.isEmpty() || !duplicateItems.isEmpty()) { + appliedItems = new ArrayList<>(newItems); + + for (OnlineRoutingEngine duplicate : duplicateItems) { + if (shouldReplace) { + onlineRoutingHelper.deleteEngine(duplicate.getStringKey()); + } + appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate)); + } + for (OnlineRoutingEngine engine : appliedItems) { + onlineRoutingHelper.saveEngine(engine); + } + } + } + + @Override + public boolean isDuplicate(@NonNull OnlineRoutingEngine routingEngine) { + for (OnlineRoutingEngine engine : existingItems) { + if (engine.getStringKey().equals(routingEngine.getStringKey()) + || engine.getName(app).equals(routingEngine.getName(app))) { + return true; + } + } + return false; + } + + @Override + public boolean shouldReadOnCollecting() { + return true; + } + + @NonNull + @Override + public OnlineRoutingEngine renameItem(@NonNull OnlineRoutingEngine item) { + int number = 0; + while (true) { + number++; + OnlineRoutingEngine renamedItem = OnlineRoutingEngine.createNewEngine(item.getServerType(), item.getVehicleKey(), item.getParams()); + renamedItem.putParameter(EngineParameterType.CUSTOM_NAME, renamedItem.getName(app) + "_" + number); + if (!isDuplicate(renamedItem)) { + return renamedItem; + } + } + } + + @Override + void readItemsFromJson(@NonNull JSONObject json) throws IllegalArgumentException { + try { + OnlineRoutingHelper.readFromJson(json, items); + } catch (JSONException e) { + warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType()))); + throw new IllegalArgumentException("Json parse error", e); + } + } + + @Override + void writeItemsToJson(@NonNull JSONObject json) { + if (!items.isEmpty()) { + try { + OnlineRoutingHelper.writeToJson(json, items); + } catch (JSONException e) { + warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType()))); + SettingsHelper.LOG.error("Failed write to json", e); + } + } + } + + @Nullable + @Override + SettingsItemReader getReader() { + return getJsonReader(); + } + + @Nullable + @Override + SettingsItemWriter getWriter() { + return getJsonWriter(); + } +} diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java index 69ac3b1a13..afe3a9c9ec 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -33,6 +33,7 @@ import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.onlinerouting.OnlineRoutingEngine; import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.osmedit.OsmNotesPoint; @@ -624,6 +625,10 @@ public class SettingsHelper { resourcesItems.put(ExportSettingsType.CUSTOM_ROUTING, Arrays.asList(fl)); } } + List onlineRoutingEngines = app.getOnlineRoutingHelper().getEngines(); + if (!Algorithms.isEmpty(onlineRoutingEngines)) { + resourcesItems.put(ExportSettingsType.ONLINE_ROUTING_ENGINES, onlineRoutingEngines); + } List iTileSources = new ArrayList<>(); Set tileSourceNames = app.getSettings().getTileSourceEntries(true).keySet(); for (String name : tileSourceNames) { @@ -701,6 +706,7 @@ public class SettingsHelper { List markersGroups = new ArrayList<>(); List markersHistoryGroups = new ArrayList<>(); List historyEntries = new ArrayList<>(); + List onlineRoutingEngines = new ArrayList<>(); for (Object object : data) { if (object instanceof QuickAction) { @@ -741,6 +747,8 @@ public class SettingsHelper { historyEntries.add((HistoryEntry) object); } else if (object instanceof GlobalSettingsItem) { settingsItems.add((GlobalSettingsItem) object); + } else if (object instanceof OnlineRoutingEngine) { + onlineRoutingEngines.add((OnlineRoutingEngine) object); } } if (!quickActions.isEmpty()) { @@ -793,6 +801,9 @@ public class SettingsHelper { if (!historyEntries.isEmpty()) { settingsItems.add(new SearchHistorySettingsItem(app, historyEntries)); } + if (!onlineRoutingEngines.isEmpty()) { + settingsItems.add(new OnlineRoutingSettingsItem(app, onlineRoutingEngines)); + } return settingsItems; } @@ -848,6 +859,7 @@ public class SettingsHelper { List markersGroups = new ArrayList<>(); List markersHistoryGroups = new ArrayList<>(); List historyEntries = new ArrayList<>(); + List onlineRoutingEngines = new ArrayList<>(); for (SettingsItem item : settingsItems) { switch (item.getType()) { @@ -942,6 +954,10 @@ public class SettingsHelper { case GPX: tracksFilesList.add((GpxSettingsItem) item); break; + case ONLINE_ROUTING_ENGINES: + OnlineRoutingSettingsItem onlineRoutingSettingsItem = (OnlineRoutingSettingsItem) item; + onlineRoutingEngines.addAll(onlineRoutingSettingsItem.getItems()); + break; default: break; } @@ -1004,6 +1020,9 @@ public class SettingsHelper { if (!historyEntries.isEmpty()) { settingsToOperate.put(ExportSettingsType.SEARCH_HISTORY, historyEntries); } + if (!onlineRoutingEngines.isEmpty()) { + settingsToOperate.put(ExportSettingsType.ONLINE_ROUTING_ENGINES, onlineRoutingEngines); + } return settingsToOperate; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java index 9af8424ffc..de002efff4 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java @@ -19,5 +19,6 @@ public enum SettingsItemType { FAVOURITES, ACTIVE_MARKERS, HISTORY_MARKERS, - SEARCH_HISTORY + SEARCH_HISTORY, + ONLINE_ROUTING_ENGINES } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java index 39846f1826..47cee4b0fc 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java @@ -146,6 +146,9 @@ class SettingsItemsFactory { case GPX: item = new GpxSettingsItem(app, json); break; + case ONLINE_ROUTING_ENGINES: + item = new OnlineRoutingSettingsItem(app, json); + break; } return item; } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java index fc6982a7a6..575dc74db2 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java @@ -23,6 +23,7 @@ import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; import net.osmand.plus.mapmarkers.MapMarker; +import net.osmand.plus.onlinerouting.OnlineRoutingEngine; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.profiles.ProfileIconColors; import net.osmand.plus.profiles.RoutingProfileDataObject.RoutingProfilesResources; @@ -163,6 +164,9 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter mapMarkers = new ArrayList<>(); List mapMarkersGroups = new ArrayList<>(); List historyEntries = new ArrayList<>(); + List onlineRoutingEngines = new ArrayList<>(); for (Object object : duplicatesList) { if (object instanceof ApplicationMode.ApplicationModeBean) { @@ -250,6 +252,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { } } else if (object instanceof HistoryEntry) { historyEntries.add((HistoryEntry) object); + } else if (object instanceof OnlineRoutingEngine) { + onlineRoutingEngines.add((OnlineRoutingEngine) object); } } if (!profiles.isEmpty()) { @@ -320,6 +324,10 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { duplicates.add(getString(R.string.markers_history)); duplicates.addAll(mapMarkersGroups); } + if (!onlineRoutingEngines.isEmpty()) { + duplicates.add(getString(R.string.online_routing_engines)); + duplicates.addAll(onlineRoutingEngines); + } return duplicates; } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java index 2d7d50046d..970acb24bc 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java @@ -36,6 +36,7 @@ import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.onlinerouting.OnlineRoutingEngine; import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OsmNotesPoint; import net.osmand.plus.poi.PoiUIFilter; @@ -50,6 +51,7 @@ import net.osmand.plus.settings.backend.backup.GpxSettingsItem; import net.osmand.plus.settings.backend.backup.HistoryMarkersSettingsItem; import net.osmand.plus.settings.backend.backup.MapSourcesSettingsItem; import net.osmand.plus.settings.backend.backup.MarkersSettingsItem; +import net.osmand.plus.settings.backend.backup.OnlineRoutingSettingsItem; import net.osmand.plus.settings.backend.backup.OsmEditsSettingsItem; import net.osmand.plus.settings.backend.backup.OsmNotesSettingsItem; import net.osmand.plus.settings.backend.backup.PoiUiFiltersSettingsItem; @@ -347,6 +349,7 @@ public class ImportSettingsFragment extends BaseSettingsListFragment { List markersGroups = new ArrayList<>(); List markersHistoryGroups = new ArrayList<>(); List historyEntries = new ArrayList<>(); + List onlineRoutingEngines = new ArrayList<>(); for (Object object : data) { if (object instanceof ApplicationModeBean) { appModeBeans.add((ApplicationModeBean) object); @@ -384,6 +387,8 @@ public class ImportSettingsFragment extends BaseSettingsListFragment { } } else if (object instanceof HistoryEntry) { historyEntries.add((HistoryEntry) object); + } else if (object instanceof OnlineRoutingEngine) { + onlineRoutingEngines.add((OnlineRoutingEngine) object); } } if (!appModeBeans.isEmpty()) { @@ -435,6 +440,10 @@ public class ImportSettingsFragment extends BaseSettingsListFragment { SearchHistorySettingsItem baseItem = getBaseItem(SettingsItemType.SEARCH_HISTORY, SearchHistorySettingsItem.class); settingsItems.add(new SearchHistorySettingsItem(app, baseItem, historyEntries)); } + if (!onlineRoutingEngines.isEmpty()) { + OnlineRoutingSettingsItem baseItem = getBaseItem(SettingsItemType.ONLINE_ROUTING_ENGINES, OnlineRoutingSettingsItem.class); + settingsItems.add(new OnlineRoutingSettingsItem(app, baseItem, onlineRoutingEngines)); + } return settingsItems; } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java index 94228d4945..b8f8d31d82 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java @@ -16,7 +16,6 @@ import net.osmand.plus.UiUtilities; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.settings.backend.ExportSettingsType; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -33,7 +32,7 @@ public class ImportedSettingsItemsAdapter extends private OnItemClickListener listener; ImportedSettingsItemsAdapter(@NonNull OsmandApplication app, Map> itemsMap, - boolean nightMode, OnItemClickListener listener) { + boolean nightMode, OnItemClickListener listener) { this.app = app; this.itemsMap = itemsMap; this.nightMode = nightMode; @@ -154,6 +153,10 @@ public class ImportedSettingsItemsAdapter extends holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_history, activeColorRes)); holder.title.setText(R.string.shared_string_search_history); break; + case ONLINE_ROUTING_ENGINES: + holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_world_globe_dark, activeColorRes)); + holder.title.setText(R.string.online_routing_engines); + break; } } From d0d95e92cca1ca45d36764e713fd452daf4c1098 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 8 Jan 2021 00:34:09 +0200 Subject: [PATCH 35/37] Fix ImportCompleteFragment and remove duplicated code --- .../backup/AvoidRoadsSettingsItem.java | 5 -- .../backup/CollectionSettingsItem.java | 5 ++ .../backend/backup/FavoritesSettingsItem.java | 5 -- .../backup/HistoryMarkersSettingsItem.java | 5 -- .../backup/MapSourcesSettingsItem.java | 5 -- .../backend/backup/MarkersSettingsItem.java | 5 -- .../backup/OnlineRoutingSettingsItem.java | 5 -- .../backend/backup/OsmEditsSettingsItem.java | 5 -- .../backend/backup/OsmNotesSettingsItem.java | 5 -- .../backup/PoiUiFiltersSettingsItem.java | 5 -- .../backup/QuickActionsSettingsItem.java | 5 -- .../backup/SearchHistorySettingsItem.java | 5 -- .../fragments/ImportCompleteFragment.java | 48 +++++++++++++------ 13 files changed, 38 insertions(+), 70 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java index a65a60b2d7..6f53a11b07 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/AvoidRoadsSettingsItem.java @@ -92,11 +92,6 @@ public class AvoidRoadsSettingsItem extends CollectionSettingsItem extends SettingsItem { return true; } + @Override + public boolean shouldReadOnCollecting() { + return true; + } + public abstract boolean isDuplicate(@NonNull T item); @NonNull diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java index acb96be110..515b9885c7 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java @@ -109,11 +109,6 @@ public class FavoritesSettingsItem extends CollectionSettingsItem return false; } - @Override - public boolean shouldReadOnCollecting() { - return true; - } - @NonNull @Override public FavoriteGroup renameItem(@NonNull FavoriteGroup item) { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java index 9f441b7ec8..ba0c3d7dc0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java @@ -103,11 +103,6 @@ public class HistoryMarkersSettingsItem extends CollectionSettingsItem return "map_sources"; } - @Override - public boolean shouldReadOnCollecting() { - return true; - } - @Override void readItemsFromJson(@NonNull JSONObject json) throws IllegalArgumentException { try { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java index 0698846638..daa6b9b485 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -103,11 +103,6 @@ public class MarkersSettingsItem extends CollectionSettingsItem { return false; } - @Override - public boolean shouldReadOnCollecting() { - return true; - } - @NonNull @Override public MapMarker renameItem(@NonNull MapMarker item) { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java index 19f29daafe..e5ae306cf0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OnlineRoutingSettingsItem.java @@ -87,11 +87,6 @@ public class OnlineRoutingSettingsItem extends CollectionSettingsItem return ctx.getString(R.string.osm_notes); } - @Override - public boolean shouldReadOnCollecting() { - return true; - } - @Override public boolean shouldShowDuplicates() { return false; diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java index 29e20679d9..16be1f26bc 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/PoiUiFiltersSettingsItem.java @@ -105,11 +105,6 @@ public class PoiUiFiltersSettingsItem extends CollectionSettingsItem Date: Fri, 8 Jan 2021 11:12:01 +0300 Subject: [PATCH 36/37] Fix travel search crash --- .../src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 55c5e6ee32..45a8442614 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -83,7 +83,7 @@ public class TravelObfHelper implements TravelHelper { } @NonNull - public List loadPopularArticles() { + public synchronized List loadPopularArticles() { String lang = app.getLanguage(); List popularArticles = new ArrayList<>(); for (BinaryMapIndexReader reader : getReaders()) { @@ -190,7 +190,7 @@ public class TravelObfHelper implements TravelHelper { @NonNull @Override - public List search(@NonNull String searchQuery) { + public synchronized List search(@NonNull String searchQuery) { List res = new ArrayList<>(); Map> amenityMap = new HashMap<>(); final String appLang = app.getLanguage(); From b1f29754f343ddb1764388ed60b3167f760b13a8 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 8 Jan 2021 13:43:46 +0200 Subject: [PATCH 37/37] Added image for announcement time dialog --- .../img_help_announcement_time_day.xml | 91 +++++++++++++++++++ .../img_help_announcement_time_night.xml | 91 +++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 OsmAnd/res/drawable/img_help_announcement_time_day.xml create mode 100644 OsmAnd/res/drawable/img_help_announcement_time_night.xml diff --git a/OsmAnd/res/drawable/img_help_announcement_time_day.xml b/OsmAnd/res/drawable/img_help_announcement_time_day.xml new file mode 100644 index 0000000000..e6bca9e5a1 --- /dev/null +++ b/OsmAnd/res/drawable/img_help_announcement_time_day.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OsmAnd/res/drawable/img_help_announcement_time_night.xml b/OsmAnd/res/drawable/img_help_announcement_time_night.xml new file mode 100644 index 0000000000..5a4ad0251e --- /dev/null +++ b/OsmAnd/res/drawable/img_help_announcement_time_night.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +