diff --git a/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java b/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
index faab53994a..db84ec2297 100644
--- a/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
+++ b/OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
@@ -19,6 +19,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeSet;
import java.util.zip.GZIPInputStream;
import gnu.trove.list.array.TIntArrayList;
@@ -218,6 +220,13 @@ public class Amenity extends MapObject {
return lng;
}
+ public Set getSupportedContentLocales() {
+ Set supported = new TreeSet<>();
+ supported.addAll(getNames("content", "en"));
+ supported.addAll(getNames("description", "en"));
+ return supported;
+ }
+
public List getNames(String tag, String defTag) {
List l = new ArrayList();
for (String nm : getAdditionalInfo().keySet()) {
diff --git a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java
index 309101f720..5124d40cf4 100644
--- a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java
+++ b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java
@@ -39,7 +39,6 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -346,7 +345,7 @@ public class SearchUICore {
}
}
- public void setFilterOrders(Map filterOrders) {
+ public void setFilterOrders(List filterOrders) {
for (SearchCoreAPI capi : apis) {
if (capi instanceof SearchAmenityTypesAPI) {
((SearchAmenityTypesAPI) capi).setFilterOrders(filterOrders);
diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java
index 449695c283..ed9924d69f 100644
--- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java
+++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java
@@ -639,7 +639,7 @@ public class SearchCoreFactory {
private List customPoiFilters = new ArrayList<>();
private TIntArrayList customPoiFiltersPriorites = new TIntArrayList();
private MapPoiTypes types;
- private Map filterOrders = new HashMap<>();
+ private List filterOrders = new ArrayList<>();
public SearchAmenityTypesAPI(MapPoiTypes types) {
super(ObjectType.POI_TYPE);
@@ -656,7 +656,7 @@ public class SearchCoreFactory {
this.customPoiFiltersPriorites.add(priority);
}
- public void setFilterOrders(Map filterOrders) {
+ public void setFilterOrders(List filterOrders) {
this.filterOrders = filterOrders;
}
@@ -737,8 +737,8 @@ public class SearchCoreFactory {
res.firstUnknownWordMatches = startMatch.matches(res.localeName);
if (showTopFiltersOnly) {
String stdFilterId = getStandardFilterId(pt);
- if (filterOrders.containsKey(stdFilterId)) {
- res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.get(stdFilterId);
+ if (filterOrders.contains(stdFilterId)) {
+ res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.indexOf(stdFilterId);
resultMatcher.publish(res);
}
} else {
@@ -754,8 +754,8 @@ public class SearchCoreFactory {
res.object = csf;
res.objectType = ObjectType.POI_TYPE;
if (showTopFiltersOnly) {
- if (filterOrders.containsKey(csf.getFilterId())) {
- res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.get(csf.getFilterId());
+ if (filterOrders.contains(csf.getFilterId())) {
+ res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.indexOf(csf.getFilterId());
resultMatcher.publish(res);
}
} else {
diff --git a/OsmAnd/assets/poi_categories.json b/OsmAnd/assets/poi_categories.json
deleted file mode 100644
index 51afd627af..0000000000
--- a/OsmAnd/assets/poi_categories.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "categories" : {
- "special" : {
- "icons" : [
- "special_star", "special_star_stroked", "special_marker", "special_flag_stroke", "special_house", "special_building"
- ]
- },
- "amenity" : {
- "icons": [
- "amenity_bar", "amenity_cafe", "amenity_atm", "amenity_biergarten", "amenity_cinema", "amenity_fire_station", "amenity_parking"
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/OsmAnd/res/layout/edit_arrangement_list_fragment.xml b/OsmAnd/res/layout/edit_arrangement_list_fragment.xml
index 2ec9131aee..ee9654d322 100644
--- a/OsmAnd/res/layout/edit_arrangement_list_fragment.xml
+++ b/OsmAnd/res/layout/edit_arrangement_list_fragment.xml
@@ -8,11 +8,7 @@
-
-
-
-
+ android:layout_height="wrap_content" />
+ android:layout_marginStart="@dimen/list_content_padding_large" />
+ android:layout_marginLeft="@dimen/settings_divider_margin_start"
+ android:layout_marginStart="@dimen/settings_divider_margin_start" />
+ android:paddingEnd="@dimen/list_header_padding"
+ android:paddingRight="@dimen/list_header_padding">
+ android:layout_width="@dimen/favorites_icon_size"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical">
+ tools:visibility="visible" />
+ tools:src="@drawable/bg_point_circle"/>
+ android:layout_marginStart="@dimen/favorites_icon_right_margin"
+ android:layout_marginLeft="@dimen/favorites_icon_right_margin"
+ android:layout_marginEnd="@dimen/favorites_icon_right_margin"
+ android:layout_marginRight="@dimen/favorites_icon_right_margin"
+ android:paddingTop="@dimen/context_menu_padding_margin_small"
+ android:paddingBottom="@dimen/context_menu_padding_margin_small">
+ tools:text="@string/lorem_ipsum" />
+ android:textSize="@dimen/default_desc_text_size"
+ tools:text="100500 km" />
+ android:layout_marginStart="@dimen/list_item_button_padding"
+ android:layout_marginLeft="@dimen/list_item_button_padding"
+ android:contentDescription="@string/favorite_category_name"
+ android:src="@drawable/ic_small_group" />
+ android:textSize="@dimen/default_desc_text_size" />
+ android:visibility="gone" />
+ android:visibility="gone" />
\ No newline at end of file
diff --git a/OsmAnd/res/layout/gpx_track_select_dialog.xml b/OsmAnd/res/layout/gpx_track_select_dialog.xml
index 88c1985298..3a2c2ab41d 100644
--- a/OsmAnd/res/layout/gpx_track_select_dialog.xml
+++ b/OsmAnd/res/layout/gpx_track_select_dialog.xml
@@ -47,23 +47,4 @@
tools:listitem="@layout/gpx_track_select_item">
-
-
-
-
-
\ No newline at end of file
diff --git a/OsmAnd/res/layout/gpx_track_select_item.xml b/OsmAnd/res/layout/gpx_track_select_item.xml
index 844b1382f2..21e925e64b 100644
--- a/OsmAnd/res/layout/gpx_track_select_item.xml
+++ b/OsmAnd/res/layout/gpx_track_select_item.xml
@@ -2,7 +2,8 @@
@@ -21,7 +22,7 @@
+ android:gravity="center_vertical"
+ android:minHeight="@dimen/setting_list_item_large_height">
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginEnd="@dimen/list_content_padding"
+ android:layout_marginRight="@dimen/list_content_padding"
+ tools:src="@drawable/ic_map" />
-
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OsmAnd/res/layout/order_poi_list_item.xml b/OsmAnd/res/layout/order_poi_list_item.xml
index 1fe14f3a31..e208a1c05f 100644
--- a/OsmAnd/res/layout/order_poi_list_item.xml
+++ b/OsmAnd/res/layout/order_poi_list_item.xml
@@ -47,7 +47,7 @@
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="marquee"
- android:paddingLeft="@dimen/content_padding"
+ android:paddingLeft="0dp"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half"
@@ -56,7 +56,7 @@
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/poi_aerialway_transport"
android:paddingEnd="@dimen/content_padding"
- android:paddingStart="@dimen/content_padding" />
+ android:paddingStart="0dp" />
diff --git a/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml b/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml
new file mode 100644
index 0000000000..a2a7ca35ba
--- /dev/null
+++ b/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml
index 123a42d460..7da0bc703b 100644
--- a/OsmAnd/res/values-ar/strings.xml
+++ b/OsmAnd/res/values-ar/strings.xml
@@ -3363,7 +3363,7 @@
محاكاة موقعك باستخدام مسار GPX مسجل.
زر لجعل مركز الشاشة نقطة الانطلاق. سيطلب بعد ذلك تعيين الوجهة أو تشغيل حساب المسار.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
شخصي
تنزيل %s
سميك
@@ -3582,7 +3582,5 @@
اللغات
اللغة
جميع اللغات
- قد لا تكون بعض مقالات ويكيبيديا متاحة باسمك ، حدد اللغات التي ستظهر بها مقالات ويكيبيديا على الخريطة.
-\nستتمكن من التبديل بين جميع اللغات المتاحة أثناء قراءة المقالة.
هناك حاجة إلى خرائط إضافية لعرض النقاط المهمة من ويكيبيديا على الخريطة.
\ No newline at end of file
diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml
index 68b9fd969e..1ac9a2a332 100644
--- a/OsmAnd/res/values-be/strings.xml
+++ b/OsmAnd/res/values-be/strings.xml
@@ -3368,7 +3368,7 @@
Захоўваць кірунак
Падчас запісу захоўваць кірунак для кожнага пункта маршруту.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Асабісты
Спампоўванне %s
Тоўста
diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml
index 9630638fd9..d6d6f7f250 100644
--- a/OsmAnd/res/values-ca/strings.xml
+++ b/OsmAnd/res/values-ca/strings.xml
@@ -3404,7 +3404,7 @@ Abasta l\'àrea: %1$s x %2$s
Uneix segments
Voleu afegir el nou perfil \'%1$s\'\?
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personal
S\'està baixant %s
Mostra les vies ciclistes de xarxa de nodes
@@ -3619,7 +3619,19 @@ Abasta l\'àrea: %1$s x %2$s
Idiomes
Llengua
Tots els idiomes
- Alguns articles de la Viquipèdia podrien no estar disponibles en la vostra llengua, seleccioneu els idiomes de la Viquipèdia amb els que es localitzaran articles en el mapa.
-\nPodreu anar canviant entre els idiomes disponibles mentre llegiu l\'article.
Es necessiten mapes addicionals per veure els PDIs de la Viquipèdia al mapa.
+ Personalització de la IU
+ Accions del menú contextual
+ Reordena o amaga els elements des del %1$s.
+ Divisor
+ Elements per sota d’aquest punt separats per un divisor.
+ Amagat
+ Aquests elements no es mostren al menú, però les opcions o els connectors que representen continuen funcionant.
+ La configuració es restablirà a l\'estat original després d\'amagar-se.
+ Les accions principals només contenen 4 botons.
+ Accions principals
+ Podeu accedir a aquesta acció prement el botó \"Accions\".
+ Només podeu moure els elements dins d\'aquesta categoria.
+ Connector per a desenvolupadors
+ Elements
\ No newline at end of file
diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml
index 45c87b838a..74b98fcf78 100644
--- a/OsmAnd/res/values-da/strings.xml
+++ b/OsmAnd/res/values-da/strings.xml
@@ -3406,7 +3406,7 @@ Repræsenterer område: %1$s x %2$s
Medtag retning
Gem retning for hvert sporpunkt under optagelse.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personlig
Henter %s
Tyk
@@ -3598,6 +3598,4 @@ Repræsenterer område: %1$s x %2$s
Sprog
Alle sprog
Yderligere kort er nødvendige for at se Wikipedia Interessepunkter på kortet.
- Nogle Wikipedia-artikler er muligvis ikke tilgængelige på nogle sprog. Vælg de sprog, som Wikipedia-artikler skal vises på kortet.
-\nSkift mellem alle tilgængelige sprog, mens artiklen læses.
\ No newline at end of file
diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml
index 521ee4a075..b031853e7b 100644
--- a/OsmAnd/res/values-de/strings.xml
+++ b/OsmAnd/res/values-de/strings.xml
@@ -3410,7 +3410,7 @@ Lon %2$s
Richtung einbeziehen
Richtung zu jedem Trackpunkt während der Aufnahme speichern.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Persönlich
%s herunterladen
Fett
@@ -3625,7 +3625,6 @@ Lon %2$s
Sprachen
Sprache
Alle Sprachen
- Manche Wikipedia-Artikel liegen unter Umständen nicht in Ihrer Sprache vor. Wählen Sie die Sprachen aus, in denen Wikipedia-Artikel auf der Karte erscheinen sollen.
-\nSie können beim Lesen des Artikels zwischen allen verfügbaren Sprachen wechseln.
Zusätzliche Karten werden benötigt um Wikipedia-POIs auf der Karte anzuzeigen.
+ Entwickler-Plugin
\ No newline at end of file
diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml
index 87004e9be8..cceaa6d0e4 100644
--- a/OsmAnd/res/values-el/strings.xml
+++ b/OsmAnd/res/values-el/strings.xml
@@ -3403,7 +3403,7 @@
Συμπερίληψη κατεύθυνσης
Αποθήκευση κατεύθυνσης για κάθε σημείο ίχνους κατά την εγγραφή.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Προσωπικό
Λήψη %s
Πυκνός
diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml
index 5837ab1263..2f2ec82442 100644
--- a/OsmAnd/res/values-eo/strings.xml
+++ b/OsmAnd/res/values-eo/strings.xml
@@ -3386,7 +3386,7 @@ Indikas lokon: %1$s x %2$s"
Inkluzivi direkton
Konservi direkton al ĉiu punkto de kurso dum registri.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personaj
Elŝutado de %s
Dika
@@ -3601,7 +3601,11 @@ Indikas lokon: %1$s x %2$s"
Lingvoj
Lingvo
Ĉiuj lingvoj
- Iuj artikoloj de Vikipedio povas ne esti disponeblaj en via(j) lingvo(j), elektu lingvojn en kiuj artikoloj de Vikipedio estos montrataj sur la mapo.
-\nVi povas baskuli inter ĉiuj disponeblaj lingvoj dum legi artikolon.
Kromaj mapoj estas necesaj por vidigi punktojn de Vikipedio sur la mapo.
+ Ĉefaj agoj povas enhavi nur 4 butonojn.
+ Ĉefaj agoj
+ Vi povas aliri tiun ĉi agojn per la butono “agoj”.
+ Vi povas movi elementojn nur ene tiu ĉi kategorio.
+ Programista kromprogramo
+ Elementoj
\ No newline at end of file
diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml
index 1000d41c7b..444cef3048 100644
--- a/OsmAnd/res/values-es-rAR/strings.xml
+++ b/OsmAnd/res/values-es-rAR/strings.xml
@@ -3405,7 +3405,7 @@ Lon %2$s
Incluir rumbo
%1$s • %2$s
Guarda el rumbo para cada punto de la traza durante la grabación.
- %1$s, %2$s
+ %1$s, %2$s
Personal
Descargando %s
Espesor
diff --git a/OsmAnd/res/values-es-rUS/strings.xml b/OsmAnd/res/values-es-rUS/strings.xml
index b92bd26311..5422e2fd9a 100644
--- a/OsmAnd/res/values-es-rUS/strings.xml
+++ b/OsmAnd/res/values-es-rUS/strings.xml
@@ -3405,7 +3405,7 @@ Lon %2$s
Incluir rumbo
Guarda el rumbo para cada punto de la traza durante la grabación.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personal
Descargando %s
Espesor
diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml
index 96647408e0..5cd8e0dfc9 100644
--- a/OsmAnd/res/values-es/strings.xml
+++ b/OsmAnd/res/values-es/strings.xml
@@ -3395,7 +3395,7 @@
Incluir rumbo
Guarda el rumbo para cada punto de la traza durante la grabación.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personal
Descargando %s
Grueso
diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml
index 6d2e58c040..6791a51366 100644
--- a/OsmAnd/res/values-et/strings.xml
+++ b/OsmAnd/res/values-et/strings.xml
@@ -1033,7 +1033,7 @@
Kaasa pealkiri
Salvestamise ajal salvesta kurss igasse teekonnapunkti.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Isiklik
Allalaadimine %s
Jäme
diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml
index 43cc24f8a0..8ca0c17d2a 100644
--- a/OsmAnd/res/values-eu/strings.xml
+++ b/OsmAnd/res/values-eu/strings.xml
@@ -3409,7 +3409,7 @@ Area honi dagokio: %1$s x %2$s
Sartu norabidea
Gorde lorratzeko puntu bakoitzerako norabidea grabatzean.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Pertsonala
%s deskargatzen
Lodia
@@ -3628,7 +3628,5 @@ Area honi dagokio: %1$s x %2$s
Hizkuntzak
Hizkuntza
Hizkuntza guztiak
- Baliteke Wikipediako artikulu batzuk zure hizkuntzan erabilgarri ez egotea, hautatu mapan agertuko diren Wikipediako artikuluen hizkuntzak.
-\nEskuragarri dauden hizkuntza guztien artean alda dezakezu artikulua irakurtzean.
Mapa osagarriak behar dira Wikipediaren POIak mapan ikusteko.
\ No newline at end of file
diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml
index d9ba7d380b..23d299798a 100644
--- a/OsmAnd/res/values-fa/strings.xml
+++ b/OsmAnd/res/values-fa/strings.xml
@@ -3431,7 +3431,7 @@
ثبت جهت
هنگام ضبط، جهت (heading) را برای هر یک از نقطههای رد ثبت میکند.
%1$s • %2$s
- %1$s، %2$s
+ %1$s، %2$s
شخصی
در حال بارگیری %s
ضخیم
diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml
index 788730f7c1..b843935141 100644
--- a/OsmAnd/res/values-fr/strings.xml
+++ b/OsmAnd/res/values-fr/strings.xml
@@ -3376,7 +3376,7 @@ représentant la zone : %1$s x %2$s
Réseaux
Personnel
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Téléchargement %s
Épais
Pour les déserts et autres zones faiblement peuplées, affiche plus de détails.
@@ -3586,8 +3586,6 @@ représentant la zone : %1$s x %2$s
Impossible de lire %1$s.
Impossible d\'écrire %1$s.
Impossible d\'importer %1$s.
- Sélectionnez les langues dans lesquelles les articles Wikipédia apparaîtront sur la carte. Certains articles Wikipédia peuvent ne pas être disponibles dans certaines langues.
-\nVous pourrez basculer entre toutes les langues disponibles pendant la lecture de l’article.
Sélectionnez le fichier de trace
Langues
Langue
diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml
index 24962ac115..d808a6b395 100644
--- a/OsmAnd/res/values-gl/strings.xml
+++ b/OsmAnd/res/values-gl/strings.xml
@@ -3476,7 +3476,7 @@ Lon %2$s
Incluír encabezamento
Gardar encabezamento en cada punto da pista (trackpoint) mentres se grava.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Persoal
Baixando %s
Groso
diff --git a/OsmAnd/res/values-he/strings.xml b/OsmAnd/res/values-he/strings.xml
index d3649b207e..4cce74861b 100644
--- a/OsmAnd/res/values-he/strings.xml
+++ b/OsmAnd/res/values-he/strings.xml
@@ -3395,7 +3395,7 @@
כולל הכותרת
לשמור את הכותרת של כל נקודת דרך בזמן ההקלטה.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
אישי
%s בהורדה
מסלולים שעבור גרומינג לסגנון קלסי רק ללא מסלולי ההחלקה. לרבות מסלולים שעברו גרומינג על ידי אופנוע שלג עם תוואי רופף ומסלולים שנסללו ידנית על ידי גולשי סקי.
@@ -3613,6 +3613,4 @@
תופעת לוואי: כתוצאה מסינון לפי דיוק, ייתכן שכמה נקודות תיעלמנה עבור למשל מתחת לגשרים, מתחת לעצים, בין בניינים גבוהים או בתנאי מזג אוויר מסוימים.
פעולה זו תקליט רק נקודות שנמדדו עם חיווי של דיוק מזערי (במטרים/רגל כפי שדווח על ידי Android עבור ערכת השבבים שלך). דיוק מתייחס לפיזור המדידות המחזוריות ואינו קשור לדיוק, שמגדיר כמה קרובות המדידות שלך למיקום האמתי שלך.
המלצה: כדאי לנסות להשתמש בזיהוי תנועה דרך המסנן לסף תנועה תחתון (B) קודם לכן, הוא עשוי להביא לתוצאות טובות יותר ופחות מידע ילך לאיבוד. אם המסלולים שלך עדיין רועשים במהירויות נמוכות, כדי לנסות כאן ערכים שונים מאפס. נא לשים לב שחלק מהמדידות לא תדווחנה נתוני מהירות כלל (שיטות מבוססות רשת), שבמקרים כאלה לא יוקלט שום דבר.
- חלק מהערכים בוויקיפדיה לא יהיו זמינים בשם שצוין, יש לבחור את השפות בהן יופיעו הערכים של ויקיפדיה במפה.
-\nניתן יהיה להחליף בין כל השפות הזמינות בזמן קריאת הערך.
\ No newline at end of file
diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml
index 35505b6218..b849dc35e0 100644
--- a/OsmAnd/res/values-hu/strings.xml
+++ b/OsmAnd/res/values-hu/strings.xml
@@ -3233,7 +3233,7 @@ Ha szereted az OsmAndot és az OSM-et, és szeretnéd támogatni a fejlődésük
Javasolt térképek
Hozzáadja az új „%1$s” profilt\?
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Személyes
%s letöltése
Útvonal: távolság %s, menetidő %s
diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml
index 71f7ece951..90fa635c9b 100644
--- a/OsmAnd/res/values-is/strings.xml
+++ b/OsmAnd/res/values-is/strings.xml
@@ -3413,7 +3413,7 @@ Stendur fyrir svæði: %1$s x %2$s
Hafa með stefnu
Vista stefnu í hvern ferilpunkt á meðan upptöku stendur.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Persónulegt
Sæki %s
Svert
diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml
index c9cbcd6ff9..4bdc8b7563 100644
--- a/OsmAnd/res/values-it/strings.xml
+++ b/OsmAnd/res/values-it/strings.xml
@@ -3397,7 +3397,7 @@ Rappresenta l\'area: %1$s x %2$s
Salva orientamento
Durante la registrazione salva l\'orientamento per ogni punto della traccia
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personale
Scaricamento %s
Parco innevato
@@ -3623,6 +3623,4 @@ Rappresenta l\'area: %1$s x %2$s
Lingue
Lingua
Tutte le lingue
- Alcuni articoli Wikipedia potrebbero non essere disponibili nella tua lingua, scegli il linguaggio con cui appariranno sulla mappa.
-\nDurante la lettura potrai cambiare fra tutte le lingue disponibili.
\ No newline at end of file
diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml
index 4208ff5d74..134a3c5b4d 100644
--- a/OsmAnd/res/values-ja/strings.xml
+++ b/OsmAnd/res/values-ja/strings.xml
@@ -3409,7 +3409,7 @@ POIの更新は利用できません
濃い
砂漠などの過疎地に向いたマップスタイルです。各情報の詳細も表示されます。
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
移動中の位置アイコン
静止中の位置アイコン
[決定]をタップすると、プロファイルが完全に削除されます。
diff --git a/OsmAnd/res/values-kn/strings.xml b/OsmAnd/res/values-kn/strings.xml
index cf40b4668a..bbe6999e0d 100644
--- a/OsmAnd/res/values-kn/strings.xml
+++ b/OsmAnd/res/values-kn/strings.xml
@@ -362,7 +362,7 @@
ಶೀರ್ಷಿಕೆಯನ್ನು ಸೇರಿಸಿ
ರೆಕಾರ್ಡಿಂಗ್ ಮಾಡುವಾಗ ಪ್ರತಿ ಟ್ರ್ಯಾಕ್ ಪಾಯಿಂಟ್ಗೆ ಶೀರ್ಷಿಕೆ ಉಳಿಸಿ.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
ವೈಯಕ್ತಿಕ
ಡೌನ್ಲೋಡ್ ಮಾಡಲಾಗುತ್ತಿದೆ%s
ದಪ್ಪ
diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml
index 4fbed048c5..ffa6aba1c3 100644
--- a/OsmAnd/res/values-nb/strings.xml
+++ b/OsmAnd/res/values-nb/strings.xml
@@ -3406,7 +3406,7 @@
Skru av
Nytt programtillegg lagt til
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personlig
Laster ned %s
Tykk
@@ -3499,4 +3499,7 @@
Kunne ikke lese %1$s.
Kunne ikke importere %1$s.
Kunne ikke skrive %1$s.
+ Språk
+ Språk
+ Alle språk
\ No newline at end of file
diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml
index 8534b9b25a..4327f37146 100644
--- a/OsmAnd/res/values-nl/strings.xml
+++ b/OsmAnd/res/values-nl/strings.xml
@@ -3281,7 +3281,7 @@ voor Gebied: %1$s x %2$s
Richting toevoegen
Persoonlijk
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Downloaden %s
Voor woestijnen en andere dunbevolkte gebieden. Meer gedetailleerd.
Dik
diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml
index cca6aca133..f40f24f844 100644
--- a/OsmAnd/res/values-pl/strings.xml
+++ b/OsmAnd/res/values-pl/strings.xml
@@ -3403,7 +3403,7 @@ Reprezentuje obszar: %1$s x %2$s
Dołączenie kierunku
Zapisuje podczas rejestrowania kierunek do każdego punktu trasy.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Osobiste
Pobieranie %s
Dla pustyń i innych słabo zaludnionych obszarów. Bardziej szczegółowa.
diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml
index e70a828b85..a623a7ca38 100644
--- a/OsmAnd/res/values-pt-rBR/strings.xml
+++ b/OsmAnd/res/values-pt-rBR/strings.xml
@@ -3392,7 +3392,7 @@ Pôr do Sol: %2$s
Incluir direção
Salve o cabeçalho em cada ponto da trilha durante a gravação.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Pessoal
Baixando %s
Grosso
@@ -3606,7 +3606,5 @@ Pôr do Sol: %2$s
Idiomas
Idioma
Todos os idiomas
- Alguns artigos da Wikipédia podem não estar disponíveis em seu nome. Selecione os idiomas nos quais os artigos da Wikipédia aparecerão no mapa.
-\nVocê poderá alternar entre todos os idiomas disponíveis enquanto lê o artigo.
Mapas adicionais são necessários para visualizar os POIs da Wikipédia no mapa.
\ No newline at end of file
diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml
index 8c4aec3961..e01ac7c791 100644
--- a/OsmAnd/res/values-pt/strings.xml
+++ b/OsmAnd/res/values-pt/strings.xml
@@ -3377,7 +3377,7 @@
Incluir a direção
Gravar direção para cada ponto de pista durante a gravação.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Pessoal
Descarregando %s
Grosso
diff --git a/OsmAnd/res/values-ro/strings.xml b/OsmAnd/res/values-ro/strings.xml
index d6a727c9d3..67c7894459 100644
--- a/OsmAnd/res/values-ro/strings.xml
+++ b/OsmAnd/res/values-ro/strings.xml
@@ -2654,7 +2654,7 @@
Includeți titlu
Salvați poziția fiecarui punct al traseului în timpul înregistrării.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personal
Descarcarea %s
Gros
diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index ab4257697c..8593da7eb2 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -3354,7 +3354,7 @@
Предлагаемые карты
Объединить сегменты
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Для пустынь и других малонаселенных районов. Более детально.
Положение значка при движении
Положение значка в состоянии покоя
@@ -3608,10 +3608,27 @@
Невозможно записать %1$s.
Невозможно импортировать %1$s.
Выберите файл трека
- Некоторые статьи Википедии могут быть недоступны на вашем родном языке, выберите языки, на которых такие статьи будут отображаться на карте.
-\nВы сможете переключаться между всеми доступными языками во время чтения статьи.
Языки
Язык
Все языки
Для просмотра POI Википедии на карте необходимы дополнительные карты.
+ Настройка количества элементов в разделах \"Панель\", \"Настройка карты\" и контекстном меню.
+\n
+\nМожно отключить неиспользуемые плагины, чтобы скрыть их элементы управления из приложения %1$s.
+ Элементы панели, контекстное меню
+ Панель
+ Элементы ниже разделенные делителем.
+ Элементы
+ Настройка интерфейса
+ Действия контекстного меню
+ Изменить порядок или скрыть элементы из %1$s.
+ Разделитель
+ Скрыто
+ Эти элементы скрыты из меню, но представляемые ими функции или плагины продолжают работать.
+ Настройки будут сброшены в исходное состояние после скрытия.
+ Основные действия содержат только 4 кнопки.
+ Основные действия
+ Доступ к этим действиям происходит нажатием кнопки \"Действия\".
+ Перемещать элементы можно только внутри данной категории.
+ Плагин для разработчиков
\ No newline at end of file
diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml
index 1a5b2ea998..1d55828b3c 100644
--- a/OsmAnd/res/values-sc/strings.xml
+++ b/OsmAnd/res/values-sc/strings.xml
@@ -3404,7 +3404,7 @@ Pro praghere iscrie su còdighe intreu
Inclue sa diretzione
Sarva sa diretzione pro cada puntu cando ses registrende.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personale
Iscarrighende %s
Grussa
@@ -3618,7 +3618,5 @@ Pro praghere iscrie su còdighe intreu
Limbas
Limba
Totu sas limbas
- Unos cantos artìculos de Wikipedia diant pòdere no èssere disponìbiles in sa limba tua. Issèbera sas limbas de sos artìculos de Wikipedia chi ant a apàrrere in sa mapa.
-\nAs a pòdere colare dae una limba a s\'àtera in su mentres chi ses leghende un\'artìculu.
Pro bìdere sos PDI de Wikipedia in sa mapa b\'at bisòngiu de mapas agiuntivas.
\ No newline at end of file
diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml
index c39c5c8ae4..a4b12ef2d2 100644
--- a/OsmAnd/res/values-sk/strings.xml
+++ b/OsmAnd/res/values-sk/strings.xml
@@ -3392,7 +3392,7 @@ Zodpovedá oblasti: %1$s x %2$s
Pridať nadpis
Pridať nadpis ku každému bodu trasy pri zázname.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Osobné
Sťahujem %s
Hrubé
diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml
index 508ec9d421..e06ef3099b 100644
--- a/OsmAnd/res/values-sl/strings.xml
+++ b/OsmAnd/res/values-sl/strings.xml
@@ -3275,7 +3275,7 @@ Koda predstavlja območje: %1$s x %2$s
Vključi glavo
Shrani glavo k vsaki točki sledi med beleženjem.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Osebno
Poteka prejemanje %s
Debelo
diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml
index fd91d02cf6..2f2a240c0e 100644
--- a/OsmAnd/res/values-sr/strings.xml
+++ b/OsmAnd/res/values-sr/strings.xml
@@ -3402,7 +3402,7 @@
Укључи заглавље
Сачувај заглавље свакој тачки праћења приликом снимања.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Лични
Преузимам %s
Дебело
diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml
index ad5d44860f..ee1efe89ed 100644
--- a/OsmAnd/res/values-tr/strings.xml
+++ b/OsmAnd/res/values-tr/strings.xml
@@ -3360,7 +3360,7 @@
Başlığı dahil et
Kayıt sırasında her izleme noktasına başlığı kaydet.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Kişisel
%s indiriliyor
Kalın
@@ -3574,7 +3574,24 @@
Diller
Dil
Tüm diller
- Bazı Wikipedia makaleleri adınızda bulunmayabilir, Wikipedia makalelerinin haritada görüneceği dilleri seçin.
-\nMakaleyi okurken mevcut tüm diller arasında geçiş yapabileceksiniz.
Wikipedia POI\'lerini haritada görüntülemek için ek haritalara ihtiyaç vardır.
+ Çekmece ögeleri, içerik menüsü
+ Çekmece
+ Gizlendikten sonra ayarlar orijinal durumuna sıfırlanacaktır.
+ Ögeler
+ Çekmecedeki ögelerin sayısını özelleştirin, haritayı ve içerik menüsünü yapılandırın.
+\n
+\n%1$s uygulamasından tüm denetimlerini gizlemek için kullanılmayan eklentileri devre dışı bırakabilirsiniz.
+ Kullanıcı Arayüzü Özelleştirme
+ İçerik menüsü eylemleri
+ %1$s\'den ögeleri yeniden sırala veya gizle.
+ Bölücü
+ Bu noktanın altındaki ögeler bir bölücü ile ayrılır.
+ Gizli
+ Bu ögeler menüden gizlenir, ancak temsil edilen seçenekler veya eklentiler hala çalışır.
+ Ana eylemler sadece 4 düğme içerir.
+ Ana eylemler
+ Bu eylemlere “Eylemler” düğmesine dokunarak erişebilirsiniz.
+ Ögeleri yalnızca bu kategorinin içine taşıyabilirsiniz.
+ Geliştirici Eklentisi
\ No newline at end of file
diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml
index ae2be2cdce..1a4d5018e6 100644
--- a/OsmAnd/res/values-uk/strings.xml
+++ b/OsmAnd/res/values-uk/strings.xml
@@ -3395,7 +3395,7 @@
Зберегти заголовок
Зберегти заголовок для кожної точки треку під час запису.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Особистий
Завантаження %s
Товсто
@@ -3610,7 +3610,5 @@
Мови
Мова
Усі мови
- Деякі статті у Вікіпедії можуть бути недоступними для Вашої мови, виберіть мови, якими статті на Вікіпедії будуть відображатися на мапі.
-\nВи зможете перемикатися між усіма доступними мовами під час читання статті.
Для перегляду POI Вікіпедії на мапі потрібні додаткові мапи.
\ No newline at end of file
diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml
index 4a04c6d726..77461da3ac 100644
--- a/OsmAnd/res/values-zh-rTW/strings.xml
+++ b/OsmAnd/res/values-zh-rTW/strings.xml
@@ -3395,7 +3395,7 @@
包含標題
在記錄時將標題儲存到每個追蹤點。
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
個人
正在下載 %s
密集
@@ -3610,7 +3610,24 @@
語言
語言
所有語言
- 某些維基百科文章可能無法以您的名稱提供,選取維基百科文章要在地圖上顯示何種語言。
-\n您可以在閱讀文章時切換到所有可用的語言。
需要額外的地圖才能在地圖上檢視維基百科的 POI。
+ 在「抽屜」、「設定地圖」與情境選單中自訂項目數量。
+\n
+\n您可以停用未使用的外掛程式,以從應用程式 %1$s 中隱藏其控制元件。
+ 抽屜項目,情境選單
+ 自訂使用者介面
+ 抽屜
+ 情境選單動作
+ 重新排列或從 %1$s 隱藏項目。
+ 分隔符
+ 低於此點的元素將由分隔符分離。
+ 已隱藏
+ 這些項目已從選單隱藏,但對應的選項或外掛程式仍在運作中。
+ 隱藏後,設定將會重設回原始狀態。
+ 主要動作僅包含 4 個按鈕。
+ 主要動作
+ 您可以透過輕點「動作」按鈕來存取此動作。
+ 您只能在此分類中移動項目。
+ 開發者外掛程式
+ 項目
\ No newline at end of file
diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml
index 9f6bb135b3..39e8847cc5 100644
--- a/OsmAnd/res/values/sizes.xml
+++ b/OsmAnd/res/values/sizes.xml
@@ -71,6 +71,7 @@
24dp
40dp
+ 66dp
10dp
13dp
16dp
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index a64946ae69..f0cf546a76 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -13,8 +13,37 @@
-->
Combine POI types from different categories. Tap switch to select all, tap left side to category selection.
Search poi types
+ Custom color
+ Lombard
+ Aragonese
+ Bashkir
+ Bavarian
+ Chechen
+ Chuvash
+ Gujarati
+ Javanese
+ Kazakh
+ Kyrgyz
+ Malagasy
+ Minangkabau
+ Mongolian
+ Burmese
+ Neapolitan
+ Nepali
+ Punjabi
+ Sicilian
+ Scots
+ Tajik
+ Tatar
+ Urdu
+ Uzbek
+ Waray
+ Yoruba
+ Southern Min
+ Cantonese
+ Some Wikipedia articles may not be available in your language.
+ Select the languages in which Wikipedia articles will appear on the map. You can switch between all available languages while reading the article.
Additional maps are needed to view Wikipedia POIs on the map.
- Some Wikipedia articles may not be available in your name, select the languages in which Wikipedia articles will appear on the map.\nYou will be able to switch between all available languages while reading the article.
All languages
Language
Languages
@@ -218,7 +247,7 @@
Edit profiles
The \'Navigation type\' governs how routes are calculated.
%1$s • %2$s
- %1$s, %2$s
+ %1$s, %2$s
Personal
Add the new profile \'%1$s\'?
Include heading
diff --git a/OsmAnd/src/net/osmand/data/FavouritePoint.java b/OsmAnd/src/net/osmand/data/FavouritePoint.java
index e735b54de1..f13872fa02 100644
--- a/OsmAnd/src/net/osmand/data/FavouritePoint.java
+++ b/OsmAnd/src/net/osmand/data/FavouritePoint.java
@@ -77,7 +77,11 @@ public class FavouritePoint implements Serializable, LocationPoint {
}
public int getColor() {
- return color;
+ if ((color & 0xFF000000) != 0) {
+ return color;
+ } else {
+ return color | 0xFF000000;
+ }
}
public String getAddress() {
diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
index a61083d7d2..ca8b6ad8f0 100644
--- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
+++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
@@ -1,5 +1,6 @@
package net.osmand.plus;
+import android.app.Activity;
import android.content.Context;
import androidx.annotation.NonNull;
@@ -101,7 +102,11 @@ public class FavouritesDbHelper {
}
public int getColor() {
- return color;
+ if ((color & 0xFF000000) != 0) {
+ return color;
+ } else {
+ return color | 0xFF000000;
+ }
}
public boolean isVisible() {
@@ -354,7 +359,7 @@ public class FavouritesDbHelper {
}
}
- public static AlertDialog.Builder checkDuplicates(FavouritePoint p, FavouritesDbHelper fdb, Context uiContext) {
+ public static AlertDialog.Builder checkDuplicates(FavouritePoint p, FavouritesDbHelper fdb, Activity activity) {
boolean emoticons = false;
String index = "";
int number = 0;
@@ -383,12 +388,15 @@ public class FavouritesDbHelper {
}
}
if ((index.length() > 0 || emoticons)) {
- AlertDialog.Builder builder = new AlertDialog.Builder(uiContext);
+ OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.fav_point_dublicate);
if (emoticons) {
- builder.setMessage(uiContext.getString(R.string.fav_point_emoticons_message, name));
+ builder.setMessage(activity.getString(R.string.fav_point_emoticons_message, name));
} else {
- builder.setMessage(uiContext.getString(R.string.fav_point_dublicate_message, name));
+ builder.setMessage(activity.getString(R.string.fav_point_dublicate_message, name));
}
p.setName(name);
return builder;
diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java
index ea79ae6eae..e624a07cd9 100644
--- a/OsmAnd/src/net/osmand/plus/UiUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java
@@ -4,7 +4,6 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
-import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
@@ -39,6 +38,7 @@ import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
import androidx.core.widget.TintableCompoundButton;
+import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.snackbar.SnackbarContentLayout;
@@ -51,8 +51,6 @@ import net.osmand.plus.widgets.TextViewEx;
import org.apache.commons.logging.Log;
-import java.util.Locale;
-
import gnu.trove.map.hash.TLongObjectHashMap;
public class UiUtilities {
@@ -414,6 +412,9 @@ public class UiUtilities {
actionView.setGravity(Gravity.CENTER_VERTICAL | Gravity.END);
container.setLayoutParams(params);
}
+ try {
+ snackbar.setAnimationMode(BaseTransientBottomBar.ANIMATION_MODE_FADE);
+ } catch (Throwable e) { }
}
public static void rotateImageByLayoutDirection(ImageView image, int layoutDirection) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
index ae48f7cca7..3347241e65 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
@@ -5,7 +5,6 @@ package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Intent;
-import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
@@ -29,6 +28,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
@@ -200,8 +200,8 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
- LayoutInflater inflater = activity.getLayoutInflater();
- row = inflater.inflate(R.layout.favorites_list_item, parent, false);
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ row = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorites_list_item, parent, false);
}
TextView name = (TextView) row.findViewById(R.id.favourite_label);
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
index 405e6e4ed8..826a2383ac 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
@@ -840,7 +840,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
int color = model.getColor() == 0 || model.getColor() == Color.BLACK ? getResources().getColor(R.color.color_favorite) : model.getColor();
if (!model.isPersonal()) {
setCategoryIcon(app, app.getUIUtilities().getPaintedIcon(
- R.drawable.ic_action_fav_dark, visible ? (color | 0xff000000) : getResources().getColor(disabledColor)),
+ R.drawable.ic_action_folder, visible ? color : getResources().getColor(disabledColor)),
groupPosition, isExpanded, row, light);
}
adjustIndicator(app, groupPosition, isExpanded, row, light);
@@ -955,7 +955,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
name.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor));
distanceText.setText(distance);
if (model.isAddressSpecified()) {
- distanceText.setText(String.format(getString(R.string.ltr_or_rtl_combine_via_bold_point), distance.trim(), model.getAddress()));
+ distanceText.setText(String.format(getString(R.string.ltr_or_rtl_combine_via_comma), distance.trim(), model.getAddress()));
}
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(),
visible ? model.getColor() : getResources().getColor(disabledIconColor), false, model));
diff --git a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/simpleitems/DividerItem.java b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/simpleitems/DividerItem.java
index 5f8fc47638..03f401f79c 100644
--- a/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/simpleitems/DividerItem.java
+++ b/OsmAnd/src/net/osmand/plus/base/bottomsheetmenu/simpleitems/DividerItem.java
@@ -17,6 +17,11 @@ public class DividerItem extends BaseBottomSheetItem {
@ColorRes
private int colorId;
+ private int topMargin = INVALID_VALUE;
+ private int bottomMargin = INVALID_VALUE;
+ private int startMargin = INVALID_VALUE;
+ private int endMargin = INVALID_VALUE;
+
public DividerItem(Context context) {
setupView(context, INVALID_ID, INVALID_POSITION);
}
@@ -42,7 +47,8 @@ public class DividerItem extends BaseBottomSheetItem {
int height = getHeight(context);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view.getLayoutParams();
- AndroidUtils.setMargins(params, getStartMargin(context), getTopMargin(context), 0, getBottomMargin(context));
+ AndroidUtils.setMargins(params, getStartMargin(context),
+ getTopMargin(context), getEndMargin(context), getBottomMargin(context));
params.height = height;
view.setMinimumHeight(height);
@@ -50,15 +56,28 @@ public class DividerItem extends BaseBottomSheetItem {
}
protected int getTopMargin(Context context) {
- return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
+ return topMargin != INVALID_VALUE ? topMargin :
+ context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
}
protected int getStartMargin(Context context) {
- return 0;
+ return startMargin != INVALID_VALUE ? startMargin : 0;
}
protected int getBottomMargin(Context context) {
- return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
+ return bottomMargin != INVALID_VALUE ? bottomMargin :
+ context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
+ }
+
+ protected int getEndMargin(Context context) {
+ return endMargin != INVALID_VALUE ? endMargin : 0;
+ }
+
+ public void setMargins(int start, int top, int end, int bottom) {
+ this.startMargin = start;
+ this.topMargin = top;
+ this.endMargin = end;
+ this.bottomMargin = bottom;
}
protected int getHeight(Context ctx) {
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java
index c9ee6a331c..224226f818 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java
@@ -249,9 +249,10 @@ public class ConfigureMapMenu {
WikipediaPoiMenu.toggleWikipediaPoi(ma, isChecked, true,
new CallbackWithObject() {
@Override
- public boolean processResult(Boolean result) {
- item.setSelected(result);
- item.setColorRes(result ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
+ public boolean processResult(Boolean selected) {
+ item.setSelected(selected);
+ item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
+ item.setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(ma.getMyApplication()) : null);
adapter.notifyDataSetChanged();
return true;
}
@@ -551,6 +552,7 @@ public class ConfigureMapMenu {
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(WIKIPEDIA_ID)
.setTitleId(R.string.shared_string_wikipedia, activity)
+ .setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(app) : null)
.setSelected(selected)
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setIcon(R.drawable.ic_plugin_wikipedia)
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java
index 5945bfcd7a..3924bcdcb8 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java
@@ -29,6 +29,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter;
import net.osmand.plus.activities.MapActivity;
@@ -41,6 +42,8 @@ public class FavoriteDialogs {
public static Dialog createReplaceFavouriteDialog(final Activity activity, final Bundle args) {
OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
final FavouritesDbHelper helper = app.getFavorites();
final List points = new ArrayList(helper.getFavouritePoints());
final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(activity, points,false);
@@ -56,15 +59,18 @@ public class FavoriteDialogs {
favouritesAdapter.sortByDefault(true);
if(points.size() == 0){
- Toast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
+ Toast.makeText(themedContext, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
return null;
}
- return showFavoritesDialog(activity, favouritesAdapter, click, null, dlgHolder, true);
+ return showFavoritesDialog(themedContext, favouritesAdapter, click, null, dlgHolder, true);
}
private static void confirmReplace(final Activity activity, final Bundle args, final FavouritesDbHelper helper,
final FavouritesAdapter favouritesAdapter, final Dialog[] dlgHolder, int position) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.update_existing);
final FavouritePoint fp = favouritesAdapter.getItem(position);
builder.setMessage(activity.getString(R.string.replace_favorite_confirmation, fp.getName()));
@@ -111,10 +117,13 @@ public class FavoriteDialogs {
}
public static Dialog createAddFavouriteDialog(final Activity activity, final Bundle args) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ final Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.favourites_context_menu_edit);
- final View v = activity.getLayoutInflater().inflate(R.layout.favorite_edit_dialog, null, false);
- final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
+ final View v = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_edit_dialog, null, false);
+ final FavouritesDbHelper helper = app.getFavorites();
builder.setView(v);
final EditText editText = (EditText) v.findViewById(R.id.Name);
final EditText description = (EditText) v.findViewById(R.id.description);
@@ -125,15 +134,14 @@ public class FavoriteDialogs {
list[i] = gs.get(i).getName();
}
cat.setAdapter(new ArrayAdapter(activity, R.layout.list_textview, list));
-
- if (((OsmandApplication)activity.getApplication()).accessibilityEnabled()) {
+ if (app.accessibilityEnabled()) {
final TextView textButton = (TextView)v.findViewById(R.id.TextButton);
textButton.setClickable(true);
textButton.setFocusable(true);
textButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- AlertDialog.Builder b = new AlertDialog.Builder(activity);
+ AlertDialog.Builder b = new AlertDialog.Builder(themedContext);
b.setTitle(R.string.access_category_choice);
b.setItems(list, new DialogInterface.OnClickListener() {
@Override
@@ -165,7 +173,6 @@ public class FavoriteDialogs {
@Override
public void onClick(DialogInterface dialog, int which) {
final FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE);
- OsmandApplication app = (OsmandApplication) activity.getApplication();
String categoryStr = cat.getText().toString().trim();
final FavouritesDbHelper helper = app.getFavorites();
app.getSettings().LAST_FAV_CATEGORY_ENTERED.set(categoryStr);
diff --git a/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java b/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java
index c9c2b03434..85771650e3 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/ColorDialogs.java
@@ -1,12 +1,9 @@
package net.osmand.plus.helpers;
-import android.app.Activity;
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
-import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -15,7 +12,7 @@ import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
-import androidx.annotation.ColorRes;
+import androidx.annotation.ColorInt;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@@ -26,7 +23,7 @@ import java.util.Random;
import gnu.trove.list.array.TIntArrayList;
-import static android.util.TypedValue.COMPLEX_UNIT_DIP;
+import static net.osmand.AndroidUtils.dpToPx;
public class ColorDialogs {
public static int[] paletteColors = new int[] {
@@ -45,17 +42,17 @@ public class ColorDialogs {
};
public static int[] pallette = new int[] {
- 0xb4eecc22,
- 0xb4d00d0d,
- 0xb4ff5020,
- 0xb4eeee10,
- 0xb488e030,
- 0xb400842b,
- 0xb410c0f0,
- 0xb41010a0,
- 0xb4a71de1,
- 0xb4e044bb,
- 0xb48e2512,
+ 0xffeecc22,
+ 0xffd00d0d,
+ 0xffff5020,
+ 0xffeeee10,
+ 0xff88e030,
+ 0xff00842b,
+ 0xff10c0f0,
+ 0xff1010a0,
+ 0xffa71de1,
+ 0xffe044bb,
+ 0xff8e2512,
0xff000001
};
@@ -171,8 +168,8 @@ public class ColorDialogs {
colorSpinner.setSelection(selection);
}
- public static void setupColorSpinnerEx(final Activity ctx, int selectedColor, final Spinner colorSpinner,
- final TIntArrayList colors, OnItemSelectedListener listener) {
+ public static void setupColorSpinnerEx(final Context ctx, int selectedColor, final Spinner colorSpinner,
+ final TIntArrayList colors, OnItemSelectedListener listener) {
colors.add(pallette);
List colorNames = new ArrayList();
int selection = -1;
@@ -237,16 +234,15 @@ public class ColorDialogs {
return "#" + c; //$NON-NLS-1$
}
- private static Drawable getIcon(final Activity activity, int resId, int color) {
- OsmandApplication app = (OsmandApplication)activity.getApplication();
- Drawable d = app.getResources().getDrawable(resId).mutate();
+ private static Drawable getIcon(final Context ctx, int resId, int color) {
+ Drawable d = ctx.getResources().getDrawable(resId).mutate();
d.clearColorFilter();
d.setColorFilter(color, PorterDuff.Mode.SRC_IN);
return d;
}
- public static int getColorName(@ColorRes int color) {
- int colorName = R.string.rendering_value_darkyellow_name;
+ public static int getColorName(@ColorInt int color) {
+ int colorName = R.string.custom_color;
for (int i = 0; i < ColorDialogs.pallette.length; i++) {
if (ColorDialogs.pallette[i] == color) {
colorName = ColorDialogs.paletteColors[i];
@@ -256,12 +252,14 @@ public class ColorDialogs {
return colorName;
}
- private static int dpToPx(final Activity activity, float dp) {
- Resources r = activity.getResources();
- return (int) TypedValue.applyDimension(
- COMPLEX_UNIT_DIP,
- dp,
- r.getDisplayMetrics()
- );
+ public static boolean isPaletteColor(@ColorInt int color) {
+ boolean isPaletteColor = false;
+ for (int i = 0; i < ColorDialogs.pallette.length; i++) {
+ if (ColorDialogs.pallette[i] == color) {
+ isPaletteColor = true;
+ break;
+ }
+ }
+ return isPaletteColor;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxTrackAdapter.java b/OsmAnd/src/net/osmand/plus/helpers/GpxTrackAdapter.java
index 5579414293..ab52559b28 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/GpxTrackAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/GpxTrackAdapter.java
@@ -1,6 +1,6 @@
package net.osmand.plus.helpers;
-import android.app.Activity;
+import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -15,6 +15,7 @@ import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities;
import net.osmand.IndexConstants;
import net.osmand.plus.GPXDatabase;
+import net.osmand.plus.GpxDbHelper;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@@ -35,14 +36,11 @@ public class GpxTrackAdapter extends RecyclerView.Adapter gpxInfoList, boolean showCurrentGpx,
- OnItemClickListener onItemClickListener) {
+ GpxTrackAdapter(Context ctx, List gpxInfoList, boolean showCurrentGpx) {
this.showCurrentGpx = showCurrentGpx;
- this.onItemClickListener = onItemClickListener;
- app = (OsmandApplication) activity.getApplication();
+ app = (OsmandApplication) ctx.getApplicationContext();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
- themedInflater = UiUtilities.getInflater(activity, nightMode);
+ themedInflater = UiUtilities.getInflater(ctx, nightMode);
this.gpxInfoList = gpxInfoList;
iconsCache = app.getUIUtilities();
}
@@ -123,8 +121,26 @@ public class GpxTrackAdapter extends RecyclerView.Adapter callbackWithObject) {
+ public static void selectSingleGPXFile(final FragmentActivity activity, boolean showCurrentGpx,
+ final CallbackWithObject callbackWithObject) {
OsmandApplication app = (OsmandApplication) activity.getApplication();
int gpxDirLength = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath().length();
List selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
@@ -279,11 +278,8 @@ public class GpxUiHelper {
list.add(new GPXInfo(gpxFile.path.substring(gpxDirLength + 1), gpxFile.modifiedTime, 0));
}
}
-
- final ContextMenuAdapter adapter = createGpxContextMenuAdapter(list, null, showCurrentGpx, app);
- return createSingleChoiceDialog(activity, showCurrentGpx, callbackWithObject, list, adapter);
+ SelectGpxTrackBottomSheet.showInstance(activity.getSupportFragmentManager(), showCurrentGpx, callbackWithObject, list);
}
- return null;
}
private static ContextMenuAdapter createGpxContextMenuAdapter(List allGpxList,
@@ -351,65 +347,6 @@ public class GpxUiHelper {
}, dir, null, filename);
}
- private static AlertDialog createSingleChoiceDialog(final Activity activity,
- final boolean showCurrentGpx,
- final CallbackWithObject callbackWithObject,
- final List list,
- final ContextMenuAdapter adapter) {
- final OsmandApplication app = (OsmandApplication) activity.getApplication();
- boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
- final View customLayout = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.gpx_track_select_dialog, null);
- AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
- builder.setView(customLayout);
- final AlertDialog dlg = builder.create();
- View cancelButton = customLayout.findViewById(R.id.dismiss_button);
- UiUtilities.setupDialogButton(nightMode, cancelButton, UiUtilities.DialogButtonType.SECONDARY, R.string.shared_string_cancel);
- TextView gpxCounter = customLayout.findViewById(R.id.counter);
- gpxCounter.setText(String.valueOf(adapter.length()));
- GpxTrackAdapter gpxTrackAdapter = new GpxTrackAdapter(activity, list, showCurrentGpx,
- new GpxTrackAdapter.OnItemClickListener() {
- @Override
- public void onItemClick(int position) {
- if (position != -1 && position < list.size()) {
- if (showCurrentGpx && position == 0) {
- callbackWithObject.processResult(null);
- app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(null);
- } else {
- String fileName = list.get(position).getFileName();
- app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(fileName);
- SelectedGpxFile selectedGpxFile =
- app.getSelectedGpxHelper().getSelectedFileByName(fileName);
- if (selectedGpxFile != null) {
- callbackWithObject.processResult(new GPXUtilities.GPXFile[]{selectedGpxFile.getGpxFile()});
- } else {
- File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
- GpxUiHelper.loadGPXFileInDifferentThread(activity, callbackWithObject, dir, null, fileName);
- }
- }
- }
- dlg.dismiss();
- }
- });
- RecyclerView recyclerView = customLayout.findViewById(R.id.gpx_track_list);
- recyclerView.setAdapter(gpxTrackAdapter);
- recyclerView.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.VERTICAL, false));
- dlg.setCanceledOnTouchOutside(false);
- dlg.show();
- cancelButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- dlg.dismiss();
- }
- });
- try {
- dlg.getListView().setFastScrollEnabled(true);
- } catch (Exception e) {
- // java.lang.ClassCastException: com.android.internal.widget.RoundCornerListAdapter
- // Unknown reason but on some devices fail
- }
- return dlg;
- }
-
private static class DialogGpxDataItemCallback implements GpxDataItemCallback {
private static final int UPDATE_GPX_ITEM_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 6;
private static final long MIN_UPDATE_INTERVAL = 500;
diff --git a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
index 68181d3797..084e58ae08 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
@@ -31,6 +31,7 @@ import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.FavouritePoint;
+import net.osmand.data.FavouritePoint.BackgroundType;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.AppInitializer.AppInitializeListener;
import net.osmand.plus.AppInitializer.InitEvents;
@@ -1181,6 +1182,7 @@ public class ImportHelper {
}
fp.setColor(p.getColor(0));
fp.setIconIdFromName(app, p.getIconName());
+ fp.setBackgroundType(BackgroundType.getByTypeName(p.getBackgroundType(), BackgroundType.CIRCLE));
favourites.add(fp);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java b/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java
new file mode 100644
index 0000000000..be1dfcd63d
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java
@@ -0,0 +1,112 @@
+package net.osmand.plus.helpers;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.appcompat.view.ContextThemeWrapper;
+import androidx.fragment.app.FragmentManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import net.osmand.CallbackWithObject;
+import net.osmand.GPXUtilities;
+import net.osmand.IndexConstants;
+import net.osmand.plus.GpxSelectionHelper;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.plus.base.MenuBottomSheetDialogFragment;
+import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
+
+import java.io.File;
+import java.util.List;
+
+public class SelectGpxTrackBottomSheet extends MenuBottomSheetDialogFragment {
+
+ public static final String TAG = SelectGpxTrackBottomSheet.class.getSimpleName();
+
+ protected View mainView;
+ protected GpxTrackAdapter adapter;
+ private List gpxInfoList;
+ private boolean showCurrentGpx;
+ private CallbackWithObject callbackWithObject;
+
+ private void setGpxInfoList(List gpxInfoList) {
+ this.gpxInfoList = gpxInfoList;
+ }
+
+ private void setShowCurrentGpx(boolean showCurrentGpx) {
+ this.showCurrentGpx = showCurrentGpx;
+ }
+
+ private void setCallbackWithObject(CallbackWithObject callbackWithObject) {
+ this.callbackWithObject = callbackWithObject;
+ }
+
+ @Override
+ public void createMenuItems(Bundle savedInstanceState) {
+ final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
+ mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
+ R.layout.gpx_track_select_dialog, null);
+
+ final RecyclerView recyclerView = mainView.findViewById(R.id.gpx_track_list);
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+ adapter = new GpxTrackAdapter(requireContext(), gpxInfoList, showCurrentGpx);
+ adapter.setAdapterListener(new GpxTrackAdapter.OnItemClickListener() {
+ @Override
+ public void onItemClick(int position) {
+ if (position != RecyclerView.NO_POSITION) {
+ SelectGpxTrackBottomSheet.this.onItemClick(position);
+ }
+ }
+ });
+ recyclerView.setAdapter(adapter);
+ TextView gpxCounter = mainView.findViewById(R.id.counter);
+ gpxCounter.setText(String.valueOf(adapter.getItemCount()));
+ items.add(new BaseBottomSheetItem.Builder().setCustomView(mainView).create());
+ }
+
+ private void onItemClick(int position) {
+ if (position != -1 && position < gpxInfoList.size()) {
+ OsmandApplication app = (OsmandApplication) requireActivity().getApplication();
+ if (showCurrentGpx && position == 0) {
+ callbackWithObject.processResult(null);
+ app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(null);
+ } else {
+ String fileName = gpxInfoList.get(position).getFileName();
+ app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(fileName);
+ GpxSelectionHelper.SelectedGpxFile selectedGpxFile =
+ app.getSelectedGpxHelper().getSelectedFileByName(fileName);
+ if (selectedGpxFile != null) {
+ callbackWithObject.processResult(new GPXUtilities.GPXFile[]{selectedGpxFile.getGpxFile()});
+ } else {
+ File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
+ Activity activity = getActivity();
+ if (activity != null) {
+ GpxUiHelper.loadGPXFileInDifferentThread(activity, callbackWithObject, dir, null, fileName);
+ }
+ }
+ }
+ }
+ dismiss();
+ }
+
+ public static void showInstance(FragmentManager fragmentManager, boolean showCurrentGpx,
+ CallbackWithObject callbackWithObject, List gpxInfoList) {
+ if (!fragmentManager.isStateSaved()) {
+ SelectGpxTrackBottomSheet fragment = new SelectGpxTrackBottomSheet();
+ fragment.setUsedOnMap(true);
+ fragment.setRetainInstance(true);
+ fragment.setShowCurrentGpx(showCurrentGpx);
+ fragment.setCallbackWithObject(callbackWithObject);
+ fragment.setGpxInfoList(gpxInfoList);
+ fragment.show(fragmentManager, SelectGpxTrackBottomSheet.TAG);
+ }
+ }
+
+ @Override
+ protected int getDismissButtonTextId() {
+ return R.string.shared_string_cancel;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 57717e57eb..ab8f716b4f 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -88,6 +88,7 @@ import java.util.List;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MORE_ID;
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
+import static net.osmand.plus.settings.ConfigureMenuItemsFragment.MAIN_BUTTONS_QUANTITY;
public class MapContextMenuFragment extends BaseOsmAndFragment implements DownloadEvents {
@@ -566,11 +567,16 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
// Action buttons
// TODO refactor section
ContextMenuAdapter adapter = menu.getActionsContextMenuAdapter(false);
- List items = adapter.getItems();
+ List items = new ArrayList<>();
+ for (ContextMenuItem item : adapter.getItems()) {
+ if (!item.isHidden()) {
+ items.add(item);
+ }
+ }
ContextMenuAdapter mainAdapter = new ContextMenuAdapter(requireMyApplication());
ContextMenuAdapter additionalAdapter = new ContextMenuAdapter(requireMyApplication());
for (int i = 0; i < items.size(); i++) {
- if (i < 4) {
+ if (i < MAIN_BUTTONS_QUANTITY) {
mainAdapter.addItem(items.get(i));
} else {
additionalAdapter.addItem(items.get(i));
@@ -585,7 +591,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
ContextMenuItemClickListener mainListener = menu.getContextMenuItemClickListener(mainAdapter);
ContextMenuItemClickListener additionalListener = menu.getContextMenuItemClickListener(additionalAdapter);
- for (int i = 0; i < 4; i++) {
+ int mainButtonsQuantity = Math.min(MAIN_BUTTONS_QUANTITY, items.size());
+ for (int i = 0; i < mainButtonsQuantity; i++) {
buttons.addView(getActionView(items.get(i), i, mainAdapter, additionalAdapter, mainListener, additionalListener), params);
}
buttons.setGravity(Gravity.CENTER);
@@ -648,11 +655,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
private View getActionView(ContextMenuItem contextMenuItem,
- final int position,
- final ContextMenuAdapter mainAdapter,
- final ContextMenuAdapter additionalAdapter,
- final ContextMenuItemClickListener mainListener,
- final ContextMenuItemClickListener additionalListener) {
+ final int position,
+ final ContextMenuAdapter mainAdapter,
+ final ContextMenuAdapter additionalAdapter,
+ final ContextMenuItemClickListener mainListener,
+ final ContextMenuItemClickListener additionalListener) {
UiUtilities uiUtilities = requireMyApplication().getUIUtilities();
LayoutInflater inflater = UiUtilities.getInflater(getMyApplication(), nightMode);
View view = inflater.inflate(R.layout.context_menu_action_item, null);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
index 702fcaa7c9..1e381b63cd 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
@@ -43,6 +43,7 @@ import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
import net.osmand.plus.wikipedia.WikiArticleHelper;
import net.osmand.plus.wikipedia.WikipediaArticleWikiLinkFragment;
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
+import net.osmand.plus.wikipedia.WikipediaPoiMenu;
import net.osmand.util.Algorithms;
import net.osmand.util.OpeningHoursParser;
@@ -404,7 +405,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (amenity.getType().isWiki()) {
if (!hasWiki) {
- String lng = amenity.getContentLanguage("content", preferredLang, "en");
+ String articleLang = WikipediaPoiMenu.getWikiArticleLanguage(app, amenity.getSupportedContentLocales(), preferredLang);
+ String lng = amenity.getContentLanguage("content", articleLang, "en");
if (Algorithms.isEmpty(lng)) {
lng = "en";
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/EditCategoryDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/EditCategoryDialogFragment.java
index bde846f1c0..f27e9066d6 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/EditCategoryDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/EditCategoryDialogFragment.java
@@ -20,6 +20,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.util.Algorithms;
@@ -69,10 +70,10 @@ public class EditCategoryDialogFragment extends DialogFragment {
} else if (getArguments() != null) {
restoreState(getArguments());
}
-
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.favorite_category_add_new_title);
- final View v = activity.getLayoutInflater().inflate(R.layout.favorite_category_edit_dialog, null, false);
+ final View v = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_edit_dialog, null, false);
nameEdit = (EditText)v.findViewById(R.id.edit_name);
nameEdit.setText(name);
@@ -81,7 +82,7 @@ public class EditCategoryDialogFragment extends DialogFragment {
colorSpinner = (Spinner)v.findViewById(R.id.edit_color);
final TIntArrayList colors = new TIntArrayList();
final int intColor = color;
- ColorDialogs.setupColorSpinnerEx(activity, intColor, colorSpinner, colors, new AdapterView.OnItemSelectedListener() {
+ ColorDialogs.setupColorSpinnerEx(v.getContext(), intColor, colorSpinner, colors, new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
color = colors.get(position);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
index ad4c170aa0..61c9c60ecd 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragmentNew.java
@@ -24,6 +24,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.FavoriteDialogs;
@@ -351,7 +352,9 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
FragmentActivity activity = getActivity();
final FavouritePoint favorite = getFavorite();
if (activity != null && favorite != null) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setMessage(getString(R.string.favourites_remove_dialog_msg, favorite.getName()));
builder.setNegativeButton(R.string.shared_string_no, null);
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
index e096f6282b..038ca18e56 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
@@ -1,5 +1,6 @@
package net.osmand.plus.mapcontextmenu.editors;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
@@ -10,6 +11,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@@ -22,7 +24,6 @@ import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.ColorInt;
-import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
@@ -65,7 +66,7 @@ import static net.osmand.util.Algorithms.capitalizeFirstLetter;
public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
- public static final String TAG = "PointEditorFragmentNew";
+ public static final String TAG = PointEditorFragmentNew.class.getSimpleName();
private View view;
private EditText nameEdit;
@@ -87,6 +88,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private View descriptionCaption;
private EditText descriptionEdit;
+ @SuppressLint("ClickableViewAccessibility")
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -95,6 +97,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
nightMode = app.getDaynightHelper().isNightModeForMapControls();
view = UiUtilities.getMaterialInflater(getContext(), nightMode)
.inflate(R.layout.point_editor_fragment_new, container, false);
+ AndroidUtils.addStatusBarPadding21v(getActivity(), view);
final PointEditor editor = getEditor();
if (editor == null) {
@@ -131,6 +134,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
if (scrollViewY != scrollView.getScrollY()) {
scrollViewY = scrollView.getScrollY();
hideKeyboard();
+ descriptionEdit.clearFocus();
+ nameEdit.clearFocus();
}
}
});
@@ -259,6 +264,23 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
createShapeSelector();
updateColorSelector(selectedColor, view);
updateShapeSelector(selectedShape, view);
+ scrollView.setOnTouchListener(new View.OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ descriptionEdit.getParent().requestDisallowInterceptTouchEvent(false);
+ return false;
+ }
+ });
+
+ descriptionEdit.setOnTouchListener(new View.OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ descriptionEdit.getParent().requestDisallowInterceptTouchEvent(true);
+ return false;
+ }
+ });
return view;
}
@@ -289,9 +311,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
for (int color : ColorDialogs.pallette) {
selectColor.addView(createColorItemView(color, selectColor), new FlowLayout.LayoutParams(0, 0));
}
+ int customColor = getPointColor();
+ if (!ColorDialogs.isPaletteColor(customColor)) {
+ selectColor.addView(createColorItemView(customColor, selectColor), new FlowLayout.LayoutParams(0, 0));
+ }
}
- private View createColorItemView(@ColorRes final int color, final FlowLayout rootView) {
+ private View createColorItemView(@ColorInt final int color, final FlowLayout rootView) {
FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
.inflate(R.layout.point_editor_button, rootView, false);
ImageView outline = colorItemView.findViewById(R.id.outline);
@@ -442,10 +468,11 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
IconCategoriesAdapter iconCategoriesAdapter = new IconCategoriesAdapter();
iconCategoriesAdapter.setItems(new ArrayList<>(iconCategories.keySet()));
- RecyclerView groupNameRecyclerView = view.findViewById(R.id.group_name_recycler_view);
- groupNameRecyclerView.setAdapter(iconCategoriesAdapter);
- groupNameRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
+ RecyclerView iconCategoriesRecyclerView = view.findViewById(R.id.group_name_recycler_view);
+ iconCategoriesRecyclerView.setAdapter(iconCategoriesAdapter);
+ iconCategoriesRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
iconCategoriesAdapter.notifyDataSetChanged();
+ iconCategoriesRecyclerView.scrollToPosition(iconCategoriesAdapter.getItemPosition(selectedIconCategory));
for (String name : iconNameList) {
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
}
@@ -562,7 +589,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
@Override
protected boolean isFullScreenAllowed() {
- return false;
+ return true;
}
private void hideKeyboard() {
@@ -625,6 +652,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
public void dismiss(boolean includingMenu) {
+ hideKeyboard();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (includingMenu) {
@@ -920,6 +948,10 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
public int getItemCount() {
return items.size();
}
+
+ int getItemPosition(String name) {
+ return items.indexOf(name);
+ }
}
static class NameViewHolder extends RecyclerView.ViewHolder {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java
index 2b9df31698..b95c8c4361 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java
@@ -70,26 +70,29 @@ public class SelectCategoryDialogFragment extends DialogFragment {
}
final FragmentActivity activity = requireActivity();
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.favorite_category_select);
- final View v = activity.getLayoutInflater().inflate(R.layout.favorite_categories_dialog, null, false);
+ final View v = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_categories_dialog, null, false);
LinearLayout ll = (LinearLayout) v.findViewById(R.id.list_container);
- final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
+ final FavouritesDbHelper helper = app.getFavorites();
if (gpxFile != null) {
if (gpxCategories != null) {
for (Map.Entry e : gpxCategories.entrySet()) {
String categoryName = e.getKey();
- addCategory(activity, ll, categoryName, e.getValue());
+ ll.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue()));
}
}
} else {
List gs = helper.getFavoriteGroups();
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
- addCategory(activity, ll, category.getDisplayName(getContext()), category.getColor());
+ ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
+ category.getColor()));
}
}
- View itemView = activity.getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
+ View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.map_zoom_in), null, null, null);
button.setCompoundDrawablePadding(AndroidUtils.dpToPx(activity,15f));
@@ -113,8 +116,8 @@ public class SelectCategoryDialogFragment extends DialogFragment {
return builder.create();
}
- private void addCategory(@NonNull final Activity activity, @NonNull LinearLayout ll, final String categoryName, final int categoryColor) {
- View itemView = activity.getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
+ private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor) {
+ View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
if (categoryColor != 0) {
button.setCompoundDrawablesWithIntrinsicBounds(
@@ -143,7 +146,7 @@ public class SelectCategoryDialogFragment extends DialogFragment {
dismiss();
}
});
- ll.addView(itemView);
+ return itemView;
}
public static SelectCategoryDialogFragment createInstance(String editorTag) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
index b38b2538f8..3b15fcb72d 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
@@ -11,6 +11,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
+import androidx.fragment.app.FragmentActivity;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
@@ -23,6 +24,7 @@ import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.base.FavoriteImageDrawable;
@@ -306,40 +308,45 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
@Override
protected void delete(final boolean needDismiss) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setMessage(getString(R.string.context_menu_item_delete_waypoint));
- builder.setNegativeButton(R.string.shared_string_no, null);
- builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- WptPt wpt = getWpt();
- WptPtEditor editor = getWptPtEditor();
- SavingTrackHelper savingTrackHelper = getSavingTrackHelper();
- if (wpt != null && editor != null && savingTrackHelper != null) {
- GPXFile gpx = editor.getGpxFile();
- if (gpx != null) {
- if (gpx.showCurrentTrack) {
- savingTrackHelper.deletePointData(wpt);
- } else {
- gpx.deleteWptPt(wpt);
- new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ FragmentActivity activity = getActivity();
+ if (activity != null) {
+ final OsmandApplication app = (OsmandApplication) activity.getApplication();
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
+ builder.setMessage(getString(R.string.context_menu_item_delete_waypoint));
+ builder.setNegativeButton(R.string.shared_string_no, null);
+ builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ WptPt wpt = getWpt();
+ WptPtEditor editor = getWptPtEditor();
+ SavingTrackHelper savingTrackHelper = getSavingTrackHelper();
+ if (wpt != null && editor != null && savingTrackHelper != null) {
+ GPXFile gpx = editor.getGpxFile();
+ if (gpx != null) {
+ if (gpx.showCurrentTrack) {
+ savingTrackHelper.deletePointData(wpt);
+ } else {
+ gpx.deleteWptPt(wpt);
+ new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }
+ syncGpx(gpx);
}
- syncGpx(gpx);
+ saved = true;
}
- saved = true;
- }
- if (needDismiss) {
- dismiss(true);
- } else {
- MapActivity mapActivity = getMapActivity();
- if (mapActivity != null) {
- mapActivity.refreshMap();
+ if (needDismiss) {
+ dismiss(true);
+ } else {
+ MapActivity mapActivity = getMapActivity();
+ if (mapActivity != null) {
+ mapActivity.refreshMap();
+ }
}
}
- }
- });
- builder.create().show();
+ });
+ builder.create().show();
+ }
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java
index 3c4a8be45e..b4c376f0cd 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java
@@ -68,6 +68,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.osmedit.OsmPoint.Action;
@@ -88,7 +89,7 @@ import java.util.Map.Entry;
import java.util.Set;
public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
- public static final String TAG = "EditPoiDialogFragment";
+ public static final String TAG = EditPoiDialogFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(EditPoiDialogFragment.class);
private static final String KEY_AMENITY_ENTITY = "key_amenity_entity";
@@ -159,7 +160,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
viewPager = (EditPoiViewPager) view.findViewById(R.id.viewpager);
String basicTitle = getResources().getString(R.string.tab_title_basic);
String extendedTitle = getResources().getString(R.string.tab_title_advanced);
- final MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
+ final PoiInfoPagerAdapter pagerAdapter = new PoiInfoPagerAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
viewPager.setAdapter(pagerAdapter);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
@@ -743,12 +744,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
- public static class MyAdapter extends FragmentPagerAdapter {
+ public static class PoiInfoPagerAdapter extends FragmentPagerAdapter {
private final Fragment[] fragments = new Fragment[]{new BasicEditPoiFragment(),
new AdvancedEditPoiFragment()};
private final String[] titles;
- public MyAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
+ PoiInfoPagerAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
super(fm);
titles = new String[]{basicTitle, extendedTitle};
}
@@ -778,7 +779,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
this.callback = callback;
}
- public DeletePoiHelper(AppCompatActivity activity) {
+ DeletePoiHelper(AppCompatActivity activity) {
this.activity = activity;
OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
@@ -804,12 +805,14 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, amenity);
}
- public void deletePoiWithDialog(final Entity entity) {
+ void deletePoiWithDialog(final Entity entity) {
+ boolean nightMode = ((OsmandApplication) activity.getApplication()).getDaynightHelper().isNightModeForMapControls();
+ Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
if (entity == null) {
- Toast.makeText(activity, activity.getResources().getString(R.string.poi_cannot_be_found), Toast.LENGTH_LONG).show();
+ Toast.makeText(themedContext, activity.getResources().getString(R.string.poi_cannot_be_found), Toast.LENGTH_LONG).show();
return;
}
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.poi_remove_title);
final EditText comment;
final CheckBox closeChangesetCheckBox;
@@ -818,13 +821,13 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
closeChangesetCheckBox = null;
comment = null;
} else {
- LinearLayout ll = new LinearLayout(activity);
+ LinearLayout ll = new LinearLayout(themedContext);
ll.setPadding(16, 2, 16, 0);
ll.setOrientation(LinearLayout.VERTICAL);
- closeChangesetCheckBox = new CheckBox(activity);
+ closeChangesetCheckBox = new CheckBox(themedContext);
closeChangesetCheckBox.setText(R.string.close_changeset);
ll.addView(closeChangesetCheckBox);
- comment = new EditText(activity);
+ comment = new EditText(themedContext);
comment.setText(R.string.poi_remove_title);
ll.addView(comment);
builder.setView(ll);
@@ -852,12 +855,16 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@Override
public boolean processResult(Entity result) {
if (result != null) {
- if (callback != null) {
- callback.poiDeleted();
- }
- if (isLocalEdit) {
- Toast.makeText(activity, R.string.osm_changes_added_to_local_edits,
- Toast.LENGTH_LONG).show();
+ OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
+ if (plugin != null && isLocalEdit) {
+ List points = plugin.getDBPOI().getOpenstreetmapPoints();
+ if (activity instanceof MapActivity && points.size() > 0) {
+ OsmPoint point = points.get(points.size() - 1);
+ MapActivity mapActivity = (MapActivity) activity;
+ mapActivity.getContextMenu().showOrUpdate(
+ new LatLon(point.getLatitude(), point.getLongitude()),
+ plugin.getOsmEditsLayer(mapActivity).getObjectName(point), point);
+ }
} else {
Toast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG)
.show();
@@ -865,6 +872,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
if (activity instanceof MapActivity) {
((MapActivity) activity).getMapView().refreshMap(true);
}
+ if (callback != null) {
+ callback.poiDeleted();
+ }
}
return false;
}
@@ -880,7 +890,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ Context themedContext = getActivity();
+ if (getParentFragment() instanceof EditPoiDialogFragment) {
+ themedContext = UiUtilities.getThemedContext(getActivity(),
+ ((EditPoiDialogFragment) getParentFragment()).isNightMode(true));
+ }
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
String msg = getString(R.string.save_poi_without_poi_type_message);
int i = getArguments().getInt("message", 0);
if(i != 0) {
@@ -903,7 +918,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ Context themedContext = getActivity();
+ if (getParentFragment() instanceof EditPoiDialogFragment) {
+ themedContext = UiUtilities.getThemedContext(getActivity(),
+ ((EditPoiDialogFragment) getParentFragment()).isNightMode(true));
+ }
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(getResources().getString(R.string.are_you_sure))
.setMessage(getString(R.string.unsaved_changes_will_be_lost))
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@@ -921,7 +941,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ Context themedContext = getActivity();
+ if (getParentFragment() instanceof EditPoiDialogFragment) {
+ themedContext = UiUtilities.getThemedContext(getActivity(),
+ ((EditPoiDialogFragment) getParentFragment()).isNightMode(true));
+ }
+ AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
String msg = getString(R.string.save_poi_value_exceed_length);
String fieldTag = getArguments().getString("tag", "");
if(!Algorithms.isEmpty(fieldTag)) {
diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java b/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java
index 8e8864af75..6994b2a20c 100644
--- a/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java
@@ -8,6 +8,7 @@ import net.osmand.osm.AbstractPoiType;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
+import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@@ -26,7 +27,6 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -313,17 +313,21 @@ public class PoiFiltersHelper {
return result;
}
- public Map getPoiFilterOrders(boolean onlyActive) {
- Map filterOrders = new HashMap<>();
- List sortedFilters = getSortedPoiFilters(onlyActive);
- for (PoiUIFilter filter : sortedFilters) {
- filterOrders.put(filter.getFilterId(), filter.getOrder());
+ public List getPoiFilterOrders(boolean onlyActive) {
+ List filterOrders = new ArrayList<>();
+ for (PoiUIFilter filter : getSortedPoiFilters(onlyActive)) {
+ filterOrders.add(filter.getFilterId());
}
return filterOrders;
}
public List getSortedPoiFilters(boolean onlyActive) {
- initPoiUIFiltersState();
+ ApplicationMode selectedAppMode = application.getSettings().getApplicationMode();
+ return getSortedPoiFilters(selectedAppMode, onlyActive);
+ }
+
+ public List getSortedPoiFilters(@NonNull ApplicationMode appMode, boolean onlyActive) {
+ initPoiUIFiltersState(appMode);
List allFilters = new ArrayList<>();
for (PoiUIFilter filter : getTopDefinedPoiFilters()) {
if (!filter.isWikiFilter()) {
@@ -345,13 +349,13 @@ public class PoiFiltersHelper {
}
}
- private void initPoiUIFiltersState() {
+ private void initPoiUIFiltersState(@NonNull ApplicationMode appMode) {
List allFilters = new ArrayList<>();
allFilters.addAll(getTopDefinedPoiFilters());
allFilters.addAll(getSearchPoiFilters());
- refreshPoiFiltersActivation(allFilters);
- refreshPoiFiltersOrder(allFilters);
+ refreshPoiFiltersActivation(appMode, allFilters);
+ refreshPoiFiltersOrder(appMode, allFilters);
//set up the biggest order to custom filter
PoiUIFilter customFilter = getCustomPOIFilter();
@@ -359,8 +363,9 @@ public class PoiFiltersHelper {
customFilter.setOrder(allFilters.size());
}
- private void refreshPoiFiltersOrder(List filters) {
- Map orders = getPoiFiltersOrder();
+ private void refreshPoiFiltersOrder(@NonNull ApplicationMode appMode,
+ List filters) {
+ Map orders = getPoiFiltersOrder(appMode);
List existedFilters = new ArrayList<>();
List newFilters = new ArrayList<>();
if (orders != null) {
@@ -392,8 +397,9 @@ public class PoiFiltersHelper {
}
}
- private void refreshPoiFiltersActivation(List filters) {
- List inactiveFiltersIds = getInactivePoiFiltersIds();
+ private void refreshPoiFiltersActivation(@NonNull ApplicationMode appMode,
+ List filters) {
+ List inactiveFiltersIds = getInactivePoiFiltersIds(appMode);
if (inactiveFiltersIds != null) {
for (PoiUIFilter filter : filters) {
filter.setActive(!inactiveFiltersIds.contains(filter.getFilterId()));
@@ -405,16 +411,16 @@ public class PoiFiltersHelper {
}
}
- public void saveFiltersOrder(List filterIds) {
- application.getSettings().POI_FILTERS_ORDER.setStringsList(filterIds);
+ public void saveFiltersOrder(ApplicationMode appMode, List filterIds) {
+ application.getSettings().POI_FILTERS_ORDER.setStringsListForProfile(appMode, filterIds);
}
- public void saveInactiveFilters(List filterIds) {
- application.getSettings().INACTIVE_POI_FILTERS.setStringsList(filterIds);
+ public void saveInactiveFilters(ApplicationMode appMode, List filterIds) {
+ application.getSettings().INACTIVE_POI_FILTERS.setStringsListForProfile(appMode, filterIds);
}
- public Map getPoiFiltersOrder() {
- List ids = application.getSettings().POI_FILTERS_ORDER.getStringsList();
+ public Map getPoiFiltersOrder(@NonNull ApplicationMode appMode) {
+ List ids = application.getSettings().POI_FILTERS_ORDER.getStringsListForProfile(appMode);
if (ids == null) {
return null;
}
@@ -425,8 +431,8 @@ public class PoiFiltersHelper {
return result;
}
- public List getInactivePoiFiltersIds() {
- return application.getSettings().INACTIVE_POI_FILTERS.getStringsList();
+ public List getInactivePoiFiltersIds(@NonNull ApplicationMode appMode) {
+ return application.getSettings().INACTIVE_POI_FILTERS.getStringsListForProfile(appMode);
}
private PoiFilterDbHelper openDbHelperNoPois() {
diff --git a/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java b/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java
index b2bc645760..ffa91d2d5c 100644
--- a/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java
+++ b/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java
@@ -3,6 +3,8 @@ package net.osmand.plus.poi;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -19,16 +21,20 @@ import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
+import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.material.appbar.AppBarLayout;
+
import net.osmand.AndroidUtils;
-import net.osmand.CallbackWithObject;
import net.osmand.PlatformUtil;
+import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
+import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
@@ -45,14 +51,14 @@ import static net.osmand.plus.poi.RearrangePoiFiltersFragment.ItemType.DESCRIPTI
import static net.osmand.plus.poi.RearrangePoiFiltersFragment.ItemType.POI;
import static net.osmand.plus.poi.RearrangePoiFiltersFragment.ItemType.SPACE;
-public class RearrangePoiFiltersFragment extends DialogFragment {
+public class RearrangePoiFiltersFragment extends DialogFragment implements SelectAppModesBottomSheetDialogFragment.AppModeChangedListener {
public static final String TAG = "RearrangePoiFiltersFragment";
private static final Log LOG = PlatformUtil.getLog(RearrangePoiFiltersFragment.class);
private boolean usedOnMap;
- private CallbackWithObject resultCallback;
+ private OnApplyPoiFiltersState resultCallback;
private List items = new ArrayList<>();
private EditPoiFiltersAdapter adapter;
@@ -60,6 +66,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
private boolean activationModified;
private boolean wasReset = false;
private boolean isChanged = false;
+ private ApplicationMode appMode;
private HashMap poiFiltersOrders = new HashMap<>();
private List availableFiltersKeys = new ArrayList<>();
@@ -72,6 +79,20 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
setStyle(STYLE_NO_FRAME, themeId);
}
+ @Override
+ public void onPause() {
+ super.onPause();
+ if (requireActivity().isChangingConfigurations()) {
+ dismiss();
+ }
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ updateProfileButton();
+ }
+
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -80,17 +101,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
boolean nightMode = isNightMode(app, usedOnMap);
View mainView = UiUtilities.getInflater(app, nightMode).inflate(R.layout.edit_arrangement_list_fragment, container, false);
- ImageButton closeButton = mainView.findViewById(R.id.close_button);
- closeButton.setImageResource(R.drawable.ic_action_remove_dark);
- closeButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- dismiss();
- }
- });
-
- TextView toolbarTitle = mainView.findViewById(R.id.toolbar_title);
- toolbarTitle.setText(R.string.rearrange_categories);
+ createToolbar(mainView, nightMode);
RecyclerView recyclerView = mainView.findViewById(R.id.profiles_list);
recyclerView.setLayoutManager(new LinearLayoutManager(app));
@@ -159,15 +170,16 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
applyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ ApplicationMode selectedAppMode = getSelectedAppMode();
if (isChanged) {
if (activationModified) {
- app.getPoiFilters().saveInactiveFilters(availableFiltersKeys);
+ app.getPoiFilters().saveInactiveFilters(selectedAppMode, availableFiltersKeys);
} else if (wasReset) {
- app.getPoiFilters().saveInactiveFilters(null);
+ app.getPoiFilters().saveInactiveFilters(selectedAppMode, null);
}
if (orderModified) {
List dataToSave = new ArrayList<>();
- for (PoiUIFilter filter : getSortedPoiUiFilters(app)) {
+ for (PoiUIFilter filter : getSortedPoiUiFilters(selectedAppMode, app)) {
String filterId = filter.getFilterId();
Integer order = poiFiltersOrders.get(filterId);
if (order == null) {
@@ -185,13 +197,13 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
for (PoiUIFilter filter : dataToSave) {
filterIds.add(filter.getFilterId());
}
- app.getPoiFilters().saveFiltersOrder(filterIds);
+ app.getPoiFilters().saveFiltersOrder(selectedAppMode, filterIds);
} else if (wasReset) {
- app.getPoiFilters().saveFiltersOrder(null);
+ app.getPoiFilters().saveFiltersOrder(selectedAppMode,null);
}
}
if (resultCallback != null) {
- resultCallback.processResult(isChanged);
+ resultCallback.onApplyPoiFiltersState(selectedAppMode, isChanged);
}
dismiss();
}
@@ -200,10 +212,84 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
return mainView;
}
+ private void createToolbar(View mainView, boolean nightMode) {
+ AppBarLayout appbar = mainView.findViewById(R.id.appbar);
+ View toolbar = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.profile_preference_toolbar_with_icon, appbar, false);
+
+ ImageButton closeButton = toolbar.findViewById(R.id.close_button);
+ closeButton.setImageResource(R.drawable.ic_action_remove_dark);
+ closeButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dismiss();
+ }
+ });
+
+ TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
+ toolbarTitle.setText(R.string.rearrange_categories);
+
+ View switchProfile = toolbar.findViewById(R.id.profile_button);
+ if (switchProfile != null) {
+ switchProfile.setContentDescription(getString(R.string.switch_profile));
+ switchProfile.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ FragmentManager fragmentManager = getFragmentManager();
+ if (fragmentManager != null) {
+ SelectAppModesBottomSheetDialogFragment.showInstance(fragmentManager,
+ RearrangePoiFiltersFragment.this, false, getSelectedAppMode(), false);
+ }
+ }
+ });
+ }
+ appbar.addView(toolbar);
+ }
+
+ protected void updateProfileButton() {
+ View view = getView();
+ if (view == null) {
+ return;
+ }
+
+ OsmandApplication app = requireMyApplication();
+ UiUtilities uiUtilities = app.getUIUtilities();
+ ApplicationMode selectedAppMode = getSelectedAppMode();
+ boolean nightMode = isNightMode(app, usedOnMap);
+
+ ImageView profileIcon = (ImageView) view.findViewById(R.id.profile_icon);
+ if (profileIcon != null) {
+ int iconRes = selectedAppMode.getIconRes();
+ int iconColor = selectedAppMode.getIconColorInfo().getColor(nightMode);
+ profileIcon.setImageDrawable(uiUtilities.getPaintedIcon(iconRes, iconColor));
+ }
+
+ View profileButton = view.findViewById(R.id.profile_button);
+ if (profileButton != null) {
+ int iconColor = getSelectedAppMode().getIconColorInfo().getColor(nightMode);
+ int bgColor = ContextCompat.getColor(app, nightMode ?
+ R.color.divider_color_dark : R.color.active_buttons_and_links_text_light);
+ int selectedColor = UiUtilities.getColorWithAlpha(iconColor, 0.3f);
+
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
+ int bgResId = R.drawable.circle_background_light;
+ int selectableResId = R.drawable.ripple_circle;
+ Drawable bgDrawable = uiUtilities.getPaintedIcon(bgResId, bgColor);
+ Drawable selectable = uiUtilities.getPaintedIcon(selectableResId, selectedColor);
+ Drawable[] layers = {bgDrawable, selectable};
+ AndroidUtils.setBackground(profileButton, new LayerDrawable(layers));
+ } else {
+ int bgResId = R.drawable.circle_background_light;
+ Drawable bgDrawable = uiUtilities.getPaintedIcon(bgResId, bgColor);
+ AndroidUtils.setBackground(profileButton, bgDrawable);
+ }
+ }
+ }
+
private void initFiltersOrders(OsmandApplication app, boolean arrangementByDefault) {
poiFiltersOrders.clear();
availableFiltersKeys.clear();
- List filters = getSortedPoiUiFilters(app);
+ ApplicationMode selectedAppMode = getSelectedAppMode();
+ List filters = getSortedPoiUiFilters(selectedAppMode, app);
if (arrangementByDefault) {
Collections.sort(filters, new Comparator() {
@Override
@@ -272,21 +358,35 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
adapter.setItems(items);
}
- public static void showInstance(@NonNull DialogFragment parentFragment, boolean usedOnMap, CallbackWithObject callback) {
+ public static void showInstance(@NonNull ApplicationMode appMode, @NonNull DialogFragment parentFragment,
+ boolean usedOnMap, OnApplyPoiFiltersState callback) {
try {
RearrangePoiFiltersFragment fragment = new RearrangePoiFiltersFragment();
fragment.setUsedOnMap(usedOnMap);
fragment.setResultCallback(callback);
+ fragment.setSelectedAppMode(appMode);
fragment.show(parentFragment.getChildFragmentManager(), RearrangePoiFiltersFragment.TAG);
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
}
+ public ApplicationMode getSelectedAppMode() {
+ if (appMode == null) {
+ appMode = requireMyApplication().getSettings().getApplicationMode();
+ }
+ return appMode;
+ }
+
+ public void setSelectedAppMode(ApplicationMode appMode) {
+ this.appMode = appMode;
+ }
+
public List getPoiFilters(boolean isActive) {
OsmandApplication app = requireMyApplication();
+ ApplicationMode selectedAppMode = getSelectedAppMode();
List result = new ArrayList<>();
- for (PoiUIFilter f : getSortedPoiUiFilters(app)) {
+ for (PoiUIFilter f : getSortedPoiUiFilters(selectedAppMode, app)) {
addFilterToList(result, f, isActive);
}
Collections.sort(result, new Comparator() {
@@ -322,8 +422,9 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
}
}
- private static List getSortedPoiUiFilters(@NonNull OsmandApplication app) {
- List filters = app.getPoiFilters().getSortedPoiFilters(false);
+ private static List getSortedPoiUiFilters(@NonNull ApplicationMode appMode,
+ @NonNull OsmandApplication app) {
+ List filters = app.getPoiFilters().getSortedPoiFilters(appMode, false);
//remove custom filter
for (int i = filters.size() - 1; i >= 0; i--) {
PoiUIFilter filter = filters.get(i);
@@ -339,7 +440,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
this.usedOnMap = usedOnMap;
}
- public void setResultCallback(CallbackWithObject resultCallback) {
+ public void setResultCallback(OnApplyPoiFiltersState resultCallback) {
this.resultCallback = resultCallback;
}
@@ -356,6 +457,13 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
return false;
}
+ @Override
+ public void onAppModeChanged(ApplicationMode appMode) {
+ this.appMode = appMode;
+ updateProfileButton();
+ initFiltersOrders(requireMyApplication(), false);
+ }
+
public class PoiUIFilterDataObject {
String filterId;
String name;
@@ -693,4 +801,8 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
void onButtonClicked(int view);
}
+
+ public interface OnApplyPoiFiltersState {
+ void onApplyPoiFiltersState(ApplicationMode mode, boolean stateChanged);
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/profiles/EditProfilesFragment.java b/OsmAnd/src/net/osmand/plus/profiles/EditProfilesFragment.java
index 4d8fa72ef6..6dbe8f0e16 100644
--- a/OsmAnd/src/net/osmand/plus/profiles/EditProfilesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/profiles/EditProfilesFragment.java
@@ -22,6 +22,8 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.material.appbar.AppBarLayout;
+
import net.osmand.AndroidUtils;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
@@ -67,6 +69,11 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
nightMode = !app.getSettings().isLightContent();
View mainView = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.edit_arrangement_list_fragment, container, false);
+
+ AppBarLayout appbar = mainView.findViewById(R.id.appbar);
+ View toolbar = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.global_preference_toolbar, container, false);
+ appbar.addView(toolbar);
+
ImageButton closeButton = mainView.findViewById(R.id.close_button);
closeButton.setImageResource(R.drawable.ic_action_remove_dark);
closeButton.setOnClickListener(new View.OnClickListener() {
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
index e6b0580692..cc8047f834 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java
@@ -1,12 +1,11 @@
package net.osmand.plus.quickaction;
+import android.content.Context;
import android.content.DialogInterface;
-import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
-import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -41,7 +40,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import static android.util.TypedValue.COMPLEX_UNIT_DIP;
+import static net.osmand.AndroidUtils.dpToPx;
/**
* Created by okorsun on 20.12.16.
@@ -224,11 +223,10 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
if (viewType == SCREEN_ITEM_TYPE) {
final QuickActionItemVH itemVH = (QuickActionItemVH) holder;
-
- itemVH.title.setText(item.getName(getContext()));
+ Context ctx = getContext();
+ itemVH.title.setText(item.getName(ctx));
itemVH.subTitle.setText(getResources().getString(R.string.quick_action_item_action, getActionPosition(position)));
-
- itemVH.icon.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(item.getIconRes(getContext())));
+ itemVH.icon.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(item.getIconRes(ctx)));
itemVH.handleView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -256,7 +254,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
LinearLayout.LayoutParams dividerParams = (LinearLayout.LayoutParams) itemVH.divider.getLayoutParams();
//noinspection ResourceType
- dividerParams.setMargins(!isLongDivider(position) ? dpToPx(56f) : 0, 0, 0, 0);
+ dividerParams.setMargins(!isLongDivider(position) ? dpToPx(ctx, 56f) : 0, 0, 0, 0);
itemVH.divider.setLayoutParams(dividerParams);
} else {
QuickActionHeaderVH headerVH = (QuickActionHeaderVH) holder;
@@ -361,15 +359,6 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
return getActionPosition(globalPosition) == ITEMS_IN_GROUP || globalPosition == getItemCount() - 1;
}
- private int dpToPx(float dp) {
- Resources r = getActivity().getResources();
- return (int) TypedValue.applyDimension(
- COMPLEX_UNIT_DIP,
- dp,
- r.getDisplayMetrics()
- );
- }
-
@Override
public boolean onItemMove(int selectedPosition, int targetPosition) {
Log.v(TAG, "selected: " + selectedPosition + ", target: " + targetPosition);
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
index 17bf11ee5b..979d525e10 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
@@ -5,6 +5,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
+import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -14,6 +15,7 @@ import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
+import android.text.style.StyleSpan;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@@ -44,10 +46,10 @@ import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;
+import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import net.osmand.AndroidUtils;
-import net.osmand.CallbackWithObject;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.WptPt;
@@ -66,6 +68,7 @@ import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.AppInitializer.AppInitializeListener;
+import net.osmand.plus.ApplicationMode;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.LockableViewPager;
import net.osmand.plus.OsmAndFormatter;
@@ -74,6 +77,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.Version;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
@@ -1238,15 +1242,40 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
app.getString(R.string.rearrange_categories), new OnClickListener() {
@Override
public void onClick(View v) {
- RearrangePoiFiltersFragment.showInstance(QuickSearchDialogFragment.this, false, new CallbackWithObject() {
+ ApplicationMode appMode = app.getSettings().getApplicationMode();
+ RearrangePoiFiltersFragment.showInstance(appMode, QuickSearchDialogFragment.this, false,
+ new RearrangePoiFiltersFragment.OnApplyPoiFiltersState() {
- @Override
- public boolean processResult(Boolean changed) {
- if (changed) {
- searchHelper.refreshFilterOrders();
- reloadCategoriesInternal();
- }
- return false;
+ @Override
+ public void onApplyPoiFiltersState(final ApplicationMode appMode, boolean stateChanged) {
+ if (stateChanged) {
+ searchHelper.refreshFilterOrders();
+ reloadCategoriesInternal();
+ }
+ View containerView = getView();
+ if (containerView != null) {
+ //show "Apply to all profiles" SnackBar
+ String modeName = appMode.toHumanString();
+ String text = app.getString(R.string.changes_applied_to_profile, modeName);
+ SpannableString message = UiUtilities.createSpannableString(text, modeName, new StyleSpan(Typeface.BOLD));
+ Snackbar snackbar = Snackbar.make(containerView, message, Snackbar.LENGTH_LONG)
+ .setAction(R.string.apply_to_all_profiles, new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ OsmandSettings settings = app.getSettings();
+ String orders = settings.POI_FILTERS_ORDER.getModeValue(appMode);
+ String inactive = settings.INACTIVE_POI_FILTERS.getModeValue(appMode);
+ for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {
+ settings.POI_FILTERS_ORDER.setModeValue(mode, orders);
+ settings.INACTIVE_POI_FILTERS.setModeValue(mode, inactive);
+ }
+ searchHelper.refreshFilterOrders();
+ reloadCategoriesInternal();
+ }
+ });
+ UiUtilities.setupSnackbarVerticalLayout(snackbar);
+ snackbar.show();
+ }
}
});
}
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java
index 013a8d33df..f3554d0c46 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java
@@ -275,7 +275,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
if (pointDescription != null) {
String typeName = pointDescription.getTypeName();
if (!Algorithms.isEmpty(typeName)) {
- name = mapActivity.getString(R.string.street_city, pointDescription.getName(), typeName);
+ name = mapActivity.getString(R.string.ltr_or_rtl_combine_via_comma, pointDescription.getName(), typeName);
} else {
name = pointDescription.getName();
}
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java
index c462353086..1170e2c616 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java
@@ -374,14 +374,16 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
builder.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- PoiUIFilter nFilter = new PoiUIFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), app);
+ String filterName = editText.getText().toString();
+ PoiUIFilter nFilter = new PoiUIFilter(filterName, null, filter.getAcceptedTypes(), app);
applyFilterFields();
if (!Algorithms.isEmpty(filter.getFilterByName())) {
nFilter.setSavedFilterByName(filter.getFilterByName());
}
if (app.getPoiFilters().createPoiFilter(nFilter, false)) {
- Toast.makeText(getContext(), MessageFormat.format(getContext().getText(R.string.edit_filter_create_message).toString(),
- editText.getText().toString()), Toast.LENGTH_SHORT).show();
+ Toast.makeText(getContext(),
+ getContext().getString(R.string.edit_filter_create_message, filterName),
+ Toast.LENGTH_SHORT).show();
app.getSearchUICore().refreshCustomPoiFilters();
((QuickSearchDialogFragment) getParentFragment()).replaceQueryWithUiFilter(nFilter, "");
((QuickSearchDialogFragment) getParentFragment()).reloadCategories();
diff --git a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java
index e1d1adcab3..8cdc1cccd6 100644
--- a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java
@@ -940,9 +940,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
}
});
UiUtilities.setupSnackbarVerticalLayout(snackbar);
- try {
- snackbar.setAnimationMode(BaseTransientBottomBar.ANIMATION_MODE_FADE);
- } catch (Throwable e) { }
snackbar.show();
}
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java
index 8790889a1b..6777b95add 100644
--- a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java
@@ -14,13 +14,14 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.material.appbar.AppBarLayout;
+
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.ApplicationMode;
@@ -68,6 +69,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
private static final String ITEMS_ORDER_KEY = "items_order_key";
private static final String HIDDEN_ITEMS_KEY = "hidden_items_key";
private static final String CONFIGURE_MENU_ITEMS_TAG = "configure_menu_items_tag";
+ private static final String IS_CHANGED_KEY = "is_changed_key";
private RearrangeMenuItemsAdapter rearrangeAdapter;
private HashMap menuItemsOrder;
private ContextMenuAdapter contextMenuAdapter;
@@ -87,6 +89,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
outState.putSerializable(ITEMS_ORDER_KEY, menuItemsOrder);
outState.putSerializable(ITEM_TYPE_KEY, screenType);
outState.putString(APP_MODE_KEY, appMode.getStringKey());
+ outState.putBoolean(IS_CHANGED_KEY, isChanged);
}
public static ConfigureMenuItemsFragment showInstance(
@@ -126,15 +129,12 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
mInflater = UiUtilities.getInflater(app, nightMode);
- instantiateContextMenuAdapter();
- if (savedInstanceState != null
- && savedInstanceState.containsKey(ITEM_TYPE_KEY)
- && savedInstanceState.containsKey(HIDDEN_ITEMS_KEY)
- && savedInstanceState.containsKey(ITEMS_ORDER_KEY)) {
+ if (savedInstanceState != null) {
appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null);
screenType = (ScreenType) savedInstanceState.getSerializable(ITEM_TYPE_KEY);
hiddenMenuItems = savedInstanceState.getStringArrayList(HIDDEN_ITEMS_KEY);
menuItemsOrder = (HashMap) savedInstanceState.getSerializable(ITEMS_ORDER_KEY);
+ isChanged = savedInstanceState.getBoolean(IS_CHANGED_KEY);
} else {
hiddenMenuItems = new ArrayList<>(getSettingForScreen(app, screenType).getModeValue(appMode).getHiddenIds());
menuItemsOrder = new HashMap<>();
@@ -143,6 +143,14 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
menuItemsOrder.put(orderIds.get(i), i);
}
}
+ instantiateContextMenuAdapter();
+ if (menuItemsOrder.isEmpty()) {
+ List defItems = contextMenuAdapter.getDefaultItems();
+ initDefaultOrders(defItems);
+ for (int i = 0; i < defItems.size(); i++) {
+ menuItemsOrder.put(defItems.get(i).getId(), i);
+ }
+ }
}
private void instantiateContextMenuAdapter() {
@@ -169,11 +177,10 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = mInflater.inflate(R.layout.edit_arrangement_list_fragment, container, false);
- Toolbar toolbar = root.findViewById(R.id.toolbar);
- TextView toolbarTitle = root.findViewById(R.id.toolbar_title);
- ImageButton toolbarButton = root.findViewById(R.id.close_button);
- RecyclerView recyclerView = root.findViewById(R.id.profiles_list);
- recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width));
+ AppBarLayout appbar = root.findViewById(R.id.appbar);
+ View toolbar = mInflater.inflate(R.layout.global_preference_toolbar, container, false);
+ TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
+ ImageButton toolbarButton = toolbar.findViewById(R.id.close_button);
toolbar.setBackgroundColor(nightMode
? getResources().getColor(R.color.list_background_color_dark)
: getResources().getColor(R.color.list_background_color_light));
@@ -188,8 +195,9 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
exitFragment();
}
});
-
-
+ appbar.addView(toolbar);
+ RecyclerView recyclerView = root.findViewById(R.id.profiles_list);
+ recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width));
rearrangeAdapter = new RearrangeMenuItemsAdapter(app, getAdapterItems());
recyclerView.setLayoutManager(new LinearLayoutManager(app));
final ItemTouchHelper touchHelper = new ItemTouchHelper(new ReorderItemTouchHelperCallback(rearrangeAdapter));
@@ -300,16 +308,16 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
List visible = getItemsForRearrangeAdapter(hiddenMenuItems, wasReset ? null : menuItemsOrder, false);
List hiddenItems = getItemsForRearrangeAdapter(hiddenMenuItems, wasReset ? null : menuItemsOrder, true);
if (screenType == ScreenType.CONTEXT_MENU_ACTIONS) {
+ int buttonMoreIndex = MAIN_BUTTONS_QUANTITY - 1;
for (int i = 0; i < visible.size(); i++) {
ContextMenuItem value = (ContextMenuItem) visible.get(i).getValue();
- if (value.getId() != null && value.getId().equals(MAP_CONTEXT_MENU_MORE_ID)) {
- int buttonMoreIndex = MAIN_BUTTONS_QUANTITY - 1;
- if (i > buttonMoreIndex) {
- RearrangeMenuAdapterItem third = visible.get(buttonMoreIndex);
- visible.set(buttonMoreIndex, visible.get(i));
- menuItemsOrder.put(((ContextMenuItem) third.getValue()).getId(), i);
- menuItemsOrder.put(((ContextMenuItem) visible.get(i).getValue()).getId(), buttonMoreIndex);
- }
+ if (value.getId() != null && value.getId().equals(MAP_CONTEXT_MENU_MORE_ID) && i > buttonMoreIndex) {
+ RearrangeMenuAdapterItem third = visible.get(buttonMoreIndex);
+ visible.set(buttonMoreIndex, visible.get(i));
+ visible.set(i, third);
+ value.setOrder(buttonMoreIndex);
+ ((ContextMenuItem) third.getValue()).setOrder(i);
+ break;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java
index 8af4450a62..b9e724a1ae 100644
--- a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java
@@ -268,6 +268,9 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
super.onScrollStateChanged(recyclerView, newState);
if (newState != RecyclerView.SCROLL_STATE_IDLE) {
hideKeyboard();
+ if (profileName != null) {
+ profileName.clearFocus();
+ }
}
}
});
@@ -359,13 +362,21 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
}
}
});
+ profileName.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if(hasFocus){
+ profileName.setSelection(profileName.getText().length());
+ AndroidUtils.showSoftKeyboard(profileName);
+ }
+ }
+ });
if (getSelectedAppMode().equals(ApplicationMode.DEFAULT) && !isNewProfile) {
profileName.setFocusableInTouchMode(false);
profileName.setFocusable(false);
- } else {
- profileName.requestFocus();
}
profileNameOtfb = (OsmandTextFieldBoxes) holder.findViewById(R.id.profile_name_otfb);
+ updateProfileNameAppearance();
} else if (MASTER_PROFILE.equals(preference.getKey())) {
baseProfileName = (EditText) holder.findViewById(R.id.master_profile_et);
baseProfileName.setFocusable(false);
diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java
index ebb3efa034..ff6cc4e7b1 100644
--- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java
@@ -2,7 +2,6 @@ package net.osmand.plus.views;
import android.app.Dialog;
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -53,7 +52,7 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import static android.util.TypedValue.COMPLEX_UNIT_DIP;
+import static net.osmand.AndroidUtils.dpToPx;
public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
MapTextProvider, IRouteInformationListener {
@@ -446,15 +445,4 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
@Override
public void routeWasFinished() {
}
-
- public static int dpToPx(Context ctx, float dp) {
- Resources r = ctx.getResources();
- return (int) TypedValue.applyDimension(
- COMPLEX_UNIT_DIP,
- dp,
- r.getDisplayMetrics()
- );
- }
-
-
}
diff --git a/OsmAnd/src/net/osmand/plus/wikipedia/SelectWikiLanguagesBottomSheet.java b/OsmAnd/src/net/osmand/plus/wikipedia/SelectWikiLanguagesBottomSheet.java
index 97bd1d746a..179cedef05 100644
--- a/OsmAnd/src/net/osmand/plus/wikipedia/SelectWikiLanguagesBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/wikipedia/SelectWikiLanguagesBottomSheet.java
@@ -1,5 +1,6 @@
package net.osmand.plus.wikipedia;
+import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
@@ -8,6 +9,8 @@ import android.widget.CompoundButton;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
+import androidx.core.os.ConfigurationCompat;
+import androidx.core.os.LocaleListCompat;
import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
@@ -19,13 +22,17 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
+import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
+import java.util.Set;
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.ENABLED_WIKI_POI_LANGUAGES_KEY;
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.GLOBAL_WIKI_POI_ENABLED_KEY;
@@ -50,9 +57,6 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
app = requiredMyApplication();
settings = app.getSettings();
initLanguagesData();
- if (savedInstanceState != null) {
- dismiss();
- }
}
@Override
@@ -63,17 +67,18 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
@Override
public void createMenuItems(Bundle savedInstanceState) {
-
- boolean nightMode = isNightMode(app);
- final int activeColorResId = AndroidUtils.resolveAttribute(app, R.attr.active_color_basic);
+ final int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
final int profileColorResId = appMode.getIconColorInfo().getColor(nightMode);
- final int paddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
- final int paddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
+ final int contentPadding = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
+ final int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
+ final int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
items.add(new TitleItem(getString(R.string.shared_string_languages)));
- items.add(new LongDescriptionItem(getString(R.string.wikipedia_poi_languages_promo)));
- items.add(new DividerSpaceItem(app, paddingSmall));
+ items.add(new LongDescriptionItem(getString(R.string.some_articles_may_not_available_in_lang)));
+ items.add(new DividerSpaceItem(app, contentPadding));
+ items.add(new LongDescriptionItem(getString(R.string.select_wikipedia_article_langs)));
+ items.add(new DividerSpaceItem(app, contentPaddingSmall));
final BottomSheetItemWithCompoundButton[] btnSelectAll = new BottomSheetItemWithCompoundButton[1];
btnSelectAll[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
@@ -92,10 +97,17 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
})
.create();
items.add(btnSelectAll[0]);
- items.add(new DividerSpaceItem(app, paddingHalf));
+ items.add(new DividerSpaceItem(app, contentPaddingHalf));
languageItems = new ArrayList<>();
+ boolean categoryChanged = false;
for (final WikiLanguageItem language : languages) {
+ if (!categoryChanged && !language.isTopDefined()) {
+ categoryChanged = true;
+ DividerItem divider = new DividerItem(app);
+ divider.setMargins(contentPadding, 0, 0, 0);
+ items.add(divider);
+ }
final BottomSheetItemWithCompoundButton[] languageItem = new BottomSheetItemWithCompoundButton[1];
languageItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(language.isChecked())
@@ -111,13 +123,21 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
})
.create();
languageItems.add(languageItem[0]);
+ items.add(languageItem[0]);
}
- items.addAll(languageItems);
}
private void initLanguagesData() {
languages = new ArrayList<>();
+ Set preferredLocales = new HashSet<>();
+ LocaleListCompat locales = ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration());
+ for (int i = 0; i < locales.size(); i++) {
+ preferredLocales.add(locales.get(i).getLanguage());
+ }
+ preferredLocales.add(app.getLanguage());
+ preferredLocales.add(Locale.getDefault().getLanguage());
+
Bundle wikiPoiSettings = WikipediaPoiMenu.getWikiPoiSettings(app);
List enabledWikiPoiLocales = null;
if (wikiPoiSettings != null) {
@@ -127,11 +147,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
if (enabledWikiPoiLocales != null) {
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
boolean checked = enabledWikiPoiLocales.contains(locale);
- languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked));
+ boolean topDefined = preferredLocales.contains(locale) || checked;
+ languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked, topDefined));
}
} else {
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
- languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false));
+ boolean topDefined = preferredLocales.contains(locale);
+ languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false, topDefined));
}
}
@@ -183,8 +205,8 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
View buttonView = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.bottom_sheet_item_title_with_swith_56dp, null);
CompoundButton cb = buttonView.findViewById(R.id.compound_button);
- int color = AndroidUtils.getColorFromAttr(app, R.attr.divider_color_basic);
- int bgColor = UiUtilities.getColorWithAlpha(color, 0.5f);
+ int color = nightMode ? R.color.divider_color_dark : R.color.divider_color_light;
+ int bgColor = UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, color), 0.5f);
int bgResId = R.drawable.rectangle_rounded_right;
Drawable bgDrawable = app.getUIUtilities().getPaintedIcon(bgResId, bgColor);
@@ -196,6 +218,14 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
return buttonView;
}
+ @Override
+ public void onPause() {
+ super.onPause();
+ if (requireActivity().isChangingConfigurations()) {
+ dismiss();
+ }
+ }
+
public void setAppMode(ApplicationMode appMode) {
this.appMode = appMode;
}
@@ -208,11 +238,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
private String locale;
private String title;
private boolean checked;
+ private boolean topDefined;
- public WikiLanguageItem(String locale, String title, boolean checked) {
+ public WikiLanguageItem(String locale, String title, boolean checked, boolean topDefined) {
this.locale = locale;
this.title = title;
this.checked = checked;
+ this.topDefined = topDefined;
}
public String getLocale() {
@@ -227,13 +259,18 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
this.checked = checked;
}
+ public boolean isTopDefined() {
+ return topDefined;
+ }
+
public String getTitle() {
return title;
}
@Override
public int compareTo(WikiLanguageItem other) {
- return this.title.compareToIgnoreCase(other.title);
+ int result = other.topDefined ? (!this.topDefined ? 1 : 0) : (this.topDefined ? -1 : 0);
+ return result != 0 ? result : this.title.compareToIgnoreCase(other.title);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java
index f2f162a76e..763531e266 100644
--- a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java
@@ -44,7 +44,6 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
@@ -231,9 +230,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
Context context = getContext();
if (context != null) {
final PopupMenu optionsMenu = new PopupMenu(context, view, Gravity.RIGHT);
- Set namesSet = new TreeSet<>();
- namesSet.addAll(amenity.getNames("content", "en"));
- namesSet.addAll(amenity.getNames("description", "en"));
+ Set namesSet = amenity.getSupportedContentLocales();
Map names = new HashMap<>();
for (String n : namesSet) {
@@ -285,8 +282,9 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
WikipediaDialogFragment wikipediaDialogFragment = new WikipediaDialogFragment();
wikipediaDialogFragment.setAmenity(amenity);
- wikipediaDialogFragment.setLanguage(lang == null ?
- app.getSettings().MAP_PREFERRED_LOCALE.get() : lang);
+ lang = lang != null ? lang : WikipediaPoiMenu.getWikiArticleLanguage(app,
+ amenity.getSupportedContentLocales(), app.getSettings().MAP_PREFERRED_LOCALE.get());
+ wikipediaDialogFragment.setLanguage(lang);
wikipediaDialogFragment.setRetainInstance(true);
wikipediaDialogFragment.show(activity.getSupportFragmentManager(), TAG);
return true;
diff --git a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaPoiMenu.java b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaPoiMenu.java
index e8125018a5..ad2f4c1519 100644
--- a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaPoiMenu.java
+++ b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaPoiMenu.java
@@ -1,6 +1,7 @@
package net.osmand.plus.wikipedia;
import android.os.Bundle;
+import android.text.TextUtils;
import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
@@ -26,6 +27,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import static net.osmand.osm.MapPoiTypes.WIKI_LANG;
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
@@ -354,7 +356,7 @@ public class WikipediaPoiMenu {
ph.clearSelectedPoiFilters(PoiTemplateList.WIKI);
}
- private static String getLanguagesSummary(OsmandApplication app) {
+ public static String getLanguagesSummary(OsmandApplication app) {
Bundle wikiLanguagesSetting = getWikiPoiSettings(app);
if (wikiLanguagesSetting != null) {
boolean globalWikiEnabled = wikiLanguagesSetting.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
@@ -379,4 +381,31 @@ public class WikipediaPoiMenu {
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) {
return new WikipediaPoiMenu(mapActivity).createLayersItems();
}
+
+ public static String getWikiArticleLanguage(@NonNull OsmandApplication app,
+ @NonNull Set availableArticleLangs,
+ String preferredLanguage) {
+ Bundle wikiPoiSettings = getWikiPoiSettings(app);
+ if (!app.getSettings().SHOW_WIKIPEDIA_POI.get() || wikiPoiSettings == null) {
+ // Wikipedia POI setting disabled
+ return preferredLanguage;
+ }
+ if (wikiPoiSettings.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY)) {
+ // global Wikipedia POI filter enabled
+ return preferredLanguage;
+ }
+ if (Algorithms.isEmpty(preferredLanguage)) {
+ preferredLanguage = app.getLanguage();
+ }
+ List wikiLangs = wikiPoiSettings.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
+ if (wikiLangs != null && !wikiLangs.contains(preferredLanguage)) {
+ // return first matched language from enabled Wikipedia languages
+ for (String language : wikiLangs) {
+ if (availableArticleLangs.contains(language)) {
+ return language;
+ }
+ }
+ }
+ return preferredLanguage;
+ }
}