diff --git a/.github/ISSUE_TEMPLATE/2-faq-report.md b/.github/ISSUE_TEMPLATE/2-faq-report.md index fbc18c4381..531d263d7f 100644 --- a/.github/ISSUE_TEMPLATE/2-faq-report.md +++ b/.github/ISSUE_TEMPLATE/2-faq-report.md @@ -1,8 +1,8 @@ --- name: "📚 Outdated FAQ" about: Report an issue in FAQ - --- + 🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑 Please do not file FAQ issues on the GitHub issues tracker. diff --git a/.github/ISSUE_TEMPLATE/3-bug-report.md b/.github/ISSUE_TEMPLATE/3-bug-report.md index d12ea14578..ecf870be10 100644 --- a/.github/ISSUE_TEMPLATE/3-bug-report.md +++ b/.github/ISSUE_TEMPLATE/3-bug-report.md @@ -2,6 +2,7 @@ name: "\U0001F41E Bug report" about: Report a bug in OsmAnd --- + Yes, the previous version in which this bug was not present was: .... - ### Description - A clear and concise description of the problem... - + ## 🔬 Minimal Reproduction + 1. Open app, and click on ... ## 🔥 Exception or Error +
-
-## 🌍 Your Environment
+## 🌍 Your Environment
**OsmAnd Version:**
+
@@ -60,10 +61,11 @@ If the bug is reproducible, please describe steps below:
**Device and Android/iOS version:**
**Maps used (online or offline):**
+
-- [ ] Offline maps offered within the OsmAnd app for download.
-
+
+- [ ] Offline maps offered within the OsmAnd app for download.
+
- [ ] Online (tile / raster) maps
-
**Anything else relevant?**
diff --git a/.github/ISSUE_TEMPLATE/4-routing-report.md b/.github/ISSUE_TEMPLATE/4-routing-report.md
index 4c1e68c11a..216cd4b402 100644
--- a/.github/ISSUE_TEMPLATE/4-routing-report.md
+++ b/.github/ISSUE_TEMPLATE/4-routing-report.md
@@ -2,6 +2,7 @@
name: "\U0001F6A9 Routing report"
about: Report a routing issue in OsmAnd
---
+
+
- [ ] OsmAnd's in-app offline routing
- [ ] Any online routing provider (YOURS, OpenRouteService, OSRM, etc.)
### Routing Profile
+
### Start and end points
@@ -38,6 +41,7 @@ Please give us the following information so that we can try to **reproduce** you
Also, a permalink from [openstreetmap.org](https://www.openstreetmap.org/) can be helpful. -->
### Actual and expected routes
+
### Is this a regression?
@@ -45,9 +49,10 @@ Also, a permalink from [openstreetmap.org](https://www.openstreetmap.org/) can b
Yes, the previous version in which this bug was not present was: ....
-## 🌍 Your Environment
+## 🌍 Your Environment
**OsmAnd Version:**
+
@@ -57,10 +62,11 @@ Also, a permalink from [openstreetmap.org](https://www.openstreetmap.org/) can b
**Device and Android/iOS version:**
**Maps used (online or offline):**
+
-- [ ] Offline maps offered within the OsmAnd app for download.
-
+
+- [ ] Offline maps offered within the OsmAnd app for download.
+
- [ ] Online (tile / raster) maps
-
**Anything else relevant?**
diff --git a/.github/ISSUE_TEMPLATE/5-feature-request.md b/.github/ISSUE_TEMPLATE/5-feature-request.md
index 046fb3a90f..9c46069f8c 100644
--- a/.github/ISSUE_TEMPLATE/5-feature-request.md
+++ b/.github/ISSUE_TEMPLATE/5-feature-request.md
@@ -1,11 +1,11 @@
---
name: "\U0001F680 Feature request"
about: Suggest a feature for OsmAnd
-
---
+
A clear and concise description of the problem or missing capability...
+
### Describe the solution you'd like
+
If you have a solution in mind, please describe it.
-
### Describe alternatives you've considered
+
Have you considered any alternative solutions or workarounds?
diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java
index 21e7fbd58c..ea2869aaa3 100644
--- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java
+++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java
@@ -119,7 +119,7 @@ public class Algorithms {
}
public static String getFileNameWithoutExtension(String name) {
- int i = name.indexOf('.');
+ int i = name.lastIndexOf('.');
if (i >= 0) {
name = name.substring(0, i);
}
diff --git a/OsmAnd-telegram/res/values-ru/strings.xml b/OsmAnd-telegram/res/values-ru/strings.xml
index b76aa52417..daff0e950b 100644
--- a/OsmAnd-telegram/res/values-ru/strings.xml
+++ b/OsmAnd-telegram/res/values-ru/strings.xml
@@ -63,7 +63,7 @@
У меня нет учетной записи Telegram
Введите номер телефона
Введите код аутентификации
- Сохранить
+ Добавить
Назовите новое устройство макс. 200 символов.
Расстояние
Моя локация
diff --git a/OsmAnd/res/layout/track_coloring_card.xml b/OsmAnd/res/layout/track_coloring_card.xml
index 5775a98c7d..2c7721f61d 100644
--- a/OsmAnd/res/layout/track_coloring_card.xml
+++ b/OsmAnd/res/layout/track_coloring_card.xml
@@ -21,6 +21,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
+ android:visibility="gone"
android:paddingBottom="@dimen/content_padding">
Amaɣnu n tunigin
Fren afaylu n uḍfar iɣer ara yernu uḥric amaynut.
Tebɣiḍ s tidet ad tmedleḍ abrid n uɣawas war asekles\? Ad tesruḥeḍ akk ibeddilen.
+ Ittwasekles
\ No newline at end of file
diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml
index b6944c01bf..4ae94a57c7 100644
--- a/OsmAnd/res/values-ca/strings.xml
+++ b/OsmAnd/res/values-ca/strings.xml
@@ -3812,4 +3812,7 @@ Abasta l\'àrea: %1$s x %2$s
REC
Aturarà l\'enregistrament de traces quan es mati l\'aplicació (mitjançant aplicacions recents). (La indicació de fons OsmAnd desapareix de la barra de notificacions d\'Android.)
Trieu l\'interval d\'enregistrament general dels desplaçaments (s\'activa mitjançant el giny de gravació del mapa).
+ Traça simplificada
+ Només es desarà la línia del trajecte, les fites s\'esborraran.
+ %s arxius de traces seleccionats
\ No newline at end of file
diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml
index 16672becc8..730f97c489 100644
--- a/OsmAnd/res/values-de/strings.xml
+++ b/OsmAnd/res/values-de/strings.xml
@@ -2785,7 +2785,7 @@
Als Track speichern
Sie haben %1$s Punkte hinzugefügt. Geben Sie einen Dateinamen ein und klicken Sie auf „Speichern“.
Punkt %1$s gelöscht
- Ihre Suchanfrage wird an: \"%1 s\" gesendet, zusammen mit Ihrem Standort.
+ Ihre Suchanfrage wird an: \"%1$s\" gesendet, zusammen mit Ihrem Standort.
\n
\nPersönliche Informationen werden nicht gesammelt, sondern nur Suchdaten, die zur Verbesserung der Suche benötigt werden.
Keine Ergebnisse?
diff --git a/OsmAnd/res/values-eo/phrases.xml b/OsmAnd/res/values-eo/phrases.xml
index 41115a7aed..cc31985829 100644
--- a/OsmAnd/res/values-eo/phrases.xml
+++ b/OsmAnd/res/values-eo/phrases.xml
@@ -2335,7 +2335,7 @@
Akvokrano
Butonprema: jes
Butonprema: ne
- Bicikla mem-riparejo;memriparejo bicikla;riparejo bicikla;pumpilo bicikla;aerpumpilo bicikla
+ Bicikla memriparejo;memriparejo bicikla;riparejo bicikla;pumpilo bicikla;aerpumpilo bicikla
Aersportoj
elteriĝejo
surteriĝejo
diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml
index 80fdecc6df..b8c7fbfd34 100644
--- a/OsmAnd/res/values-et/strings.xml
+++ b/OsmAnd/res/values-et/strings.xml
@@ -2673,7 +2673,7 @@
Laiuspiirang
Määra teedel lubatud sõiduki laius.
Simuleeri oma asukohta kasutades salvestatud GPX rada.
- Nupp ekraani keskkoha lähtekohaks muutmiseks ja sihtkohta teekonna arvutamiseks või sihtkoha valimise dialoogi avamiseks kui sihtkoha marker puudub kaardil.
+ Nupp ekraani keskkoha lähtekohaks muutmiseks. Seejärel on kas võimalik valida sihtkohta või alustada teekonna arvutamist.
See lisa aktiveerib radade salvestamise funktsionaalsuse, puudutades käsitsi kaardil GPX logimisvidinat või logides automaatselt kõik oma navigeerimise marsruudid GPX faili.
\n
\nSalvestatud radu saab jagada oma sõpradega või kasutada OSM kaastöödeks. Sportlased saavad kasutada salvestatud radu oma treeningute jälgimiseks. Mõningast raja põhianalüüsi saab teha otse OsmAnd sees, näiteks ringiajad, keskmine kiirus jne. Lisaks muidugi saab radu hiljem analüüsia ka spetsiaalsetete 3. osapoolte analüüsitööriistadega.
@@ -2706,7 +2706,7 @@
Võimaldab registreerida oma auto parkimiskoha ja jälgida järelejäänud parkimisaega.
\nNii asukoht kui aeg on nähtavad nii OsmAnd armatuurlaual kui kaardi vidinas. Meeldetuletust saab lisada Androidi kalendrisse.
Muuda kauguse mõõtmise ühikuid.
- See lisa annab kaardi vidina, mis võimaldab teekondade loomist kaarti koputades või olemasolevaid GPX-faile kasutades, et reise kavandada ja punktide vahelist kaugust mõõta. Tulemusi saab salvestada GPX-failina, mida saab hiljem juhendamiseks kasutada.
+ Selleks, et reise kavandada ja punktide vahelist kaugust mõõta, loo teekondi kaardil koputades või olemasolevaid GPX-faile kasutades, Tulemusi saad salvestada GPX-failina, mida on hiljem võimalik juhendamiseks kasutada.
See lisa teeb seadme erivajadusega kasutajatele mõeldud funktsioonid otse OsmAndis kättesaadavaks. See lihtsustab nt. kõnesünteesi häälte kõnekiiruse reguleerimist, ekraanil navigeerimise suuna seadistamist, rulliku kasutamist suurenduse juhtimiseks või kõnesünteesi tagasisidet, näiteks oma asukoha automaatseks teatamiseks.
See lisa võimaldab OsmAnd abil OSM kaastöid teha, näiteks OSM huvipunkte luua või muuta, OSM märkmeid avada või kommenteerida ning salvestatud GPX faile lisada. OSM on kogukonna juhitud globaalne üldkasutatav kaardistamisprojekt. Üksikasju leiad https://openstreetmap.org. Aktiivset osalemist hinnatakse ja panust saab teha otse OsmAnd rakendusest, kui seadistada rakenduses oma isiklikud OSM kasutajatunnused.
See lisa kuvab arendus- ja silumisfunktsioonide sätteid nagu teekonna arvutamine, renderdamise jõudlus või hääljuhiste testimine ja simuleerimine. Need seaded on mõeldud arendajatele ja pole tavakasutaja jaoks vajalikud.
@@ -3495,7 +3495,7 @@
Aragoni
Lombardi
Kohandatud värv
- Jätkamiseks pead valima tööpäevad
+ Jätkamiseks vali tööpäevad
Teekond punktide vahel
Kavanda teekonda
Lisa rajale
@@ -3552,8 +3552,8 @@
Nupp, mis näitab või peidab kaardil Mapillary kihti.
Eemalda ja taaskäivita
Rulluisud
- Kustuta järgmine sihtpunkt
- Sisselülitades saad seadme helitugevuse nuppudega kontrollida kaardi suumi taset.
+ Kustuta lähim sihtpunkt
+ Nutiseadme helitugevuse nuppudega kontrollida saad kaardi suumi taset.
Helitugevuse nupud toimivad suumina
Palun sisestage punkti nimi
Lae alla Vikipeedia kaardid
@@ -3582,7 +3582,7 @@
Pikkuse piirang
Kurss
%1$s on kustutatud
- Selleks, et eemaldada kõik kiiruskaamerate andmed on vajalik seadme taaskäivitamine.
+ Kiiruskaamerate kõikide andmete eemaldamiseks on vajalik nutiseadme taaskäivitamine.
Siin seadmes puudub teave liikluskaamerate kohta.
Lisa profiil
Muuda rakenduse profiili
@@ -3682,7 +3682,7 @@
Salvesta rada failina
Jälgi rada
Vali rajafail, mida soovid kasutada
- Vali rajafail, mida soovid kasutada või impordi see.
+ Vali rajafail, mida soovid kasutada või impordi see oma nutiseadmest.
Vali muu rada
Navigeeri minu asukohast rajale
Asukoht rajal, kuhu me liigume
@@ -3729,4 +3729,13 @@
Kinnita teede külge
Selle valiku kasutamiseks mõne oma navigeerimisprofiili kasutamisel kinnita oma rada lähimale lubatud teele.
Valitud profiili alusel arvutatakse uus teekond vaid järgmise segmendi osas.
+ Põhitegevused
+ Ostu kinnitusel võetakse sinu Google Play kontolt tasu.
+\n
+\nTellimus uuendatakse automaatselt, kui sa seda enne uuendamise kuupäeva ei tühista. Sonu kontolt võetakse pikendamisperioodi eest (kuu/kolm kuud/aasta) tasu ainult uuendamise kuupäeval.
+\n
+\nTellimuste haldamiseks ja tühistamiseks ava Google Play seadistused.
+ Kiirtegevusi saad eksportida või importida koos rakenduse profiilidega.
+ Kas sa oled kindel, et soovid pöördumatult kustutada %d kiirtegevust\?
+ Vali kas soovid ühendada punkte sirge joonega või arvutada nendevahelist teekonda vastavalt oma valitud profiilile.
\ No newline at end of file
diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml
index 14fd623bee..4cc7cc83c8 100644
--- a/OsmAnd/res/values-fa/strings.xml
+++ b/OsmAnd/res/values-fa/strings.xml
@@ -3843,4 +3843,23 @@
یک فایل رد انتخاب کنید تا باز شود.
تمام
بَرنویسی رد
+ آهنگ ذخیره شده را باز کنید
+ ذخیره شده
+ لطفا حداقل دو امتیاز اضافه کنید.
+ آماده
+ "به روز شده برنامه یک عملکرد مسیر: اجازه می دهد تا از انواع مختلف پیمایش در هر بخش و گنجاندن مسیرها استفاده کنید
+\n
+\n • منوی New Appearance برای آهنگ ها، رنگ ، ضخامت ، فلش جهت نمایش ، نمادهای شروع / پایان استفاده می شوئ
+\n
+\n • بهبود دید نود های دوچرخه.
+\n
+\n • آهنگ ها اکنون قابل لمس هستند ، دارای منوی زمینه با اطلاعات اولیه هستند.
+\n
+\n • بهبود الگوریتم های جستجو
+\n
+\n • گزینه های ردیابی را در پیمایش بهبود بخشید
+\n
+\n • مشکلات مربوط به واردات / صادرات تنظیمات نمایه برطرف شده است
+\n
+\n"
\ No newline at end of file
diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml
index 283c4ba01c..9b411b0d7f 100644
--- a/OsmAnd/res/values-gl/strings.xml
+++ b/OsmAnd/res/values-gl/strings.xml
@@ -3839,4 +3839,17 @@ Lon %2$s
Personalizado
Frechas de dirección
Sólido
+ Deter a gravación da viaxe
+ Retomar a gravación da viaxe
+ Predefinido do sistema
+ Todos os segmentos seguintes
+ Segmento anterior
+ Todos os segmentos anteriores
+ Só o segmento marcado será recalculado empregando o perfil escollido.
+ Todos os segmentos seguintes serán recalculados empregando o perfil escollido.
+ Todos os segmentos anteriores serán recalculados empregando o perfil escollido.
+ Abrir pista gardada
+ está gardado
+ Engade polo menos dous puntos.
+ Refacer
\ No newline at end of file
diff --git a/OsmAnd/res/values-hu/phrases.xml b/OsmAnd/res/values-hu/phrases.xml
index d5738abcb9..891959e0b0 100644
--- a/OsmAnd/res/values-hu/phrases.xml
+++ b/OsmAnd/res/values-hu/phrases.xml
@@ -1863,7 +1863,7 @@
Cserkésztáborhely
Nomád
Típus
- Autós
+ Autós (drive-in)
Szolgáltatás
Típus
Elfogadott hulladék
@@ -3050,7 +3050,7 @@
Dagadóláp (palsa-láp)
Avgas 100LL repülőbenzin
Jet A-1 kerozin
- AdBlue adalékanyag
+ Diesel kipufogó-folyadék
Szolgáltatóközpont hátrányos helyzetűeknek
Erődítmény típusa: földsánc
Erődítmény típusa: újkőkori körárok
@@ -3808,7 +3808,7 @@
Cső
Ivóvíz-utántöltő hálózat
Ivóvíz-utántöltés nincs
- Ivóvíz-utántöltés
+ van
Vízszint: közepes vízszint alatt
Vízszint: közepes vízszint fölött
Vízszint: lebegő
@@ -3821,4 +3821,16 @@
Félrevezető
Véletlenül használható más elemek
Kontrasztos színű
+ Menetrend
+ Valós idejű
+ Késés
+ van
+ Indulásiidő-kijelző nincs
+ Lift
+ Nyíl nincs
+ Szivattyú állapota: hiányzik a kar
+ Szívás
+ Kis elektronikus készülékek
+ Indulásiidő-kijelző
+ Ivóvíz-utántöltés
\ No newline at end of file
diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml
index 0be4073d8b..bf5f700fa4 100644
--- a/OsmAnd/res/values-hu/strings.xml
+++ b/OsmAnd/res/values-hu/strings.xml
@@ -134,11 +134,11 @@
Térképforrás beállítások
Vektoros térkép beállítások
Biztosan törli: %1$s\?
- településrész
- falucska
- község
- város
- város
+ Településrész
+ Falucska
+ Község
+ Kisváros
+ Város
Szimuláció leállítása
Szimuláció indítása
Nem sikerült átnevezni a fájlt.
@@ -350,7 +350,7 @@
Megjelenítési stílus kiválasztása
POI weboldal megtekintése
POI telefonszám megtekintése
- weboldal
+ Weboldal
telefon
szűrés
Nagy felbontású kijelző
@@ -901,7 +901,7 @@
Lejátszás
Felvétel
Indítás
- hang/videojegyzetek
+ Hang/videojegyzetek
OsmAnd-bővítmény offline szintvonalakhoz
Távolságmérés
Készítsen hang/fénykép/videó jegyzeteket utazás közben egy térképen lévő gomb vagy egy pozíció helyi menüjének használatával.
@@ -1727,7 +1727,7 @@
Telepítés és hibaelhárítás
Technikai cikkek
Verziók
- szavazás
+ Visszajelzés
Kapcsolat
Bővebben
Újdonságok
@@ -2493,9 +2493,9 @@
A csoport összes pontja
Nyitva ekkortól:
Nyitva eddig:
- Ekkor fog bezárni:
- Ekkor fog kinyitni:
- Ekkor fog kinyitni:
+ Bezár ekkor:
+ Kinyit ekkor:
+ Kinyit ekkor:
További műveletek
GPX fájl a kijelölt jegyzetek koordinátáival és adataival.
GPX fájl az összes jegyzet koordinátáival és adataival.
@@ -2747,8 +2747,8 @@
Köztes célpont hozzáadása
Kiindulópont megadása
Köztes célpont
- átszállások
- gyalog
+ Átszállások
+ Gyalog
Út
Érdekes helyek (POI)
Útvonal tervezése…
@@ -3314,7 +3314,7 @@
Profilok listájának szerkesztése
Kiválasztott profil
A létrehozandó egyedi profil az alkalmazás egyik alapprofilján fog alapulni, ez határozza meg az alapvető beállításokat, mint például a widgetek láthatóságát vagy a sebesség és távolság mértékegységeit. Ezek az alapprofilok, néhány pédával az egyedi profilokra, amikre kiterjeszthetők:
- Szerezze meg %1$d %2$s %3$s kedvezménnyel
+ Szerezze meg %1$d %2$s %3$s kedvezménnyel.
%1$s az első %2$s
%1$s az első %2$s
utána %1$s
@@ -3702,7 +3702,7 @@
Bizonyos országokban a traffipax riasztások törvényileg tiltottak.
Tájolás
%1$s törölve
- A traffipax adatok végleges eltávolításához újraindítás szükséges.
+ A traffipaxadatok végleges törléséhez indítsa újra az alkalmazást.
Eltávolítás és Újraindítás
Adja meg az útvonalakon a járművekre vonatkozó hosszkorlátozást.
Hosszkorlátozás
@@ -3728,12 +3728,12 @@
Legkisebb pontosság
Legkisebb elmozdulás
Bővítménybeállítások visszaállítása alapértelmezettre
- Engedélyezésével a térkép nagyítási szintje az eszköz hangerőgombjaival állítható.
+ A térképnagyítás szintjének vezérlése a készülék hangerőgombjaival.
Hangerőgombok használata nagyításhoz
Görkorcsolya
Kérem, adjon nevet a pontnak
Adja meg a járműve hosszát (a hosszú járművekre útvonalkorlátozások vonatkozhatnak).
- Következő célpont törlése
+ Legközelebbi célpont törlése
Wikipédia térképek letöltése
További adatokat is kijelölhet exportálásra a profillal együtt.
Kiegészítő adatok átvétele
@@ -3745,14 +3745,14 @@
\n
\nAz előfizetéseit a Google Play beállításainál tudja kezelni és lemondani.
Törli az útvonal soron következő célpontját. Amennyiben ez a végző célpont, a navigáció megáll.
- Szerezzen információt az érdekes helyekkel kapcsolatban a Wikipédiáról. Ez az ön offline zseb útikönyve - egyszerűen engedélyezze a Wikipédia bővítményt és élvezze az ön körül lévő objektumokról szóló cikkeket.
+ Tudjon meg többet az érdekes pontokról a Wikipédiából. Ez az Ön offline zsebútikönyve – egyszerűen kapcsolja be a Wikipédia-bővítményt, és élvezze az Ön körüli objektumokról szóló cikkeket.
Salakmotor
Robogó
Kerekesszék
Gokart
Lezárt OSM-jegyzet
Előre döntött kerekesszék
- A folytatáshoz adja meg a munkanapokat
+ A folytatáshoz állítsa be a munkanapokat
Útvonal pontok között
Útvonaltervezés
Hozzáadás nyomvonalhoz
@@ -3826,7 +3826,7 @@
Mentés nyomvonalfájlként
Másik nyomvonal kiválasztása
Elmentett nyomvonal megnyitása
- Válassza ki a követni kívánt nyomvonalfájlt, vagy importáljon egyet.
+ Válassza ki a követni kívánt nyomvonalfájlt, vagy importáljon egyet a készülékéről.
Irányt mutató nyilak
Javaslat: Az 5 méteres beállítás megfelelő lehet, ha nem szükséges ennél finomabb részleteket rögzítenie, és nyugalmi állapotban sem akar kifejezetten adatokat rögzíteni.
Következő szakasz
@@ -3848,9 +3848,7 @@
Tömör
Adja meg a címet
Csak a következő szakasz lesz újraszámítva a kiválasztott profilnak megfelelően.
- Ennek a beállításnak a használatához az OsmAndnak hozzá kell tördelnie a nyomvonalát a térképen található utakhoz.
-\n
-\n A következő lépésben ki kell választania a navigációs profilt az engedélyezett utak és a küszöbtávolság észleléséhez, hogy a nyomvonalát közelíteni lehessen az utakhoz.
+ Ezután a beállítás használatához igazítsa a nyomvonalat a legközelebbi úthoz az egyik navigációs profil segítségével.
Egyedi
Utazás rögzítésének szüneteltetése
Mentés új nyomvonalfájlként
@@ -3861,7 +3859,7 @@
Navigációs profil
Megjegyzés a „sebesség > 0” ellenőrzéséhez: A legtöbb GPS lapkakészlet (chipset) csak akkor mutat sebességértéket, ha az algoritmus megállapítja, hogy mozgásban van. Ha nincs mozgás, akkor nem mutatnak sebességet. Ezért ebben a szűrőben a „> 0” beállítás bizonyos értelemben a GPS lapkakészlet mozgásérzékelését használja. De – még ha a rögzítés ideje alatt itt nem is szűrjük – a GPX elemzése során mégis használjuk ezt a funkciót a korrigált távolság meghatározásához, vagyis az abban a mezőben megjelenített érték a mozgás közben rögzített távolság.
Csak a kijelölt szakasz lesz újraszámítva a kiválasztott profilnak megfelelően.
- Biztos, hogy mentés nélkül bezárja az útvonaltervezőt\? Minden változást elveszít.
+ Biztos, hogy mentés nélkül bezárja az útvonaltervezőt\? Minden változást elvész.
Válassza ki a követendő nyomvonalfájlt
A felsorolt %1$s már létezik az OsmAndban.
Minden korábbi szakasz
@@ -3880,4 +3878,19 @@
Jelölje ki azt a nyomvonalfájlt, amelyhez az új szakasz hozzáadódjék.
Nyomvonalak
Mégis
+ • A Tervezett útvonal mód frissítésével különböző navigációtípusok is használathatók az egyes szakaszokhoz, és bármilyen nyomvonal az utakhoz köthető
+\n
+\n • Új megjelenési lehetőségek a nyomvonalakhoz: válassza ki a színt, a vastagságot, kapcsolja be az iránynyilakat és a kezdő / befejező jeleket
+\n
+\n • A kerékpáros csomópontok jobb láthatósága
+\n
+\n • Helyi menü a nyomvonalak az alapvető adataival
+\n
+\n • Továbbfejlesztett keresési algoritmusok
+\n
+\n • Javított nyomvonalkövetési beállítások a Navigációban
+\n
+\n • Javítva a profilbeállítások importálásával / exportálásával kapcsolatos problémák
+\n
+\n
\ No newline at end of file
diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml
index 4e8391bc49..843dada170 100644
--- a/OsmAnd/res/values-ja/strings.xml
+++ b/OsmAnd/res/values-ja/strings.xml
@@ -3863,4 +3863,31 @@ POIの更新は利用できません
次年度以降 %1$s
初%2$s度 %1$s
初%2$s度 %1$s
+ ルート記録を一時停止
+ ルート記録を続行
+ システムのデフォルト
+ 以後のすべてのセグメントは、選択したプロファイルを使用して再計算されます。
+ 以後のすべてのセグメント
+ 前のセグメント
+ 以前のすべてのセグメント
+ 選択したセグメントのみ、選択したプロファイルを使用して再計算されます。
+ 以前のセグメントは、選択したプロファイルを使用して再計算されます。
+ 保存した経路を開く
+ 少なくとも2つの地点を追加してください。
+ 繰り返し
+ • アップデートで追加されたルート計画モードは、セグメントごとに異なるナビゲーションタイプを使用でき、おおまかな指定を実際の道路に沿って反映可能に。
+\n
+\n• 経路の新しい外観オプション : 色、厚さを選択し、方向矢印のオン、マークの開始/終了など
+\n
+\n• 自転車ノードの可視性の向上
+\n
+\n• 基本情報を含む経路のコンテキストメニュー追加
+\n
+\n• 検索アルゴリズムの改善
+\n
+\n• ナビゲーションの追跡オプションの改善
+\n
+\n• プロファイル設定のインポート/エクスポートに関する問題を修正
+\n
+\n
\ No newline at end of file
diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index 8252ed2138..61a1b00868 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -145,9 +145,9 @@
Фактор рельефа местности (по данным SRTM, ASTER и EU-DEM).
Действие переименовано в %1$s, чтобы избежать дублирования.
Обнаружен дубликат имени
- Переключатель, чтобы показать или скрыть сохранённые точки на карте.
+ Переключатель, чтобы показать или скрыть избранные точки на карте.
Переключатель, чтобы показать или скрыть POI на карте.
- Показать/скрыть Мои места
+ Показать/скрыть избранные
Добавить категорию
Действия
Если оставить это поле пустым, то оно будет автоматически заполнено адресом или названием места.
@@ -462,7 +462,7 @@
Определение положения…
Моё местоположение (найдено)
Адрес…
- Сохранённые…
+ Избранные…
Неопределённо
Текущий центр карты
Начало:
@@ -475,7 +475,7 @@
Отправить в OSM
Детализированная карта
Показывать детали (дороги и др.), начиная с мелких масштабов.
- Сохранённые места удалены.
+ Избранные точки удалены.
Вы уверены, что хотите удалить %1$d избранных и %2$d избранных групп\?
Дом
Друзья
@@ -610,7 +610,7 @@
\nНавигация временно переключена на онлайн-сервис CloudMade.
Невозможно найти указанную папку.
Папка хранилища данных
- У вас установлена предыдущая версия OsmAnd. Все локальные данные поддерживаются новой версией. Однако сохранённые точки нужно вручную экспортировать из старой версии и импортировать в новую.
+ У вас установлена предыдущая версия OsmAnd. Все локальные данные поддерживаются новой версией. Однако избранные точки нужно выгрузить из предыдущей версии приложения и загрузить в новую.
Сборка {0} успешно установлена ({1}).
Загружается сборка…
Установить OsmAnd — {0} из {1} {2} МБ\?
@@ -675,7 +675,7 @@
Выравнивание карты:
Ориентация карты
Детали маршрута
- Сохранённые успешно импортированы
+ Избранные точки успешно импортированы
GPX-файл с сохранёнными точками отсутствует в {0}
Точки сохранены в {0}
Нет избранных точек для сохранения
@@ -796,7 +796,7 @@
Загружается список доступных регионов…
Не удалось получить список регионов с https://osmand.net.
Отредактирована избранная точка
- Нет сохранённых точек
+ Избранные точки отсутствуют
Заменить
Только показать
Запуск сопровождения
@@ -906,11 +906,11 @@
Отмена
Нет
Название точки
- Сохранённая
- Точка «{0}» сохранена.
+ Избранная
+ Точка «{0}» была успешно добавлена к избранным.
Редактировать место
Удалить из моих
- Удалить точку «%s» из сохранённых\?
+ Удалить точку «%s» из избранных\?
Точка {0} удалена.
Комментарий добавлен
Не удалось добавить комментарий.
@@ -1460,7 +1460,7 @@
Мировые пункты обмена bitcoin
дней
Соединение
- Сохранить данные в файл GPX или импортировать путевые точки в Мои места\?
+ Сохранить данные как трек файл или импортировать путевые точки в избранные\?
Розовый
Коричневый
Пустой файл GPX
@@ -1701,7 +1701,7 @@
Переименовать
Удалить
Удалить все
- Сохранить
+ Добавить
Применить
Старт
Стоп
@@ -1722,7 +1722,7 @@
Показывать на карте
Карта
Сохранено
- Сохранённые
+ Избранные
Добавить к избранным
Аудио
Видео
@@ -1958,7 +1958,7 @@
Опасность
Регионы
Карты мира
- Добавить в избранное
+ Добавить в избранные
Региональные карты
Задайте название, которое ещё не используется.
Название категории
@@ -2207,7 +2207,7 @@
Очистить всю плитку
Снижать расход топлива
Использование топливо-сберегающего пути (обычно короче).
- Вы уверены, что хотите заменить %1$s\?
+ Вы уверены, что хотите заменить избранные %1$s\?
Изменить
Начать
от
@@ -2264,11 +2264,11 @@
Добавить место парковки
Добавить действие
Редактировать действие
- Добавить в избранное
+ Добавить в избранные
Добавить действие
Удалить действие
Вы уверены, что хотите удалить действие «%s»\?
- Показать сохранённые
+ Показать избранные
Скрыть сохранённые
Показать/скрыть POI
Показать %1$s
@@ -2357,7 +2357,7 @@
Сохранить точки, как точки маршрута или как линию.
Выберите профиль навигации
%1$d из %2$d
- Списком
+ Список
Группы
Использовано: %1$s
Сделать активным
@@ -2476,7 +2476,7 @@
Налево
Показать цифровую панель
Нажатие на карте переключает кнопки управления и виджеты.
- возможет импорт в сохранённые точки или как файл GPX.
+ возможен импорт в избранные точки или как трек файл.
Больше
Импортировать как файл GPX
Импортировать в Мои места
@@ -2583,7 +2583,7 @@
Сохранить точку маршрута
Путевая точка 1
Точка маршрута 1
- Добавить сохранённые
+ Добавить избранные
Избранное можно импортировать или создать, отмечая точки на карте.
Импортировать файл GPX
Переместить точку
@@ -2703,7 +2703,7 @@
С
Необязательное имя точки
Спортивные сплавы
- По удалённости (сначала дальние)
+ Сначала дальние
Удалённость (сначала ближние)
Группа удалена
Очистить все промежуточные точки
@@ -3346,7 +3346,7 @@
Положение значка в состоянии покоя
После нажатия кнопки «Применить» удалённые профили будут полностью потеряны.
Базовый профиль
- Цвет
+ Выберите цвет
Вы не можете удалить стандартные профили OsmAnd, но вы можете отключить их на предыдущем экране или переместить вниз.
Редактировать профили
«Тип навигации» определяет способ расчета маршрутов.
@@ -3833,8 +3833,8 @@
\nНа следующем шаге необходимо выбрать профиль навигации для определения разрешенных дорог и пороговое расстояние, чтобы приблизительно привязать маршрут к дорогам.
Выберите способ соединения точек: прямой линией или прокладкой маршрута с выбранным профилем.
При обратном направлении
- Вы уверены, что хотите отменить все изменения в запланированном маршруте, закрыв его\?
- Изображения на уровне улиц
+ Все изменения будут утеряны. Закрыть план маршрута\?
+ Съёмка уличного уровня
Сохранить как новый файл трека
Добавить в файл трека
Треки
diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml
index 249e2bfb70..6bed71474e 100644
--- a/OsmAnd/res/values-zh-rTW/strings.xml
+++ b/OsmAnd/res/values-zh-rTW/strings.xml
@@ -3778,27 +3778,27 @@
某些國家禁止使用測速照相的警報裝置。
方向
%1$s 已刪除
- 必須重新啟動才能完全刪除測速照相的資料。
+ 重新啟動應用程式以刪除所有測速照相的資料。
解除安裝並重新啟動
指定路線上允許的車輛長度。
長度限制
此裝置沒有測速照相機。
直排輪鞋
- 啟用裝置音量按鈕控制地圖縮放等級。
+ 使用裝置音量按鈕控制地圖縮放等級。
音量按鈕以縮放
提供您的車輛長度,某些路徑限制可能適用於較長的車輛。
- 刪除下一個目的地點
+ 刪除最近的目的地點
請提供點的名稱
目前路徑上的目的地點將會被刪除。如果其將為目的地,導航就會停止。
下載維基百科地圖
- 從維基百科取得關於興趣點的資訊。這是您的離線口袋指南 ── 只要啟用維基百科外掛程式並享受有關於您周圍景點的文章。
+ 從維基百科取得關於興趣點的資訊。這是您的離線口袋指南 ── 只要開啟維基百科外掛程式並享受有關於您周圍景點的文章。
耐力賽摩托車
小型摩托車
輪椅
輪椅向前
卡丁車
已關閉的 OSM 註記
- 您必須設定工作天以繼續
+ 設定工作天以繼續
點與點之間的路線
規劃路線
新增到軌跡
@@ -3824,14 +3824,12 @@
選取如何連接點,用直線或以選定的設定檔計算其間的路徑。
整個軌道
下一段
- 要使用此選項,OsmAnd 必須將您的軌跡捕捉到地圖道路上。
-\n
-\n在下一步,您只需要選取設定檔以偵測允許的道路與距離門檻以追蹤道路。
+ 接下來,使用您其中一個導航設定檔來將路線貼齊到最近可用的道路上以使用此選項。
門檻距離
導航設定檔
選取要加入新片段的軌道檔案。
街道級照片
- 您確定要不儲存就關閉計劃錄線嗎?您將會失去所有變更。
+ 您確定要關閉計畫路線來放棄所有變更嗎?
反向時
儲存為新的軌跡檔案
新增到軌跡檔案
@@ -3849,7 +3847,7 @@
儲存為軌跡檔案
跟隨軌跡
選擇要跟隨的軌跡檔案
- 選擇要跟隨的軌跡檔案,或是匯入一個。
+ 選擇要跟隨的軌跡檔案,或是從您的裝置匯入。
選取其他軌跡
從我的位置導航到軌跡
要導航的軌跡點
diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml
index fe274284d9..cd482756ec 100644
--- a/OsmAnd/res/values/phrases.xml
+++ b/OsmAnd/res/values/phrases.xml
@@ -4253,4 +4253,6 @@
Realtime
Timetable
+ Beehive
+
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 7f95db8cd1..3f8159283b 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -12,10 +12,10 @@
-->
- • Updated "Plan Route" mode allows using different navigation types for each segment and attaches any track to the roads\n\n
- • New "Appearance" options for tracks: select color, thickness turn on the direction arrows and start/finish marks\n\n
- • Improved bicycle nodes visibility\n\n
- • Context menu for tracks with basic info\n\n
+ • Updated "Plan a route" function: allows using different navigation types per segment and the inclusion of tracks\n\n
+ • New "Appearance" menu for tracks: select color, thickness, display direction arrows, start/finish icons\n\n
+ • Improved visibility of bicycle nodes.\n\n
+ • Tracks are now tappable, have context menu with basic info.\n\n
• Improved "Search" algorithms\n\n
• Improved "Follow track" options in Navigation\n\n
• Fixed issues with import/export of profile settings\n\n
@@ -51,7 +51,7 @@
Nearest point
Start of the track
Point of the track to navigate
- Navigate from my location to the track
+ Navigate from my position to the track
Select another track
Choose track file to follow or import it from your device.
Choose track file to follow
@@ -78,8 +78,8 @@
Next, snap your track to the nearest allowed road with one of your navigation profiles to use this option.
Next segment
Whole track
- Select how to connect points, with a straight line, or calculate a route between them with selected profile.
- Only the next segment will be recalculated using selected profile.
+ Select how to connect points, by a straight line, or calculate a route between them as specified below.
+ Only the next segment will be recalculated using the selected profile.
The whole track will be recalculated using the selected profile.
Reverse route
Save as new track
diff --git a/OsmAnd/src/net/osmand/FileUtils.java b/OsmAnd/src/net/osmand/FileUtils.java
index 661bf81f75..59fb36c88d 100644
--- a/OsmAnd/src/net/osmand/FileUtils.java
+++ b/OsmAnd/src/net/osmand/FileUtils.java
@@ -8,6 +8,7 @@ import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import net.osmand.plus.GpxSelectionHelper;
@@ -165,6 +166,18 @@ public class FileUtils {
return dest;
}
+ public static String createUniqueFileName(@NonNull OsmandApplication app, String name, String dirName, String extension) {
+ String uniqueFileName = name;
+ File dir = app.getAppPath(dirName);
+ File fout = new File(dir, name + extension);
+ int ind = 0;
+ while (fout.exists()) {
+ uniqueFileName = name + "_" + (++ind);
+ fout = new File(dir, uniqueFileName + extension);
+ }
+ return uniqueFileName;
+ }
+
public interface RenameCallback {
void renamedTo(File file);
}
diff --git a/OsmAnd/src/net/osmand/data/FavouritePoint.java b/OsmAnd/src/net/osmand/data/FavouritePoint.java
index 72cde20159..e5f4f6c8ea 100644
--- a/OsmAnd/src/net/osmand/data/FavouritePoint.java
+++ b/OsmAnd/src/net/osmand/data/FavouritePoint.java
@@ -7,6 +7,7 @@ import android.graphics.BitmapFactory;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import net.osmand.GPXUtilities.WptPt;
@@ -89,6 +90,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
return color;
}
+ @Nullable
public String getAddress() {
return address;
}
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
index 322c19e8e4..636fcddb72 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.WptPt;
@@ -1005,15 +1006,14 @@ public class MapMarkersHelper {
}
public String generateGpx(String fileName) {
- final File dir = ctx.getAppPath(IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR);
+ String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
+ File dir = ctx.getAppPath(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
- File fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
- int ind = 1;
- while (fout.exists()) {
- fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT);
- }
+ String uniqueFileName = FileUtils.createUniqueFileName(ctx, fileName, dirName, IndexConstants.GPX_FILE_EXT);
+ File fout = new File(dir, uniqueFileName + IndexConstants.GPX_FILE_EXT);
+
GPXFile file = new GPXFile(Version.getFullVersion(ctx));
for (MapMarker marker : mapMarkers) {
WptPt wpt = new WptPt();
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index efe26164d2..e23e596dcf 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -86,7 +86,6 @@ import net.osmand.plus.base.FailSafeFuntions;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.chooseplan.OsmLiveCancelledDialog;
import net.osmand.plus.dashboard.DashboardOnMap;
-import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.CrashBottomSheetDialogFragment;
import net.osmand.plus.dialogs.ImportGpxBottomSheetDialogFragment;
import net.osmand.plus.dialogs.RateUsBottomSheetDialogFragment;
@@ -109,21 +108,15 @@ import net.osmand.plus.helpers.ScrollHelper.OnScrollEventListener;
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuController;
-import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
-import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
-import net.osmand.plus.mapcontextmenu.editors.PointEditorFragmentNew;
-import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
-import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.PlanRouteFragment;
import net.osmand.plus.measurementtool.GpxApproximationFragment;
import net.osmand.plus.measurementtool.GpxData;
import net.osmand.plus.measurementtool.MeasurementEditingContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.measurementtool.SnapTrackWarningFragment;
-import net.osmand.plus.quickaction.QuickActionListFragment;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
@@ -141,12 +134,8 @@ import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomiz
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
-import net.osmand.plus.settings.fragments.ConfigureMenuItemsFragment;
import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
import net.osmand.plus.settings.fragments.DataStorageFragment;
-import net.osmand.plus.settings.fragments.ImportCompleteFragment;
-import net.osmand.plus.settings.fragments.ImportSettingsFragment;
-import net.osmand.plus.settings.fragments.ProfileAppearanceFragment;
import net.osmand.plus.track.TrackAppearanceFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
import net.osmand.plus.views.AnimateDraggingMapThread;
@@ -158,7 +147,6 @@ import net.osmand.plus.views.OsmandMapTileView.OnDrawMapListener;
import net.osmand.plus.views.corenative.NativeCoreContext;
import net.osmand.plus.views.layers.MapControlsLayer;
import net.osmand.plus.views.layers.MapInfoLayer;
-import net.osmand.plus.views.layers.MapQuickActionLayer;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
import net.osmand.render.RenderingRulesStorage;
@@ -669,85 +657,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
closeDrawer();
return;
}
- if (getQuickSearchDialogFragment() != null) {
- showQuickSearch(ShowQuickSearchMode.CURRENT, false);
- return;
- }
- if (trackDetailsMenu.isVisible()) {
- trackDetailsMenu.hide(true);
- if (mapContextMenu.isActive() && mapContextMenu.getPointDescription() != null
- && mapContextMenu.getPointDescription().isGpxPoint()) {
- mapContextMenu.show();
- return;
- }
- if (prevActivityIntent == null) {
- return;
- }
- }
- PlanRouteFragment planRouteFragment = getPlanRouteFragment();
- if (planRouteFragment != null) {
- if (planRouteFragment.quit(true)) {
- MapMarkersDialogFragment.showInstance(this);
- }
- return;
- }
-
- SnapTrackWarningFragment snapTrackWarningFragment = getSnapTrackWarningBottomSheet();
- if (snapTrackWarningFragment != null) {
- snapTrackWarningFragment.dismissImmediate();
- return;
- }
-
- GpxApproximationFragment gpxApproximationFragment = getGpxApproximationFragment();
- if (gpxApproximationFragment != null) {
- gpxApproximationFragment.dismissImmediate();
- return;
- }
-
- MeasurementToolFragment measurementToolFragment = getMeasurementToolFragment();
- if (measurementToolFragment != null) {
- measurementToolFragment.quit(true);
- return;
- }
- ChooseRouteFragment chooseRouteFragment = getChooseRouteFragment();
- if (chooseRouteFragment != null) {
- chooseRouteFragment.dismiss(true);
- return;
- }
- ProfileAppearanceFragment profileAppearanceFragment = getProfileAppearanceFragment();
- if (profileAppearanceFragment != null) {
- if (profileAppearanceFragment.isProfileAppearanceChanged()) {
- return;
- }
- }
-
- PointEditorFragmentNew pointEditorFragmentNew = getPointEditorFragmentNew();
- if (pointEditorFragmentNew != null) {
- pointEditorFragmentNew.showExitDialog();
- return;
- }
-
- TrackAppearanceFragment trackAppearanceFragment = getTrackAppearanceFragment();
- if (trackAppearanceFragment != null) {
- trackAppearanceFragment.dismissImmediate();
- if (prevActivityIntent == null) {
- return;
- }
- }
-
-
- if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
- if (mapContextMenu.getCurrentMenuState() != MenuState.HEADER_ONLY && !isLandscapeLayout()) {
- mapContextMenu.openMenuHeaderOnly();
- } else {
- mapContextMenu.close();
- }
- return;
- }
if (getMapLayers().getContextMenuLayer().isInAddGpxPointMode()) {
quitAddGpxPointMode();
}
- if (prevActivityIntent != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
+ if (getSupportFragmentManager().getBackStackEntryCount() == 0 && launchPrevActivityIntent()) {
+ return;
+ }
+ super.onBackPressed();
+ }
+
+ public boolean launchPrevActivityIntent() {
+ if (prevActivityIntent != null) {
prevActivityIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
LatLon loc = getMapLocation();
prevActivityIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
@@ -755,40 +675,13 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (mapViewTrackingUtilities.isMapLinkedToLocation()) {
prevActivityIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
}
- this.startActivity(prevActivityIntent);
+ startActivity(prevActivityIntent);
prevActivityIntent = null;
- return;
+ return true;
}
- QuickActionListFragment quickActionListFragment = getQuickActionListFragment();
- if (quickActionListFragment != null && quickActionListFragment.isVisible()) {
- if (quickActionListFragment.fromDashboard()) {
- this.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, null);
- } else {
- getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed();
- }
- } else if (getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
- return;
- }
- ImportSettingsFragment importSettingsFragment = getImportSettingsFragment();
- if (importSettingsFragment != null) {
- importSettingsFragment.showExitDialog();
- return;
- }
- ImportCompleteFragment importCompleteFragment = getImportCompleteFragment();
- if (importCompleteFragment != null) {
- importCompleteFragment.dismissFragment();
- return;
- }
- ConfigureMenuItemsFragment configureMenuItemsFragment = getConfigureMenuItemsFragment();
- if (configureMenuItemsFragment != null) {
- configureMenuItemsFragment.exitFragment();
- return;
- }
-
- super.onBackPressed();
+ return false;
}
-
private void quitAddGpxPointMode() {
getMapLayers().getContextMenuLayer().getAddGpxPointBottomSheetHelper().hide();
getMapLayers().getContextMenuLayer().quitAddGpxPoint();
@@ -930,7 +823,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
DataStoragePlaceDialogFragment.showInstance(getSupportFragmentManager(), true);
} else {
ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
+ new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
}
}
@@ -2301,30 +2194,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(ChooseRouteFragment.TAG);
}
- public ProfileAppearanceFragment getProfileAppearanceFragment() {
- return getFragment(ProfileAppearanceFragment.TAG);
- }
-
- public QuickActionListFragment getQuickActionListFragment() {
- return getFragment(QuickActionListFragment.TAG);
- }
-
- public ImportSettingsFragment getImportSettingsFragment() {
- return getFragment(ImportSettingsFragment.TAG);
- }
-
- public ImportCompleteFragment getImportCompleteFragment() {
- return getFragment(ImportCompleteFragment.TAG);
- }
-
- public ConfigureMenuItemsFragment getConfigureMenuItemsFragment() {
- return getFragment(ConfigureMenuItemsFragment.TAG);
- }
-
- public TrackAppearanceFragment getTrackAppearanceFragment() {
- return getFragment(TrackAppearanceFragment.TAG);
- }
-
public GpxApproximationFragment getGpxApproximationFragment() {
return getFragment(GpxApproximationFragment.TAG);
}
@@ -2333,15 +2202,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(SnapTrackWarningFragment.TAG);
}
- public PointEditorFragmentNew getPointEditorFragmentNew() {
- PointEditorFragmentNew pointEditorFragmentNew;
- pointEditorFragmentNew = getFragment(FavoritePointEditor.TAG);
- if (pointEditorFragmentNew == null) {
- pointEditorFragmentNew = getFragment(WptPtEditor.TAG);
- }
- return pointEditorFragmentNew;
- }
-
public void backToConfigureProfileFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
@@ -2353,7 +2213,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
}
}
- T getFragment(String fragmentTag){
+ T getFragment(String fragmentTag) {
Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (T) fragment : null;
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index ab05b2e2f3..8e444b7d88 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -294,7 +294,7 @@ public class MapActivityActions implements DialogProvider {
dlg.findViewById(R.id.DuplicateFileName).setVisibility(View.VISIBLE);
} else {
dlg.dismiss();
- new SaveDirectionsAsyncTask(app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
+ new SaveDirectionsAsyncTask(app, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
}
}
});
@@ -310,33 +310,42 @@ public class MapActivityActions implements DialogProvider {
return dlg;
}
- private static class SaveDirectionsAsyncTask extends AsyncTask {
+ public static class SaveDirectionsAsyncTask extends AsyncTask {
private final OsmandApplication app;
+ boolean showOnMap;
- public SaveDirectionsAsyncTask(OsmandApplication app) {
+ public SaveDirectionsAsyncTask(OsmandApplication app, boolean showOnMap) {
this.app = app;
+ this.showOnMap = showOnMap;
}
@Override
- protected String doInBackground(File... params) {
+ protected GPXFile doInBackground(File... params) {
if (params.length > 0) {
File file = params[0];
- String fileName = file.getName();
- GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName.substring(0,fileName.length()-GPX_FILE_EXT.length()));
- GPXUtilities.writeGpxFile(file, gpx);
- return app.getString(R.string.route_successfully_saved_at, file.getName());
+ String fileName = Algorithms.getFileNameWithoutExtension(file);
+ GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName);
+ gpx.error = GPXUtilities.writeGpxFile(file, gpx);
+ return gpx;
}
return null;
}
@Override
- protected void onPostExecute(String result) {
- if (result != null) {
+ protected void onPostExecute(GPXFile gpxFile) {
+ if (gpxFile.error == null) {
+ app.getSelectedGpxHelper().selectGpxFile(gpxFile, showOnMap, false);
+ String result = app.getString(R.string.route_successfully_saved_at, gpxFile.tracks.get(0).name);
Toast.makeText(app, result, Toast.LENGTH_LONG).show();
+ } else {
+ String errorMessage = gpxFile.error.getMessage();
+ if (errorMessage == null) {
+ errorMessage = app.getString(R.string.error_occurred_saving_gpx);
+ }
+ Toast.makeText(app, errorMessage, Toast.LENGTH_LONG).show();
}
}
-
}
public void addActionsToAdapter(final double latitude,
@@ -476,6 +485,7 @@ public class MapActivityActions implements DialogProvider {
} else if (standardId == R.string.avoid_road) {
getMyApplication().getAvoidSpecificRoads().addImpassableRoad(mapActivity, new LatLon(latitude, longitude), true, false, null);
} else if (standardId == R.string.shared_string_add || standardId == R.string.favourites_context_menu_edit) {
+ mapActivity.getContextMenu().hide();
mapActivity.getContextMenu().buttonFavoritePressed();
} else if (standardId == R.string.shared_string_marker || standardId == R.string.shared_string_edit) {
mapActivity.getContextMenu().buttonWaypointPressed();
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/GpxAppearanceAdapter.java b/OsmAnd/src/net/osmand/plus/dialogs/GpxAppearanceAdapter.java
index abfb18bd49..1a1e873b95 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/GpxAppearanceAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/GpxAppearanceAdapter.java
@@ -113,30 +113,27 @@ public class GpxAppearanceAdapter extends ArrayAdapter PURCHASE_VALIDATION_PERIOD_MSEC;
+ return !inventoryRequested && ((isSubscribedToLiveUpdates(ctx) && Algorithms.isEmpty(ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.get()))
+ || System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC);
}
public void requestInventory() {
@@ -803,6 +804,7 @@ public class InAppPurchaseHelper {
protected void onPostExecute(String response) {
logDebug("Response=" + response);
if (response != null) {
+ inventoryRequested = true;
try {
JSONObject obj = new JSONObject(response);
JSONArray names = obj.names();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 44748e36bb..5f88a13607 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -37,6 +37,7 @@ import android.widget.OverScroller;
import android.widget.ProgressBar;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
@@ -108,11 +109,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private InterceptorLinearLayout mainView;
private View toolbarContainer;
- private View toolbarView;
- private ImageView toolbarBackButton;
private TextView toolbarTextView;
private View topButtonContainer;
- private LockableScrollView menuScrollView;
private LinearLayout mainRouteBadgeContainer;
private LinearLayout nearbyRoutesLayout;
@@ -123,8 +121,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private TextView localRoutesMoreTv;
private View zoomButtonsView;
- private ImageButton zoomInButtonView;
- private ImageButton zoomOutButtonView;
private MapContextMenu menu;
private OnLayoutChangeListener containerLayoutListener;
@@ -149,7 +145,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private int topScreenPosY;
private int bottomToolbarPosY;
private int minHalfY;
- private int shadowHeight;
private int zoomPaddingTop;
private OsmandMapTileView map;
@@ -164,13 +159,32 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private boolean wasDrawerDisabled;
private boolean zoomIn;
- private int screenOrientation;
private boolean created;
private boolean transportBadgesCreated;
private UpdateLocationViewCache updateLocationViewCache;
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ boolean enabled = mapActivity.getQuickSearchDialogFragment() == null;
+ mapActivity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(enabled) {
+ public void handleOnBackPressed() {
+ if (menu.isVisible() && menu.isClosable()) {
+ if (menu.getCurrentMenuState() != MenuState.HEADER_ONLY && !menu.isLandscapeLayout()) {
+ menu.openMenuHeaderOnly();
+ } else {
+ menu.close();
+ }
+ }
+ }
+ });
+ }
+ }
+
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -188,7 +202,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
markerPaddingPx = dpToPx(MARKER_PADDING_DP);
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
- shadowHeight = dpToPx(SHADOW_HEIGHT_TOP_DP);
+ int shadowHeight = dpToPx(SHADOW_HEIGHT_TOP_DP);
topScreenPosY = addStatusBarHeightIfNeeded(-shadowHeight);
bottomToolbarPosY = addStatusBarHeightIfNeeded(getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar));
minHalfY = viewHeight - (int) (viewHeight * menu.getHalfScreenMaxHeightKoef());
@@ -204,8 +218,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
mainView = view.findViewById(R.id.context_menu_main);
toolbarContainer = view.findViewById(R.id.context_menu_toolbar_container);
- toolbarView = view.findViewById(R.id.context_menu_toolbar);
- toolbarBackButton = view.findViewById(R.id.context_menu_toolbar_back);
+ ImageView toolbarBackButton = view.findViewById(R.id.context_menu_toolbar_back);
toolbarTextView = (TextView) view.findViewById(R.id.context_menu_toolbar_text);
updateVisibility(toolbarContainer, 0);
toolbarBackButton.setOnClickListener(new View.OnClickListener() {
@@ -510,9 +523,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
// Zoom buttons
zoomButtonsView = view.findViewById(R.id.context_menu_zoom_buttons);
- zoomInButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_in_button);
- zoomOutButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_out_button);
if (menu.zoomButtonsVisible()) {
+ ImageButton zoomInButtonView = view.findViewById(R.id.context_menu_zoom_in_button);
+ ImageButton zoomOutButtonView = view.findViewById(R.id.context_menu_zoom_out_button);
AndroidUtils.updateImageButton(app, zoomInButtonView, R.drawable.ic_zoom_in, R.drawable.ic_zoom_in,
R.drawable.btn_circle_trans, R.drawable.btn_circle_night, nightMode);
AndroidUtils.updateImageButton(app, zoomOutButtonView, R.drawable.ic_zoom_out, R.drawable.ic_zoom_out,
@@ -2302,5 +2315,4 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
updateAdditionalInfoVisibility();
runLayoutListener();
}
-}
-
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
index c1420b7d24..a6a84bee67 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
@@ -28,6 +28,7 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew;
import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
+import net.osmand.util.Algorithms;
import net.osmand.util.OpeningHoursParser;
import net.osmand.view.GravityDrawable;
@@ -160,11 +161,16 @@ public class FavouritePointMenuController extends MenuController {
@NonNull
@Override
public CharSequence getSubtypeStr() {
- Typeface typeface = FontCache.getRobotoRegular(getMapActivity());
- SpannableString addressSpannable = new SpannableString(fav.getAddress());
- addressSpannable.setSpan(new CustomTypefaceSpan(typeface), 0, addressSpannable.length(), 0);
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null && !Algorithms.isEmpty(fav.getAddress())) {
+ Typeface typeface = FontCache.getRobotoRegular(mapActivity);
+ SpannableString addressSpannable = new SpannableString(fav.getAddress());
+ addressSpannable.setSpan(new CustomTypefaceSpan(typeface), 0, addressSpannable.length(), 0);
- return addressSpannable;
+ return addressSpannable;
+ } else {
+ return "";
+ }
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
index ae5bb9355b..cd7a783a7b 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
@@ -25,6 +25,7 @@ import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
@@ -49,6 +50,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.ColorDialogs;
+import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
import net.osmand.plus.widgets.FlowLayout;
import net.osmand.util.Algorithms;
@@ -99,6 +101,19 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private EditText addressEdit;
private int layoutHeightPrevious = 0;
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ showExitDialog();
+ }
+ }
+ });
+ }
+
@SuppressLint("ClickableViewAccessibility")
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
@@ -867,14 +882,28 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
dismissDialog.setPositiveButton(R.string.shared_string_exit, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- cancelled = true;
- dismiss();
+ exitEditing();
}
});
dismissDialog.show();
} else {
- cancelled = true;
- dismiss();
+ exitEditing();
+ }
+ }
+
+ private void exitEditing() {
+ cancelled = true;
+ dismiss();
+ showContextMenu();
+ }
+
+ private void showContextMenu() {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ MapContextMenu mapContextMenu = mapActivity.getContextMenu();
+ if (!mapContextMenu.isVisible() && mapContextMenu.isActive()) {
+ mapContextMenu.show();
+ }
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java
index f456ba0360..2a06fe71a7 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java
@@ -12,6 +12,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
@@ -49,11 +50,33 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment implements OsmA
return (MapActivity) requireMyActivity();
}
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final MapActivity mapActivity = requireMapActivity();
+ menu = mapActivity.getTrackDetailsMenu();
+
+ mapActivity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ if (menu.isVisible()) {
+ menu.hide(true);
+
+ MapContextMenu contextMenu = mapActivity.getContextMenu();
+ if (contextMenu.isActive() && contextMenu.getPointDescription() != null
+ && contextMenu.getPointDescription().isGpxPoint()) {
+ contextMenu.show();
+ } else {
+ mapActivity.launchPrevActivityIntent();
+ }
+ }
+ }
+ });
+ }
+
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
MapActivity mapActivity = requireMapActivity();
- menu = mapActivity.getTrackDetailsMenu();
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.track_details, container, false);
if (!AndroidUiHelper.isOrientationPortrait(mapActivity)) {
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
index 8c36930451..a68bd4c714 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
@@ -43,7 +43,6 @@ import androidx.annotation.DrawableRes;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.PopupMenu;
import androidx.core.content.ContextCompat;
@@ -57,6 +56,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.WptPt;
@@ -67,7 +67,6 @@ import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.Version;
@@ -79,6 +78,7 @@ import net.osmand.plus.mapmarkers.CoordinateInputFormats.DDM;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.DMS;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
import net.osmand.plus.mapmarkers.adapters.CoordinateInputAdapter;
+import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.widgets.EditTextEx;
import net.osmand.util.Algorithms;
import net.osmand.util.LocationParser;
@@ -1498,15 +1498,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
protected Void doInBackground(Void... params) {
if (Algorithms.isEmpty(gpx.path)) {
if (!Algorithms.isEmpty(fileName)) {
- final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR);
+ String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
+ File dir = app.getAppPath(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
- File fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
- int ind = 1;
- while (fout.exists()) {
- fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT);
- }
+ String uniqueFileName = FileUtils.createUniqueFileName(app, fileName, dirName, IndexConstants.GPX_FILE_EXT);
+ File fout = new File(dir, uniqueFileName + IndexConstants.GPX_FILE_EXT);
GPXUtilities.writeGpxFile(fout, gpx);
}
} else {
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
index 89a1016ea0..60399c3872 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
@@ -17,6 +17,7 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -57,8 +58,8 @@ import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapT
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
-import net.osmand.plus.views.layers.MapMarkersLayer;
import net.osmand.plus.views.OsmandMapTileView;
+import net.osmand.plus.views.layers.MapMarkersLayer;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.util.MapUtils;
@@ -96,6 +97,19 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
private View mainView;
private RecyclerView markersRv;
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null && quit(true)) {
+ MapMarkersDialogFragment.showInstance(mapActivity);
+ }
+ }
+ });
+ }
+
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java
index f176437ebd..a2a72d3f64 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java
@@ -21,6 +21,7 @@ import androidx.core.content.ContextCompat;
import com.google.android.material.textfield.TextInputLayout;
import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@@ -28,7 +29,6 @@ import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
-import java.io.File;
import java.util.Date;
import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.ADDED_POINTS_NUMBER_KEY;
@@ -85,21 +85,13 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
}
}
- final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR + "/map markers");
- if (!dir.exists()) {
- dir.mkdirs();
- }
Date date = new Date();
- final String suggestedName = app.getString(R.string.markers) + "_" + DateFormat.format("yyyy-MM-dd", date).toString();
- String displayedName = suggestedName;
- File fout = new File(dir, suggestedName + IndexConstants.GPX_FILE_EXT);
- int ind = 1;
- while (fout.exists()) {
- displayedName = suggestedName + "_" + (++ind);
- fout = new File(dir, displayedName + IndexConstants.GPX_FILE_EXT);
- }
- final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
- nameEditText.setText(displayedName);
+ String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
+ String suggestedName = app.getString(R.string.markers) + "_" + DateFormat.format("yyyy-MM-dd", date).toString();
+ String uniqueFileName = FileUtils.createUniqueFileName(app, suggestedName, dirName, IndexConstants.GPX_FILE_EXT);
+
+ final EditText nameEditText = mainView.findViewById(R.id.name_edit_text);
+ nameEditText.setText(uniqueFileName);
nameEditText.setTextColor(ContextCompat.getColor(getContext(), textPrimaryColor));
mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
index 68029eb36a..393e43b31b 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java
@@ -9,6 +9,7 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -97,6 +98,16 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
return MenuState.HALF_SCREEN;
}
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ dismissImmediate();
+ }
+ });
+ }
+
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
index c176275725..d80eddb6b7 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
@@ -20,6 +20,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -34,6 +35,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.Track;
@@ -170,6 +172,16 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
this.directionMode = directionMode;
}
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ quit(true);
+ }
+ });
+ }
+
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@@ -1445,18 +1457,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
GpxData gpxData = editingCtx.getGpxData();
String displayedName;
if (gpxData == null) {
- final String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
- displayedName = suggestedName;
- OsmandApplication app = getMyApplication();
- if (app != null) {
- File dir = app.getAppPath(GPX_INDEX_DIR);
- File fout = new File(dir, suggestedName + GPX_FILE_EXT);
- int ind = 0;
- while (fout.exists()) {
- displayedName = suggestedName + "_" + (++ind);
- fout = new File(dir, displayedName + GPX_FILE_EXT);
- }
- }
+ String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
+ displayedName = FileUtils.createUniqueFileName(requireMyApplication(), suggestedName, GPX_INDEX_DIR, GPX_FILE_EXT);
} else {
displayedName = AndroidUtils.trimExtension(new File(gpxData.getGpxFile().path).getName());
}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java b/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java
index 98d180e48f..8fc3be3037 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/ProfileCard.java
@@ -8,6 +8,8 @@ import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
@@ -23,7 +25,7 @@ public class ProfileCard extends BaseCard {
private ApplicationMode selectedMode;
private ProfileCardListener listener;
- public ProfileCard(MapActivity mapActivity, ApplicationMode selectedMode) {
+ public ProfileCard(@NonNull MapActivity mapActivity, @NonNull ApplicationMode selectedMode) {
super(mapActivity);
this.selectedMode = selectedMode;
}
@@ -75,7 +77,10 @@ public class ProfileCard extends BaseCard {
}
private void resetSelected(List modes) {
- ((RadioButton) view.findViewWithTag(selectedMode.getStringKey()).findViewById(R.id.compound_button)).setChecked(true);
+ View profileView = view.findViewWithTag(selectedMode.getStringKey());
+ if (profileView != null) {
+ ((RadioButton) profileView.findViewById(R.id.compound_button)).setChecked(true);
+ }
}
private void addProfileView(LinearLayout container, View.OnClickListener onClickListener, Object tag,
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
index 0355bba809..fb1badf2aa 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java
@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
+import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -59,6 +60,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
private String folderName;
private boolean rightButtonEnabled = true;
private boolean showSimplifiedButton = true;
+ private TextInputLayout nameTextBox;
@Override
public void createMenuItems(Bundle savedInstanceState) {
@@ -80,7 +82,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
View editNameView = View.inflate(UiUtilities.getThemedContext(app, nightMode),
R.layout.track_name_edit_text, null);
- final TextInputLayout nameTextBox = editNameView.findViewById(R.id.name_text_box);
+ nameTextBox = editNameView.findViewById(R.id.name_text_box);
nameTextBox.setBoxBackgroundColorResource(R.color.material_text_input_layout_bg);
nameTextBox.setHint(app.getString(R.string.ltr_or_rtl_combine_via_colon,
app.getString(R.string.shared_string_file_name), "").trim());
@@ -100,7 +102,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
@Override
public void afterTextChanged(Editable s) {
- checkEmptyName(s, nameTextBox);
+ checkEmptyName(s.toString());
}
});
BaseBottomSheetItem editFileName = new BaseBottomSheetItem.Builder()
@@ -206,6 +208,10 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
@Override
public void onItemSelected(String item) {
folderName = item;
+ EditText editText = nameTextBox.getEditText();
+ if (editText != null) {
+ checkEmptyName(editText.getText().toString());
+ }
}
};
}
@@ -260,17 +266,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
private void renameFile() {
OsmandApplication app = getMyApplication();
if (app != null) {
- File dir = getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR);
- File source = dir;
- if (sourceFolderName != null) {
- source = new File(dir, sourceFolderName);
- }
- source = new File(source, sourceFileName + IndexConstants.GPX_FILE_EXT);
- File dest = dir;
- if (folderName != null) {
- dest = new File(dir, folderName);
- }
- dest = new File(dest, fileName + IndexConstants.GPX_FILE_EXT);
+ File source = getFile(app, sourceFolderName, sourceFileName);
+ File dest = getFile(app, folderName, fileName);
if (!source.equals(dest)) {
if (dest.exists()) {
Toast.makeText(app, R.string.file_with_name_already_exists, Toast.LENGTH_LONG).show();
@@ -290,25 +287,46 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
}
}
+ private File getFile(OsmandApplication app, String folderName, String fileName) {
+ File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
+ File source = dir;
+ if (folderName != null) {
+ source = new File(dir, folderName);
+ }
+ source = new File(source, fileName + IndexConstants.GPX_FILE_EXT);
+ return source;
+ }
+
@Override
protected boolean isRightBottomButtonEnabled() {
return rightButtonEnabled;
}
- private void checkEmptyName(Editable name, TextInputLayout nameCaption) {
- String text = name.toString().trim();
+ private void checkEmptyName(String name) {
+ rightButtonEnabled = false;
+ String text = name.trim();
if (text.isEmpty()) {
- nameCaption.setError(getString(R.string.empty_filename));
- rightButtonEnabled = false;
+ nameTextBox.setError(getString(R.string.empty_filename));
+ } else if (isFileExist(name)) {
+ nameTextBox.setError(getString(R.string.file_with_name_already_exist));
} else {
- nameCaption.setError(null);
+ nameTextBox.setError(null);
fileName = text;
rightButtonEnabled = true;
}
updateBottomButtons();
}
- interface SaveAsNewTrackFragmentListener {
+ private boolean isFileExist(String name) {
+ OsmandApplication app = getMyApplication();
+ if (app != null) {
+ File file = getFile(app, folderName, name);
+ return file.exists();
+ }
+ return false;
+ }
+
+ public interface SaveAsNewTrackFragmentListener {
void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack);
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java
index 6730e4d923..49e1fa3d65 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SnapTrackWarningFragment.java
@@ -9,7 +9,9 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@@ -30,11 +32,12 @@ import net.osmand.plus.views.layers.MapInfoLayer;
import org.apache.commons.logging.Log;
import static android.view.Gravity.TOP;
-import static android.view.ViewGroup.LayoutParams.*;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.BACK_TO_LOC_HUD_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_IN_HUD_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID;
-import static net.osmand.plus.UiUtilities.DialogButtonType.*;
+import static net.osmand.plus.UiUtilities.DialogButtonType.PRIMARY;
+import static net.osmand.plus.UiUtilities.DialogButtonType.SECONDARY;
public class SnapTrackWarningFragment extends BaseOsmAndFragment {
@@ -56,6 +59,16 @@ public class SnapTrackWarningFragment extends BaseOsmAndFragment {
private boolean nightMode;
private boolean portrait;
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ dismissImmediate();
+ }
+ });
+ }
+
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
OsmandApplication app = getMyApplication();
if (app != null) {
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
index 036b60230f..ef7f8970b1 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
@@ -18,6 +18,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
@@ -38,11 +39,12 @@ import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
+import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.settings.backend.ApplicationMode;
-import net.osmand.plus.views.layers.MapQuickActionLayer;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback.OnItemMoveCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback.UnmovableItem;
+import net.osmand.plus.views.layers.MapQuickActionLayer;
import java.util.ArrayList;
import java.util.Collections;
@@ -100,6 +102,26 @@ public class QuickActionListFragment extends BaseOsmAndFragment
}
screenType = savedInstanceState.getInt(SCREEN_TYPE_KEY, SCREEN_TYPE_REORDER);
}
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ if (isVisible()) {
+ if (fromDashboard()) {
+ mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.CONFIGURE_SCREEN, null);
+ } else {
+ mapActivity.getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed();
+ }
+ } else if (mapActivity.getMapView().getLayerByClass(MapQuickActionLayer.class).onBackPressed()) {
+ return;
+ }
+ FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();
+ if (!fragmentManager.isStateSaved()) {
+ fragmentManager.popBackStackImmediate();
+ }
+ }
+ }
+ });
}
@Nullable
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
index c94c6e2968..b7b87f01b2 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
@@ -21,6 +22,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -33,7 +35,9 @@ import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import net.osmand.AndroidUtils;
+import net.osmand.FileUtils;
import net.osmand.GPXUtilities;
+import net.osmand.IndexConstants;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
@@ -42,22 +46,23 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.activities.MapActivityActions;
import net.osmand.plus.activities.PrintDialogActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.base.ContextMenuFragment;
import net.osmand.plus.base.ContextMenuFragment.ContextMenuFragmentListener;
import net.osmand.plus.base.ContextMenuFragment.MenuState;
import net.osmand.plus.helpers.AndroidUiHelper;
+import net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment;
import net.osmand.plus.routepreparationmenu.RouteDetailsFragment.CumulativeInfo;
import net.osmand.plus.routepreparationmenu.RouteDetailsFragment.RouteDetailsFragmentListener;
import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard;
import net.osmand.plus.routing.RouteDirectionInfo;
+import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.TransportRoutingHelper;
import net.osmand.plus.settings.backend.OsmandSettings;
-import net.osmand.plus.views.layers.MapControlsLayer;
import net.osmand.plus.views.OsmandMapTileView;
+import net.osmand.plus.views.layers.MapControlsLayer;
import net.osmand.router.TransportRouteResult;
import net.osmand.util.Algorithms;
@@ -73,12 +78,15 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
+import static net.osmand.IndexConstants.GPX_FILE_EXT;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.BACK_TO_LOC_HUD_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_IN_HUD_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID;
+import static net.osmand.plus.activities.MapActivityActions.SaveDirectionsAsyncTask;
+import static net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment.SaveAsNewTrackFragmentListener;
public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMenuFragmentListener,
- RouteDetailsFragmentListener {
+ RouteDetailsFragmentListener, SaveAsNewTrackFragmentListener {
public static final String TAG = "ChooseRouteFragment";
public static final String ROUTE_INDEX_KEY = "route_index_key";
@@ -111,6 +119,16 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
private boolean publicTransportMode;
private boolean needAdjustMap;
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ dismiss(true);
+ }
+ });
+ }
+
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -461,8 +479,19 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
public void onClick(View v) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
- RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
- MapActivityActions.createSaveDirections(mapActivity, routingHelper).show();
+ OsmandApplication app = mapActivity.getMyApplication();
+ GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute();
+
+ String fileName;
+ if (paramsBuilder == null || paramsBuilder.getFile() == null || paramsBuilder.getFile().path == null) {
+ String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
+ fileName = FileUtils.createUniqueFileName(app, suggestedName, IndexConstants.GPX_INDEX_DIR, GPX_FILE_EXT);
+ } else {
+ fileName = new File(paramsBuilder.getFile().path).getName();
+ }
+ SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(),
+ ChooseRouteFragment.this, null, fileName,
+ false, true);
}
}
};
@@ -861,6 +890,16 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
}
}
+ @Override
+ public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) {
+ OsmandApplication app = getMyApplication();
+ if (app != null) {
+ File fileDir = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), folderName == null ? "" : folderName);
+ File toSave = new File(fileDir, fileName + GPX_FILE_EXT);
+ new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
+ }
+ }
+
public class RoutesPagerAdapter extends FragmentPagerAdapter {
private int routesCount;
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
index 0e34a4ca35..3c55261668 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
@@ -34,6 +34,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
@@ -41,6 +42,7 @@ import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentTransaction;
@@ -232,13 +234,24 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ FragmentActivity activity = requireActivity();
app = getMyApplication();
nightMode = !app.getSettings().isLightContent();
navigationInfo = new NavigationInfo(app);
- accessibilityAssistant = new AccessibilityAssistant(getActivity());
+ accessibilityAssistant = new AccessibilityAssistant(activity);
+
boolean isLightTheme = app.getSettings().isLightContent();
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
setStyle(STYLE_NO_FRAME, themeId);
+
+ activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ mapActivity.showQuickSearch(ShowQuickSearchMode.CURRENT, false);
+ }
+ }
+ });
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java b/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java
index a46393fc67..39e91503ec 100644
--- a/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java
@@ -1,8 +1,6 @@
package net.osmand.plus.search;
-import android.os.Build;
import android.os.Bundle;
-import android.text.Html;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.TextView;
@@ -50,11 +48,7 @@ public class SendSearchQueryBottomSheet extends MenuBottomSheetDialogFragment {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final TextView textView = (TextView) View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.send_missing_search_query_tv, null);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- textView.setText(getString(R.string.send_search_query_description, searchQuery));
- } else {
- textView.setText(getString(R.string.send_search_query_description, searchQuery));
- }
+ textView.setText(getString(R.string.send_search_query_description, searchQuery));
BaseBottomSheetItem sendSearchQueryDescription = new SimpleBottomSheetItem.Builder().setCustomView(textView)
.create();
items.add(sendSearchQueryDescription);
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java
index d9980e0640..44fb4bf7f6 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java
@@ -1,6 +1,5 @@
package net.osmand.plus.settings.fragments;
-import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Build;
@@ -11,6 +10,7 @@ import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
@@ -24,11 +24,9 @@ import com.google.android.material.appbar.AppBarLayout;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
-import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
@@ -36,11 +34,13 @@ import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet;
-import net.osmand.plus.settings.fragments.ConfigureMenuRootFragment.ScreenType;
+import net.osmand.plus.settings.backend.ApplicationMode;
+import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
-import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
-import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.RearrangeMenuAdapterItem;
+import net.osmand.plus.settings.fragments.ConfigureMenuRootFragment.ScreenType;
import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.MenuItemsAdapterListener;
+import net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.RearrangeMenuAdapterItem;
+import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import org.apache.commons.logging.Log;
@@ -83,7 +83,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
private boolean nightMode;
private boolean wasReset = false;
private boolean isChanged = false;
- private Activity activity;
+ private FragmentActivity activity;
private RecyclerView recyclerView;
@Override
@@ -149,7 +149,13 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
nightMode = !app.getSettings().isLightContentForMode(appMode);
mInflater = UiUtilities.getInflater(app, nightMode);
mainActionItems = new ArrayList<>();
- activity = getActivity();
+ activity = requireActivity();
+ activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ @Override
+ public void handleOnBackPressed() {
+ exitFragment();
+ }
+ });
}
private void initSavedIds(ApplicationMode appMode) {
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
index a521e8e079..a18e2f6aa9 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
@@ -12,6 +12,7 @@ import android.view.ViewTreeObserver;
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
@@ -62,6 +63,12 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
super.onCreate(savedInstanceState);
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
+ requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ @Override
+ public void handleOnBackPressed() {
+ dismissFragment();
+ }
+ });
}
@Nullable
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
index 13dc2f94ce..284964b88d 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
@@ -16,6 +16,7 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
@@ -106,6 +107,12 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
app = requireMyApplication();
settingsHelper = app.getSettingsHelper();
nightMode = !app.getSettings().isLightContent();
+ requireActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ @Override
+ public void handleOnBackPressed() {
+ showExitDialog();
+ }
+ });
}
@Nullable
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java
index 9ea296e925..6fcf8a17bf 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java
@@ -23,6 +23,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
@@ -151,6 +152,11 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
changedProfile.navigationIcon = profile.navigationIcon;
isNewProfile = ApplicationMode.valueOfStringKey(changedProfile.stringKey, null) == null;
}
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ showExitDialog();
+ }
+ });
}
public void setupAppProfileObjectFromAppMode(ApplicationMode baseModeForNewProfile) {
@@ -893,7 +899,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
profileNameOtfb.setError(errorMessage, true);
}
- public boolean isProfileAppearanceChanged() {
+ public void showExitDialog() {
hideKeyboard();
if (isChanged()) {
AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(),
@@ -906,9 +912,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
}
});
dismissDialog.show();
- return true;
} else {
- return false;
+ dismiss();
}
}
diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java
index c0fe05d060..5061323bc5 100644
--- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java
+++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java
@@ -14,6 +14,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import androidx.activity.OnBackPressedCallback;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -147,6 +148,15 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
}
updateTrackColor();
}
+ requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
+ public void handleOnBackPressed() {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ dismissImmediate();
+ mapActivity.launchPrevActivityIntent();
+ }
+ }
+ });
}
private void updateTrackColor() {
diff --git a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java
index ebec402c95..6d6d5ba53b 100644
--- a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java
+++ b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java
@@ -17,7 +17,6 @@ import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
import androidx.fragment.app.Fragment;
-import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.internal.FlowLayout;
@@ -81,10 +80,10 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener {
createColorSelector();
updateColorSelector();
- coloringAdapter = new TrackColoringAdapter(appearanceItems);
- RecyclerView groupRecyclerView = view.findViewById(R.id.recycler_view);
- groupRecyclerView.setAdapter(coloringAdapter);
- groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
+// coloringAdapter = new TrackColoringAdapter(appearanceItems);
+// RecyclerView groupRecyclerView = view.findViewById(R.id.recycler_view);
+// groupRecyclerView.setAdapter(coloringAdapter);
+// groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
AndroidUiHelper.updateVisibility(view.findViewById(R.id.top_divider), isShowDivider());
}
@@ -156,7 +155,7 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener {
@Override
public void onClick(View v) {
updateColorSelector(color, rootView);
- coloringAdapter.notifyDataSetChanged();
+// coloringAdapter.notifyDataSetChanged();
trackDrawInfo.setColor(color);
CardListener listener = getListener();
diff --git a/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java b/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java
index 81208971bb..8a86b020a1 100644
--- a/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java
+++ b/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -71,13 +72,14 @@ public class TrackWidthCard extends BaseCard {
}
}
+ @Nullable
private AppearanceListItem getSelectedItem() {
if (selectedItem == null) {
String selectedWidth = trackDrawInfo.getWidth();
for (AppearanceListItem item : appearanceItems) {
- if (Algorithms.objectEquals(item.getValue(), selectedWidth)
+ if (selectedWidth != null && (Algorithms.objectEquals(item.getValue(), selectedWidth)
|| Algorithms.isEmpty(selectedWidth) && Algorithms.isEmpty(item.getValue())
- || Algorithms.isInt(selectedWidth) && CUSTOM_WIDTH.equals(item.getAttrName())) {
+ || Algorithms.isInt(selectedWidth) && CUSTOM_WIDTH.equals(item.getAttrName()))) {
selectedItem = item;
break;
}
@@ -106,11 +108,15 @@ public class TrackWidthCard extends BaseCard {
titleView.setText(R.string.select_track_width);
TextView descriptionView = view.findViewById(R.id.description);
- descriptionView.setText(getSelectedItem().getLocalizedValue());
+ AppearanceListItem item = getSelectedItem();
+ if (item != null) {
+ descriptionView.setText(item.getLocalizedValue());
+ }
}
private void updateCustomWidthSlider() {
- if (CUSTOM_WIDTH.equals(getSelectedItem().getAttrName())) {
+ AppearanceListItem item = getSelectedItem();
+ if (item != null && CUSTOM_WIDTH.equals(item.getAttrName())) {
Slider widthSlider = view.findViewById(R.id.width_slider);
widthSlider.setValueTo(CUSTOM_WIDTH_MAX);