diff --git a/OsmAnd/res/layout/expandable_list_item_category.xml b/OsmAnd/res/layout/expandable_list_item_category.xml index 06d9606bca..e25f0f48d8 100644 --- a/OsmAnd/res/layout/expandable_list_item_category.xml +++ b/OsmAnd/res/layout/expandable_list_item_category.xml @@ -22,7 +22,7 @@ android:paddingStart="@dimen/list_content_padding" android:paddingRight="0dp" android:paddingEnd="0dp" - android:minHeight="@dimen/list_item_height" + android:minHeight="@dimen/bottom_sheet_list_item_height" android:background="?attr/expandable_list_item_background"> + 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/point_editor_fragment_new.xml b/OsmAnd/res/layout/point_editor_fragment_new.xml index af8672eef8..749dacd334 100644 --- a/OsmAnd/res/layout/point_editor_fragment_new.xml +++ b/OsmAnd/res/layout/point_editor_fragment_new.xml @@ -139,7 +139,6 @@ android:paddingStart="12dp" android:paddingLeft="12dp" android:paddingRight="12dp" - android:scrollHorizontally="false" android:textSize="16sp" tools:text="@string/lorem_ipsum" /> diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml index ff4f9eb21d..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 سميك 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 5d4ce58aea..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 diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index 01b112b8ff..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 diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 9d2a65aea9..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 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 8e41e1bd3d..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 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 040c915ab8..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 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 d7564bbf50..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. 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 1b874081ee..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 בהורדה מסלולים שעבור גרומינג לסגנון קלסי רק ללא מסלולי ההחלקה. לרבות מסלולים שעברו גרומינג על ידי אופנוע שלג עם תוואי רופף ומסלולים שנסללו ידנית על ידי גולשי סקי. 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 ffa0ddabf0..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 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 57119100f9..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 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 5adffd5ab2..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 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 1ba197a03f..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 Для пустынь и других малонаселенных районов. Более детально. Положение значка при движении Положение значка в состоянии покоя diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index 939bb1cda9..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 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 ded3a13cdb..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 diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index ed693b568e..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 Товсто diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 5d2286dc9c..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 密集 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 81aa86bee6..1dfbdcf472 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,7 @@ Thx - Hardy --> + Custom color Lombard Aragonese Bashkir @@ -244,7 +245,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/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/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/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/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 21f21835d7..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() { @@ -921,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/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/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/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() - ); - } - - }