diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml
index 145d61cedf..fdb7ebdf55 100644
--- a/OsmAnd/AndroidManifest.xml
+++ b/OsmAnd/AndroidManifest.xml
@@ -40,7 +40,7 @@
+ tools:overrideLibrary="com.getkeepsafe.taptargetview, studio.carbonylgroup.textfieldboxes, android.support.customtabs"/>
diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle
index 409fe53919..de30ccf70a 100644
--- a/OsmAnd/build.gradle
+++ b/OsmAnd/build.gradle
@@ -389,6 +389,7 @@ dependencies {
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
+ compile 'com.android.support:customtabs:26.1.0'
compile fileTree(include: ['*.jar'], exclude: ['QtAndroid-bundled.jar', 'QtAndroidAccessibility-bundled.jar', 'OsmAndCore_android.jar', 'OsmAndCore_wrapper.jar', 'android-support-multidex.jar'], dir: 'libs')
legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
diff --git a/OsmAnd/res/drawable/bg_map_context_menu_dark.xml b/OsmAnd/res/drawable/bg_map_context_menu_dark.xml
index 1e7add2c05..0ffd43e6ac 100644
--- a/OsmAnd/res/drawable/bg_map_context_menu_dark.xml
+++ b/OsmAnd/res/drawable/bg_map_context_menu_dark.xml
@@ -1,7 +1,7 @@
-
-
+
-
diff --git a/OsmAnd/res/drawable/bg_map_context_menu_light.xml b/OsmAnd/res/drawable/bg_map_context_menu_light.xml
index 60af50f23c..9ea7cda807 100644
--- a/OsmAnd/res/drawable/bg_map_context_menu_light.xml
+++ b/OsmAnd/res/drawable/bg_map_context_menu_light.xml
@@ -1,7 +1,7 @@
-
-
+
-
diff --git a/OsmAnd/res/drawable/context_menu_controller_disabled_bg_dark.xml b/OsmAnd/res/drawable/context_menu_controller_disabled_bg_dark.xml
new file mode 100644
index 0000000000..33274d8ff8
--- /dev/null
+++ b/OsmAnd/res/drawable/context_menu_controller_disabled_bg_dark.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/context_menu_controller_disabled_bg_light.xml b/OsmAnd/res/drawable/context_menu_controller_disabled_bg_light.xml
new file mode 100644
index 0000000000..4ac0d70116
--- /dev/null
+++ b/OsmAnd/res/drawable/context_menu_controller_disabled_bg_light.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/color/context_menu_controller_text_color_dark.xml b/OsmAnd/res/drawable/context_menu_controller_text_color_dark.xml
similarity index 100%
rename from OsmAnd/res/color/context_menu_controller_text_color_dark.xml
rename to OsmAnd/res/drawable/context_menu_controller_text_color_dark.xml
diff --git a/OsmAnd/res/color/context_menu_controller_text_color_light.xml b/OsmAnd/res/drawable/context_menu_controller_text_color_light.xml
similarity index 100%
rename from OsmAnd/res/color/context_menu_controller_text_color_light.xml
rename to OsmAnd/res/drawable/context_menu_controller_text_color_light.xml
diff --git a/OsmAnd/res/drawable/multi_selection_menu_bg_dark.xml b/OsmAnd/res/drawable/multi_selection_menu_bg_dark.xml
new file mode 100644
index 0000000000..0f3ff4b6b4
--- /dev/null
+++ b/OsmAnd/res/drawable/multi_selection_menu_bg_dark.xml
@@ -0,0 +1,11 @@
+
+
+
-
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/multi_selection_menu_bg_dark_land.xml b/OsmAnd/res/drawable/multi_selection_menu_bg_dark_land.xml
new file mode 100644
index 0000000000..917a1f9b7a
--- /dev/null
+++ b/OsmAnd/res/drawable/multi_selection_menu_bg_dark_land.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/multi_selection_menu_bg_light.xml b/OsmAnd/res/drawable/multi_selection_menu_bg_light.xml
new file mode 100644
index 0000000000..8c7efd329b
--- /dev/null
+++ b/OsmAnd/res/drawable/multi_selection_menu_bg_light.xml
@@ -0,0 +1,11 @@
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/multi_selection_menu_bg_light_land.xml b/OsmAnd/res/drawable/multi_selection_menu_bg_light_land.xml
new file mode 100644
index 0000000000..6fdf50b311
--- /dev/null
+++ b/OsmAnd/res/drawable/multi_selection_menu_bg_light_land.xml
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark.xml b/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark.xml
new file mode 100644
index 0000000000..c990c9567f
--- /dev/null
+++ b/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark_n.xml b/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark_n.xml
new file mode 100644
index 0000000000..75c6e965c3
--- /dev/null
+++ b/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark_n.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark_p.xml b/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark_p.xml
new file mode 100644
index 0000000000..2cbe3de5a5
--- /dev/null
+++ b/OsmAnd/res/drawable/wikipedia_select_lang_bg_dark_p.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/wikipedia_select_lang_bg_light.xml b/OsmAnd/res/drawable/wikipedia_select_lang_bg_light.xml
new file mode 100644
index 0000000000..aa66c087f7
--- /dev/null
+++ b/OsmAnd/res/drawable/wikipedia_select_lang_bg_light.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/wikipedia_select_lang_bg_light_n.xml b/OsmAnd/res/drawable/wikipedia_select_lang_bg_light_n.xml
new file mode 100644
index 0000000000..8a82c9ac94
--- /dev/null
+++ b/OsmAnd/res/drawable/wikipedia_select_lang_bg_light_n.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/drawable/wikipedia_select_lang_bg_light_p.xml b/OsmAnd/res/drawable/wikipedia_select_lang_bg_light_p.xml
new file mode 100644
index 0000000000..db337bcee9
--- /dev/null
+++ b/OsmAnd/res/drawable/wikipedia_select_lang_bg_light_p.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout-land/plan_route_info.xml b/OsmAnd/res/layout-land/plan_route_info.xml
index 3ef7ec87a4..ed694f5509 100644
--- a/OsmAnd/res/layout-land/plan_route_info.xml
+++ b/OsmAnd/res/layout-land/plan_route_info.xml
@@ -49,7 +49,7 @@
android:id="@+id/waypoints"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
- android:background="?attr/dashboard_button"
+ android:background="?attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/map_action_waypoints"/>
@@ -74,16 +74,19 @@
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="1dp"
+ android:background="@color/dashboard_divider_dark"
+ android:focusable="false"/>
-
-
-
+
@@ -308,7 +287,7 @@
android:id="@+id/Prev"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
- android:background="?attr/dashboard_button"
+ android:background="?attr/selectableItemBackground"
android:contentDescription="@string/shared_string_previous"
android:scaleType="center"
android:src="@drawable/ic_prev"/>
@@ -407,7 +386,7 @@
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="5dp"
- android:background="?attr/dashboard_button"
+ android:background="?attr/selectableItemBackground"
android:contentDescription="@string/shared_string_next"
android:scaleType="center"
android:src="@drawable/ic_next"/>
diff --git a/OsmAnd/res/layout/ctx_menu_transport_route_layout.xml b/OsmAnd/res/layout/ctx_menu_transport_route_layout.xml
deleted file mode 100644
index ea5082b912..0000000000
--- a/OsmAnd/res/layout/ctx_menu_transport_route_layout.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml
index 3ed1aa6c28..4306395700 100644
--- a/OsmAnd/res/layout/map_context_menu_fragment.xml
+++ b/OsmAnd/res/layout/map_context_menu_fragment.xml
@@ -97,20 +97,21 @@
android:layout_height="@dimen/context_menu_sub_info_height"
android:orientation="horizontal">
-
@@ -174,7 +175,7 @@
android:paddingRight="@dimen/context_menu_button_padding_x"
android:textAllCaps="true"
android:text="@string/recording_context_menu_play"
- tools:textColor="?attr/contextMenuButtonColor"
+ tools:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/>
@@ -246,7 +247,7 @@
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_download"
- tools:textColor="?attr/contextMenuButtonColor"
+ tools:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/>
@@ -270,8 +271,8 @@
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
- android:text="@string/shared_string_delete"
- tools:textColor="?attr/contextMenuButtonColor"
+ android:text="@string/shared_string_others"
+ tools:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/>
@@ -305,9 +306,9 @@
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
- android:text="@string/shared_string_others"
+ android:text="@string/shared_string_delete"
android:textAllCaps="true"
- tools:textColor="?attr/contextMenuButtonColor"
+ tools:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"/>
@@ -382,8 +383,8 @@
android:background="?attr/ctx_menu_divider"/>
@@ -42,7 +43,7 @@
+ tools:background="@color/multi_selection_menu_divider_dark"/>
\ No newline at end of file
diff --git a/OsmAnd/res/layout/menu_obj_selection_fragment.xml b/OsmAnd/res/layout/menu_obj_selection_fragment.xml
index e12b90079d..75aa5be1a7 100644
--- a/OsmAnd/res/layout/menu_obj_selection_fragment.xml
+++ b/OsmAnd/res/layout/menu_obj_selection_fragment.xml
@@ -29,7 +29,7 @@
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
- android:background="?attr/dashboard_divider"/>
+ tools:background="@color/multi_selection_menu_divider_dark"/>
diff --git a/OsmAnd/res/layout/menu_obj_selection_header.xml b/OsmAnd/res/layout/menu_obj_selection_header.xml
index 3941361cf1..7204628004 100644
--- a/OsmAnd/res/layout/menu_obj_selection_header.xml
+++ b/OsmAnd/res/layout/menu_obj_selection_header.xml
@@ -10,7 +10,7 @@
@@ -73,16 +73,19 @@
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="1dp"
+ android:background="@color/dashboard_divider_dark"
+ android:focusable="false"/>
-
-
-
+
@@ -312,7 +292,7 @@
android:id="@+id/Prev"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
- android:background="?attr/dashboard_button"
+ android:background="?attr/selectableItemBackground"
android:contentDescription="@string/shared_string_previous"
android:scaleType="center"
android:src="@drawable/ic_prev"/>
@@ -366,7 +346,7 @@
android:layout_marginRight="@dimen/list_content_padding"
android:contentDescription="@string/info_button"
android:scaleType="center"
- android:src="@drawable/ic_action_time"/>
+ android:src="@drawable/ic_action_time_span"/>
diff --git a/OsmAnd/res/layout/transport_stop_route_item.xml b/OsmAnd/res/layout/transport_stop_route_item.xml
index 8d186872a8..2e0440c0a8 100644
--- a/OsmAnd/res/layout/transport_stop_route_item.xml
+++ b/OsmAnd/res/layout/transport_stop_route_item.xml
@@ -7,6 +7,7 @@
android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values-be-rBY/strings.xml b/OsmAnd/res/values-be-rBY/strings.xml
index 2c1f4c40b8..af00140e53 100644
--- a/OsmAnd/res/values-be-rBY/strings.xml
+++ b/OsmAnd/res/values-be-rBY/strings.xml
@@ -2963,4 +2963,9 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd
Zmien %1$s, suma %2$s mBTC
OSM-atrymaĺniki
Usiaho achviaravanniaŭ
-
+Adkryta z
+ Adkryta da
+ Zakryjecca a
+ Adkryjecca a
+ Adkryjecca
+
diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml
index 277b7c8fca..24d6eaee80 100644
--- a/OsmAnd/res/values-be/strings.xml
+++ b/OsmAnd/res/values-be/strings.xml
@@ -3012,4 +3012,9 @@
Змен %1$s, сума %2$s mBTC
OSM-атрымальнікі
Усяго ахвяраванняў
-
+Адкрыта з
+ Адкрыта да
+ Закрыецца а
+ Адкрыецца а
+ Адкрыецца
+
diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml
index 7a865918b6..e63abade44 100644
--- a/OsmAnd/res/values-el/strings.xml
+++ b/OsmAnd/res/values-el/strings.xml
@@ -1,4 +1,5 @@
-
+
+
Προσθήκη Ετικέτας
Λειτουργία για προχωρημένους…
Στάθμευση
@@ -1084,7 +1085,7 @@
Διατήρηση ενδιάμεσων προορισμών
Οδηγίες προς
Οδηγίες από
- Χάρτης:…
+ Χάρτης:
Προς:
Μέσω:
Από:
@@ -1719,4 +1720,23 @@
Μέτριο
Παχύ
Αναφορά
+ Διατήρηση εμφάνισης στο χάρτη
+ Έξοδος χωρίς αποθήκευση;
+ Επιλογές
+ Παρακαλώ προσθέστε τουλάχιστον ένα σημείο.
+ Εμφάνιση στο χάρτη μετά την αποθήκευση
+ Επαναφορά
+ Επαναφόρτωση
+ Από
+ Παρωνύμιο
+ Άδειες
+ Η απόσταση διορθώθηκε
+ Άνοιγμα του Mapillary
+ Εγκατάσταση
+ Online φωτογραφίες
+ Προσθήκη φωτογραφιών
+ Δεν βρέθηκε κάτι :(
+ Εμφάνιση/απόκρυψη σημειώσεων OSM
+ Εμφάνιση σημειώσεων OSM
+ Απόκρυψη σημειώσεων OSM
diff --git a/OsmAnd/res/values-he/strings.xml b/OsmAnd/res/values-he/strings.xml
index 8332795fef..40e2d39f12 100644
--- a/OsmAnd/res/values-he/strings.xml
+++ b/OsmAnd/res/values-he/strings.xml
@@ -2605,4 +2605,6 @@
פתיחת קוד מיקום
נמעני OSM
סך כל התרומות
-
+ציון כיוון נקודת היעד עם צליל.
+ נא לציין את זמן ההמתנה להישאר במסך תכנון הנתיב.
+
diff --git a/OsmAnd/res/values-is/phrases.xml b/OsmAnd/res/values-is/phrases.xml
index a1745ed276..4fb1e625eb 100644
--- a/OsmAnd/res/values-is/phrases.xml
+++ b/OsmAnd/res/values-is/phrases.xml
@@ -602,8 +602,8 @@
Skógur
Sund
Akkerisfestar
- Viðlegufæri
- Ból
+ Akkerislægi
+ Skipalægi
Bauja, einangruð hætta
Þurrkví
Flotkví
@@ -1353,11 +1353,11 @@
Án pöntunar: nei
Stöð fyrir hreinlætisúrgang: já
Stöð fyrir hreinlætisúrgang: nei
- Rafmagnsinnstungur: nei
- Rafmagnsinnstungur: CEE 17 blátt
- Rafmagnsinnstungur: CEE 7/4
- Rafmagnsinnstungur: CEE 7/5
- Rafmagnsinnstungur: NEMA 5-15
+ Aflgjafi: nei
+ Aflgjafi (innstunga): CEE 17 blátt
+ Aflgjafi (innstunga): CEE 7/4
+ Aflgjafi (innstunga): CEE 7/5
+ Aflgjafi (innstunga): NEMA 5-15
Hámarksfjöldi tjalda
Hámarksfjöldi hjólhýsa
@@ -1782,7 +1782,7 @@
Mataræði
Heilsutengt sérsvið
Tegund af nuddi
- Rafmagnsinnstungur
+ Aflgjafi
Lækningasvið
Heimsóknir
Eiginleikar
@@ -2918,4 +2918,274 @@
Öfug osmósa
Samfélag
Fjölskylda
+ Aðgangur að vatni
+
+Deiling bíla
+ Deiling báta
+ Greiðslukassi
+ Peningaútlán
+ Lokukví skipastiga
+ Nothæf hæð
+ Nothæf hæð (lokað)
+ Nothæf hæð (opið)
+ Nothæf breidd
+
+ Hernaðarsprengjubyrgi
+ Hersvæði
+ Hermálaskrifstofa
+ Hnútur í alþjóðlegu hjólaleiðaneti
+ Hnútur í landsbundnu hjólaleiðaneti
+ Hnútur í svæðisbundnu hjólaleiðaneti
+ Hnútur í svtaðbundnu hjólaleiðaneti
+ Hnútur í alþjóðlegu gönguleiðaneti
+ Hnútur í landsbundnu gönguleiðaneti
+ Hnútur í svæðisbundnu gönguleiðaneti
+ Hnútur í staðbundnu gönguleiðaneti
+
+ Alþjóðleg gönguleið
+ Gönguleið á landsvísu
+ Svæðisbundin gönguleið
+ Staðbundin gönguleið
+ Tilvísun gönguleiðar
+
+ Aðgangur að sumarlagi: einungis inngangur
+ Aðgangur að sumarlagi: einungis útgangur
+ Aðgangur að sumarlagi: út- og inngangur
+
+ Elskendahótel
+
+ PIKEPASS (uppgefið)
+ Routex
+ Ekki tekið við Routex eldsneytiskortum
+ Bancomat
+ Ekki tekið við Bancomat
+ IC Stored Fare
+ Ekki tekið við IC Stored Fare kortum
+ Fyrirframgreiddir miðar
+ JCB
+ Ekki tekið við JCB-kortum
+ Laser
+ Ekki tekið við Laser-kortum
+ Quick
+ Ekki tekið við Quick-kortum
+ Eurowag
+ Ekki tekið við Eurowag-kortum
+ E‑ZPass
+ Ekki tekið við E‑ZPass
+ Euroshell
+ Ekki tekið við Euroshell eldsneytiskortum
+ KITCard
+ Ekki tekið við KITCard
+ Westfalen
+ Ekki tekið við Westfalen-kortum
+ V PAY
+ Ekki tekið við V-PAY kortum
+ Dogecoin
+ Ekki tekið við Dogecoin
+ Cibus
+ Ekki tekið við Cibus-kortum
+ Reiðufjárkort (Geldkarte)
+ Ekki tekið við reiðufjárkortum (Geldkarte)
+ Proton
+ Ekki tekið við Proton-kortum
+ AvantCard
+ Ekki tekið við AvantCard
+ MEP
+ Ekki tekið við MEP
+ Minipay
+ Ekki tekið við Minipay
+ MiniCash
+ Ekki tekið við MiniCash
+ Moneo
+ Ekki tekið við Moneo
+ Monedero 4B
+ Ekki tekið við Monedero 4B
+ Monedero
+ Ekki tekið við Monedero
+ BankAxess
+ Ekki tekið við BankAxess
+ Coinkite
+ Ekki tekið við Coinkite
+ Roadrunner
+ Ekki tekið við Roadrunner-kortum
+ SUBE
+ Ekki tekið við SUBE-kortum
+ Via Verde
+ Ekki tekið við Via Verde
+ U-Key
+ Ekki tekið við U-Key
+ Gjafakort
+ Ekki tekið við gjafakortum
+ Golden Crown
+ Ekki tekið við Golden Crown kortum
+ PRO100
+ Ekki tekið við PRO100-kortum
+ Union-kort
+ Ekki tekið við Union-greiðslukortum
+ MTS-Money
+ Ekki tekið við MTS-Money
+ Yandex.Money
+ Ekki tekið við Yandex.Money
+ Eldsneytissjálfsali
+ Tollsjálfsali
+ Vatnssjálfsali
+ Símaávísanir
+ Greiðsluseðlar
+ Uppgefið
+ Rafmagnsinnstunga: CEE blátt
+ Rafmagnsinnstunga: CEE blátt: straumur
+ Rafmagnsinnstunga: CEE blátt: úttak
+ Rafmagnsinnstunga: CEE rautt 16A
+ Rafmagnsinnstunga: CEE rautt 16A: straumur
+ Rafmagnsinnstunga: CEE rautt 16A: úttak
+ Rafmagnsinnstunga: CEE rautt 32A
+ Rafmagnsinnstunga: CEE rautt 32A: straumur
+ Rafmagnsinnstunga: CEE rautt 32A: úttak
+ Rafmagnsinnstunga: CEE rautt 64A
+ Rafmagnsinnstunga: CEE rautt 64A: straumur
+ Rafmagnsinnstunga: CEE rautt 64A: úttak
+ Rafmagnsinnstunga: CEE rautt 125A
+ Rafmagnsinnstunga: CEE rautt 125A: straumur
+ Rafmagnsinnstunga: CEE rautt 125A: úttak
+ Rafmagnsinnstunga: Type 1
+ Rafmagnsinnstunga: Type 1: straumur
+ Rafmagnsinnstunga: Type 1: úttak
+ Rafmagnsinnstunga: Type 1 combo
+ Rafmagnsinnstunga: Type 1 combo: straumur
+ Rafmagnsinnstunga: Type 1 combo: úttak
+ Rafmagnsinnstunga: Type 2
+ Rafmagnsinnstunga: Type 2: straumur
+ Rafmagnsinnstunga: Type 2: úttak
+ Rafmagnsinnstunga: Type 2 combo
+ Rafmagnsinnstunga: Type 2 combo: straumur
+ Rafmagnsinnstunga: Type 2 combo: úttak
+ Rafmagnsinnstunga: Type 3
+ Rafmagnsinnstunga: Type 3: straumur
+ Rafmagnsinnstunga: Type 3: úttak
+ Rafmagnsinnstunga: CHAdeMO
+ Rafmagnsinnstunga: CHAdeMO: straumur
+ Rafmagnsinnstunga: CHAdeMO: úttak
+ Rafmagnsinnstunga: Staðlað Tesla
+ Rafmagnsinnstunga: Staðlað Tesla: straumur
+ Rafmagnsinnstunga: Staðlað Tesla: úttak
+ Rafmagnsinnstunga: Tesla Supercharger
+ Rafmagnsinnstunga: Tesla Supercharger: straumur
+ Rafmagnsinnstunga: Tesla Supercharger: úttak
+ Rafmagnsinnstunga: Tesla Roadster
+ Rafmagnsinnstunga: Tesla Roadster: straumur
+ Rafmagnsinnstunga: Tesla Roadster: úttak
+ Rafmagnsinnstunga: NEMA 5-15R
+ Bíll: já
+ Bíll: nei
+ Reiðhjól: já
+ Reiðhjól: nei
+ Skellinaðra: já
+ Skellinaðra: nei
+ Flutningabifreið: já
+ Flutningabifreið: nei
+
+ Bílastæðagjöld: já
+ Bílastæðagjöld: nei
+ Bílastæðagjöld
+
+ Amperstyrkur
+ Aflúttak hleðslustöðvar
+
+ Tegund korts: landfræðileg
+ Tegund korts: götukort
+ Tegund korts: skematísk
+ Tegund korts: borgarkort
+ Tegund korts: héraðskort
+
+ Bréfakassi
+ Gata
+ Húsnúmer
+ Íbúð
+
+ Greiðslumiðstöð
+ Greiðslumiðlun
+
+Skjalasafn
+ Ríkissjóður
+ Samgöngustofnun
+ Lagastofnun
+
+ Staðsetning: neðan vatnsyfirborðs
+ Staðsetning: á yfirborði
+ Staðsetning: upphengt
+ Staðsetning: þak
+ Staðsetning: efst á þaki
+ Staðsetning: utandyra
+ Staðsetning: innandyra
+ Staðsetning: pallur
+ Staðsetning: sölubás
+ Staðsetning: brú
+ Staðsetning: veggur
+ Staðsetning: inngangur
+
+ Sýnileiki: hús
+ Sýnileiki: gata
+ Sýnileiki: svæði
+
+ Rafmagnsinnstunga: NEMA 5-15R: straumur
+ Rafmagnsinnstunga: NEMA 5-15R: úttak
+ Rafmagnsinnstunga: NEMA 5-20
+ Rafmagnsinnstunga: NEMA 5-20: straumur
+ Rafmagnsinnstunga: NEMA 5-20: úttak
+ Rafmagnsinnstunga: NEMA 14-30
+ Rafmagnsinnstunga: NEMA 14-30: straumur
+ Rafmagnsinnstunga: NEMA 14-30: úttak
+ Rafmagnsinnstunga: NEMA 14-50
+ Rafmagnsinnstunga: NEMA 14-50: straumur
+ Rafmagnsinnstunga: NEMA 14-50: úttak
+ Rafmagnsinnstunga: Schuko
+ Rafmagnsinnstunga: Schuko: straumur
+ Rafmagnsinnstunga: Schuko: úttak
+ Rafmagnsinnstunga: BS 1363
+ Rafmagnsinnstunga: BS 1363: straumur
+ Rafmagnsinnstunga: BS 1363: úttak
+ Rafmagnsinnstunga: AS/NZS 3112
+ Rafmagnsinnstunga: AS/NZS 3112: straumur
+ Rafmagnsinnstunga: AS/NZS 3112: úttak
+
+ Smávörumarkaður
+ Verslun orkusöluaðila
+ Búlgarska réttrúnaðarkirkjan
+ Armenska postulakirkjan
+ Rúmenska rétttrúnaðarkirkjan
+ Kynningarbásagerð
+ Sólarvarnir
+ Sóthreinsun
+ Flísaleggjari
+ Grisjunarfar
+ Höfuðáttamerki
+ Hliðarmerki
+ Sjómerki á öruggri siglingaleið
+ Höfuðáttadufl
+ Festardufl
+ Hliðardufl
+ Dufl á öruggri siglingaleið
+ Upplýsingar, sjómerki
+ Staur
+ Smábátaaðstaða
+ Toppmerki, sjómerki
+ Virkishlið
+ Kent-hlið fyrir hestaumferð
+ Aðrir greiðslumátar
+ Ekki tekið við öðru en reiðufé og greiðslukortum
+ Aðstaða fyrir atburð
+
+ Myntpressa
+ Staðlað
+
+ Úttak: (rafmagn): nei
+
+ Eigandi
+
+ Panta fyrirfram: nauðsynleg
+ Panta fyrirfram: mælt með
+ Panta fyrirfram: já
+ Panta fyrirfram: nei
+ Panta fyrirfram: einungis meðlimir
+
diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml
index f3f258f86b..6314e1c12e 100644
--- a/OsmAnd/res/values-large/sizes.xml
+++ b/OsmAnd/res/values-large/sizes.xml
@@ -175,7 +175,12 @@
78dp
- 180dp
- 24dp
- 60dp
+ 29dp
+
+ 20dp
+ 23dp
+
+ 180dp
+ 24dp
+ 60dp
\ No newline at end of file
diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml
index 77375d0f0e..5a2242d933 100644
--- a/OsmAnd/res/values-nb/strings.xml
+++ b/OsmAnd/res/values-nb/strings.xml
@@ -844,7 +844,7 @@
Vis noen vektorkartdetaljer (veier etc.) allerede ved lavere zoom.
Utdata for taleveiledning
Velg høyttaleren til å avspille taleveiledningen.
- Taleanropslyd
+ "Telefonanropslyd (også for å avbryte bluetooth-bilstereo)"
Varslingslyd
Media-/musikklyd
Minimum zoomnivå for å bruke vektorkart.
@@ -1873,7 +1873,7 @@
Vis et systemvarsel slik at du kan starte turopptak.
Minimumshastighet for logging
Filter: Still inn minimumshastighet for at et punkt skal logges.
- Logging ved bevegelsesoppdagelse
+ Minsteavstand for logging
Filter: Angi minste avstand fra siste posisjon for at et punkt skal logges.
Minste loggingspresisjon
Filter: Velg minste presisjon som starter loggføring av et punkt.
@@ -2469,7 +2469,7 @@ Representerer området: %1$s x %2$s
Oppgi tidsmellomlager for å beholde plasseringer å sende uten tilkobling
Annet
Tegner feilrettingsinfo
- Vis tegningsytelse
+ Vis opptegningsytelsen.
Ingen data for valgt språk installert. Vil du gå til markedet for å installere det?
Inverter GPX-retning
Passer langs hele turen
@@ -2626,8 +2626,8 @@ Representerer området: %1$s x %2$s
Marker som passert
Unntak inntraff: Notat ble ikke endret
Trykk på handlingsknappen vil slå av/på automatisk kartzoom i henhold til din hastighet.
- Handlingsknappen vil legge til et mål midt på skjermen. Forrige valgte mål vil bli siste mellomliggende mål.
- Handlingsknappen vil erstatte målet med skjermens sentrum.
+ Trykk på handlingsknappen vil legge til et mål midt på skjermen. Det tidligere angitte målet blir det siste mellomliggende målet.
+ Trykk på handlingsknappen vil erstatte målet med posisjonen midt på skjermen.
Trykk på handlingsknappen vil legge til et første mellomliggende punkt midt på skjermen.
Abonner på vår e-postliste om programrabatter og få tre kartnedlastinger til!
Havdybdepunkter for sørlig halvkule
@@ -2663,11 +2663,11 @@ Representerer området: %1$s x %2$s
Aktiver sjømerketillegget
Navnet inneholder for mange store bokstaver. Ønsker du å fortsette?
Legg til interessepunkt
- Handlingsknappen vil vise eller skjule interessepunkter på kartet.
- Handlingsknappen blar gjennom listen nedenfor.
+ Trykk på handlingsknappen vil vise eller skjule interessepunkter på kartet.
+ Trykk på handlingsknappen vil bla gjennom listen nedenfor.
Parameterne kan ikke være tomme
Trykk lenge og dra knappen for å endre dens posisjon på skjermen.
- Velg et spor for å legge dets rutepunkter til markørene. (Kun spor med rutepunkter vises).
+ Velg et spor for å legge til dets rutepunkter til markørene. (Kun spor med rutepunkter er listet opp.)
\@string/shared_string_history
Knippe kart som inneholder havdybdekotelinjer og sjømerker.
OsmAnd samler inn informasjon om hvilke deler av programmet du åpner. Plasseringen din blir aldri sendt, ei heller noe du måtte skrive inn i programmet eller detaljer om områder som vises, søkes etter, eller lastes ned.
@@ -2690,7 +2690,8 @@ Representerer området: %1$s x %2$s
Åpen til
Stenger
Åpner
- Åpen på
+ Åpner
GPX-fil med de valgte notatenes koordinater og data.
GPX-fil med alle notaters koordinater og data.
+ Trykk på handlingsknappen vil legge til et interessepunkt midt på skjermen.
diff --git a/OsmAnd/res/values-pl/phrases.xml b/OsmAnd/res/values-pl/phrases.xml
index a09eeacecf..6a18a2c4ad 100644
--- a/OsmAnd/res/values-pl/phrases.xml
+++ b/OsmAnd/res/values-pl/phrases.xml
@@ -227,7 +227,7 @@
Szkoła nauki jazdy
Szkoła
Przedszkole
- Kolegium
+ Uczelnia
Uniwersytet
Placówka społeczna
@@ -715,7 +715,7 @@
Stocznia
Jubiler
Roboty drogowe
- Miejsce do base jumpingu
+ Base jumping
Ice stock
Dzieło sztuki
Karuzela
@@ -1197,7 +1197,7 @@
Adwentyści
Kościół Nazarejczyka
Staroobrzędowcy
- Serbski ortodoksyjny
+ Serbski prawosławny
Apostolski Kościół Ormiański
Holenderski Kościół Reformowany
Kościół Apostolski
diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml
index 225d192b4d..49b8489c9d 100644
--- a/OsmAnd/res/values-pt-rBR/strings.xml
+++ b/OsmAnd/res/values-pt-rBR/strings.xml
@@ -2229,7 +2229,7 @@ Pôr do Sol: %2$s
Seu destino está localizado em uma área de acesso privado. Você quer permitir acesso à estradas privadas para esta viagem?
Reiniciar pesquisa
Aumentar o raio de busca
- Não encontrou nada :(
+ Nada encontrado :(
Modificar o texto da pesquisa ou aumentar o raio de busca.
Mostrar/ocultar Anotações do OSM
Mostrar Anotações do OSM
diff --git a/OsmAnd/res/values/attrs.xml b/OsmAnd/res/values/attrs.xml
index ce035224d8..229b01fd7f 100644
--- a/OsmAnd/res/values/attrs.xml
+++ b/OsmAnd/res/values/attrs.xml
@@ -25,6 +25,7 @@
+
diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml
index 4231a9b5de..4dc952ec36 100644
--- a/OsmAnd/res/values/colors.xml
+++ b/OsmAnd/res/values/colors.xml
@@ -341,7 +341,7 @@
#ffffff
#17191a
#b3b3b3
- #536dfe
+ #454a4d
#212121
#cccccc
#a6a6a6
@@ -349,9 +349,11 @@
#5baf3f
#c66545
#f2f2f2
- #536dfe
+ #222526
#536dfe
#d28521
+ #b3b3b3
+ #666666
#ffffff
#17191a
@@ -371,6 +373,11 @@
#d28521
#727272
- #808080
+ #f0f0f0
+ #222526
+ #2f7af5
+ #e69122
+
+ #808080
\ No newline at end of file
diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml
index 356ac895fc..f8b3d8a2f3 100644
--- a/OsmAnd/res/values/sizes.xml
+++ b/OsmAnd/res/values/sizes.xml
@@ -248,7 +248,12 @@
52dp
- 120dp
- 16dp
- 40dp
+ 19dp
+
+ 13dp
+ 15dp
+
+ 120dp
+ 16dp
+ 40dp
\ No newline at end of file
diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml
index b3fe484df3..324296db60 100644
--- a/OsmAnd/res/values/styles.xml
+++ b/OsmAnd/res/values/styles.xml
@@ -132,6 +132,7 @@
- @drawable/dashboard_button_light
- @color/ctx_menu_info_view_bg_light
- @drawable/context_menu_controller_bg_light
+ - @drawable/context_menu_controller_text_color_light
- @color/ctx_menu_buttons_divider_light
- @color/search_background_dark
- @drawable/ic_action_mode_back
@@ -321,6 +322,7 @@
- @drawable/dashboard_button_dark
- @color/ctx_menu_info_view_bg_dark
- @drawable/context_menu_controller_bg_dark
+ - @drawable/context_menu_controller_text_color_dark
- @color/ctx_menu_buttons_divider_dark
- @color/color_white
- @drawable/switch_ex_background_dark
diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java
index e792b0113f..ba61cd1b36 100644
--- a/OsmAnd/src/net/osmand/AndroidUtils.java
+++ b/OsmAnd/src/net/osmand/AndroidUtils.java
@@ -4,6 +4,7 @@ package net.osmand;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.PointF;
@@ -11,6 +12,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.os.IBinder;
+import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
@@ -118,6 +120,21 @@ public class AndroidUtils {
return null;
}
+ public static ColorStateList createColorStateList(Context ctx, boolean night,
+ @ColorRes int lightNormal, @ColorRes int lightPressed,
+ @ColorRes int darkNormal, @ColorRes int darkPressed) {
+ return new ColorStateList(
+ new int[][]{
+ new int[]{android.R.attr.state_pressed},
+ new int[]{}
+ },
+ new int[]{
+ ContextCompat.getColor(ctx, night ? darkPressed : lightPressed),
+ ContextCompat.getColor(ctx, night ? darkNormal : lightNormal)
+ }
+ );
+ }
+
public static StateListDrawable createStateListDrawable(Context ctx, boolean night,
@DrawableRes int lightNormal, @DrawableRes int lightPressed,
@DrawableRes int darkNormal, @DrawableRes int darkPressed) {
@@ -198,6 +215,12 @@ public class AndroidUtils {
);
}
+ public static int resolveAttribute(Context ctx, int attribute) {
+ TypedValue outValue = new TypedValue();
+ ctx.getTheme().resolveAttribute(attribute, outValue, true);
+ return outValue.resourceId;
+ }
+
public static int getStatusBarHeight(Context ctx) {
int result = 0;
int resourceId = ctx.getResources().getIdentifier("status_bar_height", "dimen", "android");
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 8e805f6056..ecf3a58e25 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -842,9 +842,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
boolean mapControlsVisible = findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE;
boolean night = app.getDaynightHelper().isNightModeForMapControls();
boolean quickSearchTopBar = getTopToolbarController(TopToolbarControllerType.QUICK_SEARCH) != null;
+ boolean contextMenuTopBar = getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU) != null;
boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE;
boolean markerTopBar = findViewById(R.id.map_markers_top_bar).getVisibility() == View.VISIBLE;
- if ((quickSearchTopBar || mapTopBar) && mapControlsVisible) {
+ if (((quickSearchTopBar || mapTopBar) && mapControlsVisible) || contextMenuTopBar) {
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
} else if (markerTopBar && mapControlsVisible) {
colorId = R.color.status_bar_dark;
@@ -1885,11 +1886,13 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
public void showTopToolbar(TopToolbarController controller) {
MapInfoLayer mapInfoLayer = getMapLayers().getMapInfoLayer();
mapInfoLayer.addTopToolbarController(controller);
+ updateStatusBarColor();
}
public void hideTopToolbar(TopToolbarController controller) {
MapInfoLayer mapInfoLayer = getMapLayers().getMapInfoLayer();
mapInfoLayer.removeTopToolbarController(controller);
+ updateStatusBarColor();
}
public void registerActivityResultListener(ActivityResultListener listener) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java
index 985bd9eac2..e471eede5b 100644
--- a/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java
+++ b/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java
@@ -78,7 +78,7 @@ public class AppModeDialog {
} else {
if (useMapTheme) {
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.route_info_unchecked_mode_icon_color));
- AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
+ iv.setBackgroundResource(AndroidUtils.resolveAttribute(ctx, android.R.attr.selectableItemBackground));
} else {
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
}
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuBuilder.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuBuilder.java
index 1b213df41e..b241fbb808 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuBuilder.java
@@ -42,7 +42,7 @@ public class AudioVideoNoteMenuBuilder extends MenuBuilder {
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(view.getContext());
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
Date date = new Date(recording.getFile().lastModified());
- buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + " — " + timeFormat.format(date),
+ buildRow(view, R.drawable.ic_action_data, null, dateFormat.format(date) + " — " + timeFormat.format(date),
0, false, null, false, 0, false, null, false);
buildPlainMenuItems(view);
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java
index fef72984e8..e46e4ab81f 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java
@@ -86,7 +86,7 @@ public class AudioVideoNoteMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
if (mRecording.isPhoto()) {
return getIcon(R.drawable.ic_action_photo_dark, R.color.audio_video_icon_color);
} else if (mRecording.isAudio()) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
index f6f7788041..a6d14121b6 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
@@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
+import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
@@ -37,7 +38,7 @@ import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
import net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
import net.osmand.plus.mapcontextmenu.editors.RtePtEditor;
@@ -418,7 +419,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
public boolean navigateInPedestrianMode() {
- return menuController instanceof ParkingPositionMenuController;
+ if (menuController != null) {
+ return menuController.navigateInPedestrianMode();
+ }
+ return false;
}
public boolean close() {
@@ -597,7 +601,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
historyStack.add(menuData);
}
if (!(menuController instanceof MapDataMenuController)) {
- menuController.buildMapDownloadButton(latLon);
+ menuController.buildMapDownloadButtonAndSizeInfo(latLon);
}
return true;
} else {
@@ -1135,13 +1139,37 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
return menuController != null && menuController.displayDistanceDirection();
}
- public boolean displayAdditionalTypeStrInHours() {
- return menuController != null && menuController.displayAdditionalTypeStrInHours();
+ public String getSubtypeStr() {
+ if (menuController != null) {
+ return menuController.getSubtypeStr();
+ }
+ return "";
}
- public int getTimeStrColor() {
+ public Drawable getSubtypeIcon() {
if (menuController != null) {
- return menuController.getTimeStrColor();
+ return menuController.getSubtypeIcon();
+ }
+ return null;
+ }
+
+ public int getAdditionalInfoColor() {
+ if (menuController != null) {
+ return menuController.getAdditionalInfoColor();
+ }
+ return 0;
+ }
+
+ public String getAdditionalInfo() {
+ if (menuController != null) {
+ return menuController.getAdditionalInfoStr();
+ }
+ return "";
+ }
+
+ public int getAdditionalInfoIconRes() {
+ if (menuController != null) {
+ return menuController.getAdditionalInfoIconRes();
}
return 0;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index bed9bd0fb6..72099d943e 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -14,6 +14,7 @@ import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.GestureDetector;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -34,6 +35,7 @@ import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
+import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.OsmandApplication;
@@ -46,10 +48,11 @@ import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapTileView;
+import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.views.controls.SingleTapConfirm;
import net.osmand.util.Algorithms;
@@ -198,8 +201,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
});
// Bottom title button
- final View bottomTitleButton = view.findViewById(R.id.title_button_bottom_view);
- bottomTitleButton.setOnClickListener(new View.OnClickListener() {
+ final View bottomTitleButtonView = view.findViewById(R.id.title_button_bottom_view);
+ bottomTitleButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TitleButtonController bottomTitleButtonController = menu.getBottomTitleButtonController();
@@ -211,8 +214,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
// Progress bar
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
- progressButton.setImageDrawable(getIcon(R.drawable.ic_action_remove_dark,
- !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
+ progressButton.setImageDrawable(getIcon(R.drawable.ic_action_remove_dark, R.color.ctx_menu_buttons_icon_color));
progressButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -388,7 +390,22 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
GridView transportStopRoutesGrid = (GridView) view.findViewById(R.id.transport_stop_routes_grid);
List transportStopRoutes = menu.getTransportStopRoutes();
if (transportStopRoutes != null && transportStopRoutes.size() > 0) {
- TransportStopRouteAdapter adapter = new TransportStopRouteAdapter(getContext(), transportStopRoutes);
+ final TransportStopRouteAdapter adapter = new TransportStopRouteAdapter(getMyApplication(), transportStopRoutes, nightMode);
+ adapter.setListener(new TransportStopRouteAdapter.OnClickListener() {
+ @Override
+ public void onClick(int position) {
+ TransportStopRoute route = adapter.getItem(position);
+ if (route != null) {
+ PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
+ route.getDescription(getMapActivity().getMyApplication(), false));
+ menu.show(menu.getLatLon(), pd, route);
+ TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
+ stopsLayer.setRoute(route);
+ int cz = route.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
+ getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
+ }
+ }
+ });
transportStopRoutesGrid.setAdapter(adapter);
transportStopRoutesGrid.setVisibility(View.VISIBLE);
} else {
@@ -513,6 +530,23 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
return view;
}
+ private void toggleDetailsHideButton() {
+ int menuState = menu.getCurrentMenuState();
+ final boolean showShowHideButton = menuState == MenuState.HALF_SCREEN || (!menu.isLandscapeLayout() && menuState == MenuState.FULL_SCREEN);
+ TextView detailsButton = (TextView) view.findViewById(R.id.context_menu_details_button);
+ detailsButton.setText(showShowHideButton ? R.string.shared_string_collapse : R.string.description);
+ detailsButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (showShowHideButton) {
+ openMenuHeaderOnly();
+ } else {
+ openMenuFullScreen();
+ }
+ }
+ });
+ }
+
private void deactivate(View view) {
view.setEnabled(false);
view.setAlpha(0.5f);
@@ -547,6 +581,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
changeMenuState(getViewY(), true, true, false);
}
+ public void openMenuHeaderOnly() {
+ changeMenuState(getViewY(), true, false, true);
+ }
+
public void openMenuHalfScreen() {
int oldMenuState = menu.getCurrentMenuState();
if (oldMenuState == MenuState.HEADER_ONLY) {
@@ -579,6 +617,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
restoreCustomMapRatio();
menu.updateControlsVisibility(true);
doBeforeMenuStateChange(oldMenuState, newMenuState);
+ toggleDetailsHideButton();
}
applyPosY(currentY, needCloseMenu, needMapAdjust, oldMenuState, newMenuState, 0);
@@ -675,7 +714,22 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
origMarkerY = box.getCenterPixelY();
}
- private void updateButtonsAndProgress() {
+ private void enableDisableButtons(View buttonView, TextView button, boolean enabled) {
+ if (enabled) {
+ ColorStateList buttonColorStateList = AndroidUtils.createColorStateList(getContext(), nightMode,
+ R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,
+ R.color.ctx_menu_controller_button_text_color_dark_n, R.color.ctx_menu_controller_button_text_color_dark_p);
+
+ buttonView.setBackgroundResource(nightMode ? R.drawable.context_menu_controller_bg_dark : R.drawable.context_menu_controller_bg_light);
+ button.setTextColor(buttonColorStateList);
+ } else {
+ buttonView.setBackgroundResource(nightMode ? R.drawable.context_menu_controller_disabled_bg_dark: R.drawable.context_menu_controller_disabled_bg_light);
+ button.setTextColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_controller_disabled_text_color_dark : R.color.ctx_menu_controller_disabled_text_color_light));
+ }
+ button.setEnabled(enabled);
+ }
+
+ public void updateButtonsAndProgress() {
if (view != null) {
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
@@ -684,10 +738,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
TitleProgressController titleProgressController = menu.getTitleProgressController();
- ColorStateList textColorStateList = ContextCompat.getColorStateList(getContext(),
- nightMode ? R.color.context_menu_controller_text_color_dark : R.color.context_menu_controller_text_color_light);
- int buttonViewBackgroundResId = nightMode ? R.drawable.context_menu_controller_bg_dark : R.drawable.context_menu_controller_bg_light;
-
// Title buttons
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
@@ -698,16 +748,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final TextView leftTitleButton = (TextView) view.findViewById(R.id.title_button);
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
if (leftTitleButtonController != null) {
+ enableDisableButtons(leftTitleButtonView, leftTitleButton, leftTitleButtonController.enabled);
leftTitleButton.setText(leftTitleButtonController.caption);
- leftTitleButton.setTextColor(textColorStateList);
if (leftTitleButtonController.visible) {
leftTitleButtonView.setVisibility(View.VISIBLE);
- leftTitleButtonView.setBackgroundResource(buttonViewBackgroundResId);
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
- if (leftIcon != null) {
- leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
- leftTitleButton.setCompoundDrawablePadding(dpToPx(8f));
- }
+ Drawable rightIcon = leftTitleButtonController.getRightIcon();
+ leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
+ leftTitleButton.setCompoundDrawablePadding(dpToPx(8f));
+ ((LinearLayout) leftTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
if (leftTitleButtonController.needRightText) {
titleButtonRightText.setText(leftTitleButtonController.rightTextCaption);
@@ -727,16 +776,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final View rightTitleButtonView = view.findViewById(R.id.title_button_right_view);
final TextView rightTitleButton = (TextView) view.findViewById(R.id.title_button_right);
if (rightTitleButtonController != null) {
+ enableDisableButtons(rightTitleButtonView, rightTitleButton, rightTitleButtonController.enabled);
rightTitleButton.setText(rightTitleButtonController.caption);
- rightTitleButton.setTextColor(textColorStateList);
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
- if (rightTitleButtonController.visible) {
- rightTitleButtonView.setBackgroundResource(buttonViewBackgroundResId);
- }
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
- rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
+ Drawable rightIcon = rightTitleButtonController.getRightIcon();
+ rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
rightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
+ ((LinearLayout) rightTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
rightTitleButtonView.setVisibility(View.INVISIBLE);
}
@@ -745,16 +793,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final View bottomTitleButtonView = view.findViewById(R.id.title_button_bottom_view);
final TextView bottomTitleButton = (TextView) view.findViewById(R.id.title_button_bottom);
if (bottomTitleButtonController != null) {
+ enableDisableButtons(bottomTitleButtonView, bottomTitleButton, bottomTitleButtonController.enabled);
bottomTitleButton.setText(bottomTitleButtonController.caption);
- bottomTitleButton.setTextColor(textColorStateList);
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
- if (bottomTitleButtonController.visible) {
- bottomTitleButtonView.setBackgroundResource(buttonViewBackgroundResId);
- }
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
- bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
+ Drawable rightIcon = bottomTitleButtonController.getRightIcon();
+ bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
bottomTitleButton.setCompoundDrawablePadding(dpToPx(8f));
+ ((LinearLayout) bottomTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
bottomTitleButtonView.setVisibility(View.GONE);
}
@@ -771,18 +818,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final View leftDownloadButtonView = view.findViewById(R.id.download_button_left_view);
final TextView leftDownloadButton = (TextView) view.findViewById(R.id.download_button_left);
if (leftDownloadButtonController != null) {
+ enableDisableButtons(leftDownloadButtonView, leftDownloadButton, leftDownloadButtonController.enabled);
leftDownloadButton.setText(leftDownloadButtonController.caption);
- leftDownloadButton.setTextColor(textColorStateList);
leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
- if (leftDownloadButtonController.visible) {
- leftDownloadButtonView.setBackgroundResource(buttonViewBackgroundResId);
- }
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
- if (leftIcon != null) {
- leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
- leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
- }
+ Drawable rightIcon = leftDownloadButtonController.getRightIcon();
+ leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
+ leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
+ ((LinearLayout) leftDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
leftDownloadButtonView.setVisibility(View.INVISIBLE);
}
@@ -791,16 +835,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final View rightDownloadButtonView = view.findViewById(R.id.download_button_right_view);
final TextView rightDownloadButton = (TextView) view.findViewById(R.id.download_button_right);
if (rightDownloadButtonController != null) {
+ enableDisableButtons(rightDownloadButtonView, rightDownloadButton, rightDownloadButtonController.enabled);
rightDownloadButton.setText(rightDownloadButtonController.caption);
- rightDownloadButton.setTextColor(textColorStateList);
rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
- if (rightDownloadButtonController.visible) {
- rightDownloadButtonView.setBackgroundResource(buttonViewBackgroundResId);
- }
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
- rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
+ Drawable rightIcon = rightDownloadButtonController.getRightIcon();
+ rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
rightDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
+ ((LinearLayout) rightDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
rightDownloadButtonView.setVisibility(View.INVISIBLE);
}
@@ -835,8 +878,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
OsmandApplication app = getMyApplication();
if (app != null && view != null) {
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
- Drawable icon = menu.getLeftIcon();
- int iconId = menu.getLeftIconId();
+ Drawable icon = menu.getRightIcon();
+ int iconId = menu.getRightIconId();
if (icon != null) {
iconView.setImageDrawable(icon);
iconView.setVisibility(View.VISIBLE);
@@ -929,8 +972,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
OsmandApplication app = getMyApplication();
if (app != null && view != null) {
final ImageView buttonFavorite = (ImageView) view.findViewById(R.id.context_menu_fav_image_view);
- buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(),
- !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
+ buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(), R.color.ctx_menu_buttons_icon_color));
String favActionString = getString(menu.getFavActionStringId());
buttonFavorite.setContentDescription(favActionString);
((TextView) view.findViewById(R.id.context_menu_fav_text_view)).setText(favActionString);
@@ -945,6 +987,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
this.initLayout = true;
this.centered = true;
}
+ updateButtonsAndProgress();
runLayoutListener();
}
}
@@ -1132,61 +1175,43 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
line2Str.append(streetStr);
}
- line2.setText(line2Str.toString());
+ if (!TextUtils.isEmpty(line2Str)) {
+ line2.setText(line2Str.toString());
+ line2.setVisibility(View.VISIBLE);
+ } else {
+ line2.setVisibility(View.GONE);
+ }
}
TextView line3 = (TextView) view.findViewById(R.id.context_menu_line3);
- String additionalTypeStr = menu.getAdditionalTypeStr();
- boolean displayAdditionalTypeStrInHours = menu.displayAdditionalTypeStrInHours();
- boolean emptyAdditionalTypeStr = TextUtils.isEmpty(additionalTypeStr);
- if (emptyAdditionalTypeStr || displayAdditionalTypeStrInHours) {
+ String subtypeStr = menu.getSubtypeStr();
+ if (TextUtils.isEmpty(subtypeStr)) {
line3.setVisibility(View.GONE);
} else {
line3.setVisibility(View.VISIBLE);
- line3.setText(additionalTypeStr);
- Drawable icon = menu.getAdditionalLineTypeIcon();
+ line3.setText(subtypeStr);
+ Drawable icon = menu.getSubtypeIcon();
line3.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
line3.setCompoundDrawablePadding(dpToPx(5f));
}
- TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view);
- OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
- boolean containsOpeningHours = openingHoursInfo != null && openingHoursInfo.containsInfo();
- if (containsOpeningHours || (displayAdditionalTypeStrInHours && !emptyAdditionalTypeStr)) {
- int colorId;
- if (containsOpeningHours) {
- colorId = openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
- } else {
- colorId = menu.getTimeStrColor();
- }
- String timeInfo = "";
- if (containsOpeningHours) {
- if (openingHoursInfo.isOpened24_7()) {
- timeInfo = getString(R.string.shared_string_is_open_24_7);
- } else if (!Algorithms.isEmpty(openingHoursInfo.getNearToOpeningTime())) {
- timeInfo = getString(R.string.will_open_at) + " " + openingHoursInfo.getNearToOpeningTime();
- } else if (!Algorithms.isEmpty(openingHoursInfo.getOpeningTime())) {
- timeInfo = getString(R.string.open_from) + " " + openingHoursInfo.getOpeningTime();
- } else if (!Algorithms.isEmpty(openingHoursInfo.getNearToClosingTime())) {
- timeInfo = getString(R.string.will_close_at) + " " + openingHoursInfo.getNearToClosingTime();
- } else if (!Algorithms.isEmpty(openingHoursInfo.getClosingTime())) {
- timeInfo = getString(R.string.open_till) + " " + openingHoursInfo.getClosingTime();
- } else if (!Algorithms.isEmpty(openingHoursInfo.getOpeningDay())) {
- timeInfo = getString(R.string.will_open_on) + " " + openingHoursInfo.getOpeningDay() + ".";
- }
- } else {
- timeInfo = additionalTypeStr;
- }
+ TextView additionalInfoTextView = (TextView) view.findViewById(R.id.additional_info_text_view);
+ String additionalInfoStr = menu.getAdditionalInfo();
+ if (!TextUtils.isEmpty(additionalInfoStr)) {
+ int colorId = menu.getAdditionalInfoColor();
+ int additionalInfoIconRes = menu.getAdditionalInfoIconRes();
if (colorId != 0) {
- openingHoursTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
- Drawable drawable = getIcon(R.drawable.ic_action_opening_hour_16, colorId);
- openingHoursTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
- openingHoursTextView.setCompoundDrawablePadding(dpToPx(8));
+ additionalInfoTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
+ if (additionalInfoIconRes != 0) {
+ Drawable additionalIcon = getIcon(additionalInfoIconRes, colorId);
+ additionalInfoTextView.setCompoundDrawablesWithIntrinsicBounds(additionalIcon, null, null, null);
+ additionalInfoTextView.setCompoundDrawablePadding(dpToPx(8));
+ }
}
- openingHoursTextView.setText(timeInfo);
- openingHoursTextView.setVisibility(View.VISIBLE);
+ additionalInfoTextView.setText(additionalInfoStr);
+ additionalInfoTextView.setVisibility(View.VISIBLE);
} else {
- openingHoursTextView.setVisibility(View.GONE);
+ additionalInfoTextView.setVisibility(View.GONE);
}
}
updateCompassVisibility();
@@ -1482,7 +1507,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
boolean progressVisible = menu.getTitleProgressController() != null && menu.getTitleProgressController().visible;
updateButtonsAndProgress();
if (wasProgressVisible != progressVisible) {
- runLayoutListener();
+ refreshTitle();
}
}
}
@@ -1491,7 +1516,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (created) {
menu.updateData();
updateButtonsAndProgress();
- runLayoutListener();
+ refreshTitle();
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
index 1fb6c2d977..cd43f295ec 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
@@ -5,8 +5,10 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
+import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
@@ -17,7 +19,6 @@ import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.TypedValue;
import android.view.Gravity;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@@ -27,6 +28,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
+import net.osmand.AndroidUtils;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.Amenity;
import net.osmand.data.FavouritePoint;
@@ -51,7 +53,7 @@ import net.osmand.plus.mapcontextmenu.builders.cards.CardsRowBuilder;
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard;
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask;
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.views.TransportStopsLayer;
@@ -99,6 +101,7 @@ public class MenuBuilder {
public class PlainMenuItem {
private int iconId;
+ private String buttonText;
private String text;
private boolean needLinks;
private boolean url;
@@ -106,10 +109,11 @@ public class MenuBuilder {
private CollapsableView collapsableView;
private OnClickListener onClickListener;
- public PlainMenuItem(int iconId, String text, boolean needLinks, boolean url,
+ public PlainMenuItem(int iconId, String buttonText, String text, boolean needLinks, boolean url,
boolean collapsable, CollapsableView collapsableView,
OnClickListener onClickListener) {
this.iconId = iconId;
+ this.buttonText = buttonText;
this.text = text;
this.needLinks = needLinks;
this.url = url;
@@ -122,6 +126,10 @@ public class MenuBuilder {
return iconId;
}
+ public String getButtonText() {
+ return buttonText;
+ }
+
public String getText() {
return text;
}
@@ -289,7 +297,7 @@ public class MenuBuilder {
buildTitleRow(view);
}
if (showTransportRoutes()) {
- buildRow(view, 0, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false),
+ buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false),
false, 0, false, null, true);
}
buildNearestWikiRow(view);
@@ -324,7 +332,7 @@ public class MenuBuilder {
protected void buildPlainMenuItems(View view) {
for (PlainMenuItem item : plainMenuItems) {
- buildRow(view, item.getIconId(), item.getText(), 0, item.collapsable, item.collapsableView,
+ buildRow(view, item.getIconId(), item.getButtonText(), item.getText(), 0, item.collapsable, item.collapsableView,
item.isNeedLinks(), 0, item.isUrl(), item.getOnClickListener(), false);
}
}
@@ -349,14 +357,14 @@ public class MenuBuilder {
if (mapContextMenu != null) {
String title = mapContextMenu.getTitleStr();
if (title.length() > TITLE_LIMIT) {
- buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null, false);
+ buildRow(view, R.drawable.ic_action_note_dark, null, title, 0, false, null, false, 0, false, null, false);
}
}
}
protected void buildNearestWikiRow(View view) {
if (processNearstWiki() && nearestWiki.size() > 0) {
- buildRow(view, R.drawable.ic_action_wikipedia, app.getString(R.string.wiki_around) + " (" + nearestWiki.size()+")", 0,
+ buildRow(view, R.drawable.ic_action_wikipedia, null, app.getString(R.string.wiki_around) + " (" + nearestWiki.size()+")", 0,
true, getCollapsableWikiView(view.getContext(), true),
false, 0, false, null, false);
}
@@ -380,7 +388,7 @@ public class MenuBuilder {
}
}
});
- buildRow(view, R.drawable.ic_action_photo_dark, app.getString(R.string.online_photos), 0, true,
+ buildRow(view, R.drawable.ic_action_photo_dark, null, app.getString(R.string.online_photos), 0, true,
collapsableView, false, 1, false, null, false);
if (needUpdateOnly && onlinePhotoCards != null) {
@@ -437,14 +445,14 @@ public class MenuBuilder {
firstRow = false;
}
- public View buildRow(View view, int iconId, String text, int textColor,
+ public View buildRow(View view, int iconId, String buttonText, String text, int textColor,
boolean collapsable, final CollapsableView collapsableView,
boolean needLinks, int textLinesLimit, boolean isUrl, OnClickListener onClickListener, boolean matchWidthDivider) {
- return buildRow(view, iconId == 0 ? null : getRowIcon(iconId), text, textColor, null, collapsable, collapsableView,
+ return buildRow(view, iconId == 0 ? null : getRowIcon(iconId), buttonText, text, textColor, null, collapsable, collapsableView,
needLinks, textLinesLimit, isUrl, onClickListener, matchWidthDivider);
}
- public View buildRow(final View view, Drawable icon, final String text, int textColor, String secondaryText,
+ public View buildRow(final View view, Drawable icon, final String buttonText, final String text, int textColor, String secondaryText,
boolean collapsable, final CollapsableView collapsableView, boolean needLinks,
int textLinesLimit, boolean isUrl, OnClickListener onClickListener, boolean matchWidthDivider) {
@@ -461,7 +469,7 @@ public class MenuBuilder {
ll.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
ll.setLayoutParams(llParams);
- ll.setBackgroundResource(resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
+ ll.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
ll.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@@ -538,6 +546,20 @@ public class MenuBuilder {
llText.addView(textViewSecondary);
}
+ //Button
+ if (!TextUtils.isEmpty(buttonText)) {
+ TextViewEx buttonTextView = new TextViewEx(view.getContext());
+ LinearLayout.LayoutParams buttonTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ buttonTextViewParams.gravity = Gravity.CENTER_VERTICAL;
+ buttonTextViewParams.setMargins(dpToPx(8), 0, dpToPx(8), 0);
+ buttonTextView.setLayoutParams(buttonTextViewParams);
+ buttonTextView.setTypeface(FontCache.getRobotoMedium(view.getContext()));
+ buttonTextView.setAllCaps(true);
+ buttonTextView.setTextColor(ContextCompat.getColor(view.getContext(), !light ? R.color.ctx_menu_controller_button_text_color_dark_n : R.color.ctx_menu_controller_button_text_color_light_n));
+ buttonTextView.setText(buttonText);
+ ll.addView(buttonTextView);
+ }
+
final ImageView iconViewCollapse = new ImageView(view.getContext());
if (collapsable && collapsableView != null) {
// Icon
@@ -614,7 +636,7 @@ public class MenuBuilder {
ll.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
ll.setLayoutParams(llParams);
- ll.setBackgroundResource(resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
+ ll.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
// Empty
LinearLayout llIcon = new LinearLayout(view.getContext());
@@ -635,7 +657,7 @@ public class MenuBuilder {
buttonView.setPadding(dpToPx(10f), 0, dpToPx(10f), 0);
buttonView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
//buttonView.setTextSize(view.getResources().getDimension(resolveAttribute(view.getContext(), R.dimen.default_desc_text_size)));
- buttonView.setTextColor(view.getResources().getColor(resolveAttribute(view.getContext(), R.attr.contextMenuButtonColor)));
+ buttonView.setTextColor(view.getResources().getColor(AndroidUtils.resolveAttribute(view.getContext(), R.attr.contextMenuButtonColor)));
buttonView.setText(text);
if (buttonIcon != null) {
@@ -671,13 +693,17 @@ public class MenuBuilder {
}
public void addPlainMenuItem(int iconId, String text, boolean needLinks, boolean isUrl, OnClickListener onClickListener) {
- plainMenuItems.add(new PlainMenuItem(iconId, text, needLinks, isUrl, false, null, onClickListener));
+ plainMenuItems.add(new PlainMenuItem(iconId, null, text, needLinks, isUrl, false, null, onClickListener));
+ }
+
+ public void addPlainMenuItem(int iconId, String buttonText, String text, boolean needLinks, boolean isUrl, OnClickListener onClickListener) {
+ plainMenuItems.add(new PlainMenuItem(iconId, buttonText, text, needLinks, isUrl, false, null, onClickListener));
}
public void addPlainMenuItem(int iconId, String text, boolean needLinks, boolean isUrl,
boolean collapsable, CollapsableView collapsableView,
OnClickListener onClickListener) {
- plainMenuItems.add(new PlainMenuItem(iconId, text, needLinks, isUrl, collapsable, collapsableView, onClickListener));
+ plainMenuItems.add(new PlainMenuItem(iconId, null, text, needLinks, isUrl, collapsable, collapsableView, onClickListener));
}
public void clearPlainMenuItems() {
@@ -699,12 +725,6 @@ public class MenuBuilder {
}
}
- public int resolveAttribute(Context ctx, int attribute) {
- TypedValue outValue = new TypedValue();
- ctx.getTheme().resolveAttribute(attribute, outValue, true);
- return outValue.resourceId;
- }
-
public int dpToPx(float dp) {
Resources r = app.getResources();
return (int) TypedValue.applyDimension(
@@ -714,69 +734,90 @@ public class MenuBuilder {
);
}
- private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener) {
- if (!isFirstRow()) {
+ private View buildTransportRowItem(View view, TransportStopRoute route, OnClickListener listener) {
+ LinearLayout baseView = new LinearLayout(view.getContext());
+ baseView.setOrientation(LinearLayout.HORIZONTAL);
+ LinearLayout.LayoutParams llBaseViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
+ baseView.setLayoutParams(llBaseViewParams);
+ baseView.setPadding(dpToPx(16), 0, dpToPx(16), dpToPx(12));
+ baseView.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
+
+ TextViewEx transportRect = new TextViewEx(view.getContext());
+ LinearLayout.LayoutParams trParams = new LinearLayout.LayoutParams(dpToPx(32), dpToPx(18));
+ trParams.setMargins(0, dpToPx(16), 0, 0);
+ transportRect.setLayoutParams(trParams);
+ transportRect.setGravity(Gravity.CENTER);
+ transportRect.setAllCaps(true);
+ transportRect.setTypeface(FontCache.getRobotoMedium(view.getContext()));
+ transportRect.setTextColor(Color.WHITE);
+ transportRect.setTextSize(10);
+
+ GradientDrawable shape = new GradientDrawable();
+ shape.setShape(GradientDrawable.RECTANGLE);
+ shape.setCornerRadius(dpToPx(3));
+ shape.setColor(route.getColor(mapActivity.getMyApplication(), !light));
+
+ transportRect.setBackgroundDrawable(shape);
+ transportRect.setText(route.route.getRef());
+ baseView.addView(transportRect);
+
+ LinearLayout infoView = new LinearLayout(view.getContext());
+ infoView.setOrientation(LinearLayout.VERTICAL);
+ LinearLayout.LayoutParams infoViewLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ infoViewLayoutParams.setMargins(dpToPx(16), dpToPx(12), dpToPx(16), 0);
+ infoView.setLayoutParams(infoViewLayoutParams);
+ baseView.addView(infoView);
+
+ TextView titleView = new TextView(view.getContext());
+ LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ titleView.setLayoutParams(titleParams);
+ titleView.setTextSize(16);
+ titleView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
+ titleView.setText(route.getDescription(getMapActivity().getMyApplication(), true));
+ infoView.addView(titleView);
+
+ LinearLayout typeView = new LinearLayout(view.getContext());
+ typeView.setOrientation(LinearLayout.HORIZONTAL);
+ LinearLayout.LayoutParams typeViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ typeViewParams.setMargins(0, dpToPx(8), 0, 0);
+ typeView.setGravity(Gravity.CENTER);
+ typeView.setLayoutParams(typeViewParams);
+ infoView.addView(typeView);
+
+ ImageView typeImageView = new ImageView(view.getContext());
+ LinearLayout.LayoutParams typeImageParams = new LinearLayout.LayoutParams(dpToPx(16), dpToPx(16));
+ typeImageParams.setMargins(dpToPx(4), 0, dpToPx(4), 0);
+ typeImageView.setLayoutParams(typeImageParams);
+ int drawableResId = route.type == null ? R.drawable.ic_action_polygom_dark : route.type.getResourceId();
+ typeImageView.setImageDrawable(getRowIcon(drawableResId));
+ typeView.addView(typeImageView);
+
+ TextView typeTextView = new TextView(view.getContext());
+ LinearLayout.LayoutParams typeTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ typeTextView.setLayoutParams(typeTextParams);
+ typeTextView.setText(route.getTypeStrRes());
+ typeView.addView(typeTextView);
+
+ baseView.setOnClickListener(listener);
+
+ ((ViewGroup) view).addView(baseView);
+
+ return baseView;
+ }
+
+ private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener, boolean showDivider) {
+ buildTransportRowItem(parent, r, listener);
+
+ if (showDivider) {
buildRowDivider(parent);
}
-
- View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.ctx_menu_transport_route_layout, parent, false);
- TextView routeDesc = (TextView) view.findViewById(R.id.route_desc);
- routeDesc.setText(r.getDescription(getMapActivity().getMyApplication(), true));
- routeDesc.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
- int drawableResId = r.type == null ? R.drawable.ic_action_polygom_dark : r.type.getResourceId();
- ((ImageView) view.findViewById(R.id.route_type_icon)).setImageDrawable(getRowIcon(drawableResId));
- ((TextView) view.findViewById(R.id.route_ref)).setText(r.route.getRef());
- view.setOnClickListener(listener);
- int typeResId;
- switch (r.type) {
- case BUS:
- typeResId = R.string.poi_route_bus_ref;
- break;
- case TRAM:
- typeResId = R.string.poi_route_tram_ref;
- break;
- case FERRY:
- typeResId = R.string.poi_route_ferry_ref;
- break;
- case TRAIN:
- typeResId = R.string.poi_route_train_ref;
- break;
- case SHARE_TAXI:
- typeResId = R.string.poi_route_share_taxi_ref;
- break;
- case FUNICULAR:
- typeResId = R.string.poi_route_funicular_ref;
- break;
- case LIGHT_RAIL:
- typeResId = R.string.poi_route_light_rail_ref;
- break;
- case MONORAIL:
- typeResId = R.string.poi_route_monorail_ref;
- break;
- case TROLLEYBUS:
- typeResId = R.string.poi_route_trolleybus_ref;
- break;
- case RAILWAY:
- typeResId = R.string.poi_route_railway_ref;
- break;
- case SUBWAY:
- typeResId = R.string.poi_route_subway_ref;
- break;
- default:
- typeResId = R.string.poi_filter_public_transport;
- break;
- }
- ((TextView) view.findViewById(R.id.route_type_text)).setText(typeResId);
-
- parent.addView(view);
-
- rowBuilt();
}
private CollapsableView getCollapsableTransportStopRoutesView(final Context context, boolean collapsed) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, false);
- for (final TransportStopRoute r : routes) {
+ for (int i = 0; i < routes.size(); i++) {
+ final TransportStopRoute r = routes.get(i);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View arg0) {
@@ -785,12 +826,13 @@ public class MenuBuilder {
r.getDescription(getMapActivity().getMyApplication(), false));
mm.show(latLon, pd, r);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
- stopsLayer.setRoute(r.route);
+ stopsLayer.setRoute(r);
int cz = r.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
}
};
- buildTransportRouteRow(view, r, listener);
+ boolean showDivider = i < routes.size() - 1;
+ buildTransportRouteRow(view, r, listener, showDivider);
}
return new CollapsableView(view, collapsed);
@@ -949,16 +991,9 @@ public class MenuBuilder {
int paddingSides = dpToPx(10f);
button.setPadding(paddingSides, 0, paddingSides, 0);
if (!selected) {
- ColorStateList buttonColorStateList = new ColorStateList(
- new int[][] {
- new int[]{android.R.attr.state_pressed},
- new int[]{}
- },
- new int[] {
- context.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p),
- context.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n)
- }
- );
+ ColorStateList buttonColorStateList = AndroidUtils.createColorStateList(context, !light,
+ R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,
+ R.color.ctx_menu_controller_button_text_color_dark_n, R.color.ctx_menu_controller_button_text_color_dark_p);
button.setTextColor(buttonColorStateList);
} else {
button.setTextColor(ContextCompat.getColor(context, light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
index 42b4612988..c1a6d78328 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
@@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
@@ -51,7 +52,7 @@ import net.osmand.plus.mapcontextmenu.controllers.RenderedObjectMenuController;
import net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController;
import net.osmand.plus.mapcontextmenu.controllers.TransportRouteController;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController;
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.mapillary.MapillaryImage;
@@ -225,8 +226,8 @@ public abstract class MenuController extends BaseMenuController {
return true;
}
- public void addPlainMenuItem(int iconId, String text, boolean needLinks, boolean isUrl, OnClickListener onClickListener) {
- builder.addPlainMenuItem(iconId, text, needLinks, isUrl, onClickListener);
+ public void addPlainMenuItem(int iconId, String buttonText, String text, boolean needLinks, boolean isUrl, OnClickListener onClickListener) {
+ builder.addPlainMenuItem(iconId, buttonText, text, needLinks, isUrl, onClickListener);
}
public void clearPlainMenuItems() {
@@ -239,7 +240,7 @@ public abstract class MenuController extends BaseMenuController {
protected void addMyLocationToPlainItems(LatLon latLon) {
OsmandSettings st = ((OsmandApplication) getMapActivity().getApplicationContext()).getSettings();
- addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationName(getMapActivity(),
+ addPlainMenuItem(R.drawable.ic_action_get_my_location, null, PointDescription.getLocationName(getMapActivity(),
latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", " "), false, false, null);
//if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT)
// addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName(
@@ -386,15 +387,11 @@ public abstract class MenuController extends BaseMenuController {
return false;
}
- public boolean displayAdditionalTypeStrInHours() {
- return false;
- }
-
- public int getLeftIconId() {
+ public int getRightIconId() {
return 0;
}
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return null;
}
@@ -402,10 +399,14 @@ public abstract class MenuController extends BaseMenuController {
return null;
}
- public Drawable getAdditionalLineTypeIcon() {
+ public Drawable getSubtypeIcon() {
return null;
}
+ public boolean navigateInPedestrianMode() {
+ return false;
+ }
+
public int getFavActionIconId() {
return R.drawable.map_action_fav_dark;
}
@@ -432,16 +433,29 @@ public abstract class MenuController extends BaseMenuController {
return "";
}
- public String getAdditionalTypeStr() {
+ public String getSubtypeStr() {
return "";
}
- public int getTimeStrColor() {
+ public int getAdditionalInfoColor() {
+ if (indexItem != null) {
+ return R.color.icon_color;
+ }
return 0;
}
- public OpeningHoursInfo getOpeningHoursInfo() {
- return null;
+ public String getAdditionalInfoStr() {
+ if (indexItem != null) {
+ return getMapActivity().getString(R.string.file_size_in_mb, indexItem.getArchiveSizeMB());
+ }
+ return "";
+ }
+
+ public int getAdditionalInfoIconRes() {
+ if (indexItem != null) {
+ return R.drawable.ic_sdcard_16;
+ }
+ return 0;
}
public String getCommonTypeStr() {
@@ -531,11 +545,14 @@ public abstract class MenuController extends BaseMenuController {
public abstract class TitleButtonController {
public String caption = "";
public int leftIconId = 0;
+ public int rightIconId = 0;
public boolean needRightText = false;
public String rightTextCaption = "";
public boolean visible = true;
public boolean needColorizeIcon = true;
public Drawable leftIcon;
+ public Drawable rightIcon;
+ public boolean enabled = true;
public Drawable getLeftIcon() {
if (leftIcon != null) {
@@ -543,7 +560,7 @@ public abstract class MenuController extends BaseMenuController {
}
if (leftIconId != 0) {
if (needColorizeIcon) {
- return getIcon(leftIconId, isLight() ? R.color.map_widget_blue : R.color.osmand_orange);
+ return getIcon(leftIconId, getColorRes());
}
return ContextCompat.getDrawable(getMapActivity(), leftIconId);
} else {
@@ -551,6 +568,30 @@ public abstract class MenuController extends BaseMenuController {
}
}
+ public Drawable getRightIcon() {
+ if (rightIcon != null) {
+ return rightIcon;
+ }
+ if (rightIconId != 0) {
+ if (needColorizeIcon) {
+ return getIcon(rightIconId, getColorRes());
+ }
+ return ContextCompat.getDrawable(getMapActivity(), rightIconId);
+ } else {
+ return null;
+ }
+ }
+
+ private int getColorRes() {
+ int colorRes;
+ if (enabled) {
+ colorRes = isLight() ? R.color.map_widget_blue : R.color.osmand_orange;
+ } else {
+ colorRes = isLight() ? R.color.ctx_menu_controller_disabled_text_color_light : R.color.ctx_menu_controller_disabled_text_color_dark;
+ }
+ return colorRes;
+ }
+
public abstract void buttonPressed();
}
@@ -619,7 +660,7 @@ public abstract class MenuController extends BaseMenuController {
}
}
- public void buildMapDownloadButton(final LatLon latLon) {
+ public void buildMapDownloadButtonAndSizeInfo(final LatLon latLon) {
new AsyncTask() {
ResourceManager rm;
@@ -774,6 +815,11 @@ public abstract class MenuController extends BaseMenuController {
public ContextMenuToolbarController(MenuController menuController) {
super(TopToolbarControllerType.CONTEXT_MENU);
this.menuController = menuController;
+ setBgIds(R.color.actionbar_light_color, R.color.actionbar_dark_color,
+ R.color.actionbar_light_color, R.color.actionbar_dark_color);
+ setBackBtnIconClrIds(R.color.color_white, R.color.color_white);
+ setCloseBtnIconClrIds(R.color.color_white, R.color.color_white);
+ setTitleTextClrIds(R.color.color_white, R.color.color_white);
}
public MenuController getMenuController() {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java
index f5c5689798..4df7f95571 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java
@@ -11,16 +11,13 @@ import net.osmand.util.Algorithms;
public abstract class MenuTitleController {
- protected int leftIconId;
- protected Drawable leftIcon;
+ protected int rightIconId;
+ protected Drawable rightIcon;
protected String nameStr = "";
protected String typeStr = "";
- protected String additionalTypeStr = "";
protected String commonTypeStr = "";
protected Drawable secondLineTypeIcon;
- protected Drawable additionalLineTypeIcon;
protected String streetStr = "";
- protected OpeningHoursInfo openingHoursInfo;
private AddressLookupRequest addressLookupRequest;
@@ -68,22 +65,18 @@ public abstract class MenuTitleController {
return !addressNotFoundStr.equals(title) && !searchAddressStr.equals(title);
}
- public int getLeftIconId() {
- return leftIconId;
+ public int getRightIconId() {
+ return rightIconId;
}
- public Drawable getLeftIcon() {
- return leftIcon;
+ public Drawable getRightIcon() {
+ return rightIcon;
}
public Drawable getTypeIcon() {
return secondLineTypeIcon;
}
- public Drawable getAdditionalLineTypeIcon() {
- return additionalLineTypeIcon;
- }
-
public String getTypeStr() {
MenuController menuController = getMenuController();
if (menuController != null && menuController.needTypeStr()) {
@@ -93,15 +86,6 @@ public abstract class MenuTitleController {
}
}
- public String getAdditionalTypeStr() {
- MenuController menuController = getMenuController();
- if (menuController != null) {
- return additionalTypeStr;
- } else {
- return "";
- }
- }
-
public String getStreetStr() {
if (needStreetName()) {
if (searchingAddress()) {
@@ -114,10 +98,6 @@ public abstract class MenuTitleController {
}
}
- public OpeningHoursInfo getOpeningHoursInfo() {
- return openingHoursInfo;
- }
-
protected void initTitle() {
searchAddressStr = PointDescription.getSearchAddressStr(getMapActivity());
addressNotFoundStr = PointDescription.getAddressNotFoundStr(getMapActivity());
@@ -131,8 +111,6 @@ public abstract class MenuTitleController {
if (needStreetName()) {
acquireStreetName();
}
-
- acquireOpeningHoursInfo();
}
protected boolean needStreetName() {
@@ -147,16 +125,14 @@ public abstract class MenuTitleController {
protected void acquireIcons() {
MenuController menuController = getMenuController();
- leftIconId = 0;
- leftIcon = null;
+ rightIconId = 0;
+ rightIcon = null;
secondLineTypeIcon = null;
- additionalLineTypeIcon = null;
if (menuController != null) {
- leftIconId = menuController.getLeftIconId();
- leftIcon = menuController.getLeftIcon();
+ rightIconId = menuController.getRightIconId();
+ rightIcon = menuController.getRightIcon();
secondLineTypeIcon = menuController.getSecondLineTypeIcon();
- additionalLineTypeIcon = menuController.getAdditionalLineTypeIcon();
}
}
@@ -170,7 +146,6 @@ public abstract class MenuTitleController {
if (menuController != null) {
nameStr = menuController.getNameStr();
typeStr = menuController.getTypeStr();
- additionalTypeStr = menuController.getAdditionalTypeStr();
commonTypeStr = menuController.getCommonTypeStr();
}
@@ -211,13 +186,6 @@ public abstract class MenuTitleController {
getMapActivity().getMyApplication().getGeocodingLookupService().lookupAddress(addressLookupRequest);
}
- protected void acquireOpeningHoursInfo() {
- MenuController menuController = getMenuController();
- if (menuController != null) {
- openingHoursInfo = menuController.getOpeningHoursInfo();
- }
- }
-
protected void onSearchAddressDone() {
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/OpeningHoursInfo.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/OpeningHoursInfo.java
index 3802a21c52..34990e86ac 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/OpeningHoursInfo.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/OpeningHoursInfo.java
@@ -1,5 +1,8 @@
package net.osmand.plus.mapcontextmenu;
+import android.content.Context;
+
+import net.osmand.plus.R;
import net.osmand.util.Algorithms;
public class OpeningHoursInfo {
@@ -68,12 +71,20 @@ public class OpeningHoursInfo {
this.openingDay = openingDay;
}
- public boolean containsInfo() {
- return opened24_7
- || !Algorithms.isEmpty(openingTime)
- || !Algorithms.isEmpty(nearToOpeningTime)
- || !Algorithms.isEmpty(closingTime)
- || !Algorithms.isEmpty(nearToClosingTime)
- || !Algorithms.isEmpty(openingDay);
+ public String getInfo(Context context) {
+ if (isOpened24_7()) {
+ return context.getString(R.string.shared_string_is_open_24_7);
+ } else if (!Algorithms.isEmpty(getNearToOpeningTime())) {
+ return context.getString(R.string.will_open_at) + " " + getNearToOpeningTime();
+ } else if (!Algorithms.isEmpty(getOpeningTime())) {
+ return context.getString(R.string.open_from) + " " + getOpeningTime();
+ } else if (!Algorithms.isEmpty(getNearToClosingTime())) {
+ return context.getString(R.string.will_close_at) + " " + getNearToClosingTime();
+ } else if (!Algorithms.isEmpty(getClosingTime())) {
+ return context.getString(R.string.open_till) + " " + getClosingTime();
+ } else if (!Algorithms.isEmpty(getOpeningDay())) {
+ return context.getString(R.string.will_open_on) + " " + getOpeningDay() + ".";
+ }
+ return "";
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/TransportStopRouteAdapter.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/TransportStopRouteAdapter.java
index fbc1da30a4..25fc3bb452 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/TransportStopRouteAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/TransportStopRouteAdapter.java
@@ -1,6 +1,6 @@
package net.osmand.plus.mapcontextmenu;
-import android.content.Context;
+import android.graphics.drawable.GradientDrawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
@@ -9,26 +9,56 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
+import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import java.util.List;
public class TransportStopRouteAdapter extends ArrayAdapter {
- public TransportStopRouteAdapter(@NonNull Context context, @NonNull List objects) {
- super(context, 0, objects);
+ private boolean nightMode;
+ private OnClickListener listener;
+ private OsmandApplication app;
+
+ public TransportStopRouteAdapter(@NonNull OsmandApplication application, @NonNull List objects, boolean nightMode) {
+ super(application, 0, objects);
+ this.nightMode = nightMode;
+ this.app = application;
+ }
+
+ public void setListener(OnClickListener listener) {
+ this.listener = listener;
}
@NonNull
@Override
- public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
+ public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.transport_stop_route_item, parent, false);
}
- ((TextView) convertView.findViewById(R.id.transport_stop_route_text)).setText(getItem(position).route.getRef());
+ TransportStopRoute transportStopRoute = getItem(position);
+ if (transportStopRoute != null) {
+ TextView transportStopRouteTextView = (TextView) convertView.findViewById(R.id.transport_stop_route_text);
+ transportStopRouteTextView.setText(transportStopRoute.route.getRef());
+ GradientDrawable gradientDrawableBg = (GradientDrawable) transportStopRouteTextView.getBackground();
+ gradientDrawableBg.setColor(transportStopRoute.getColor(app, nightMode));
+ }
+
+ convertView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (listener != null) {
+ listener.onClick(position);
+ }
+ }
+ });
return convertView;
}
+
+ public interface OnClickListener {
+ void onClick(int position);
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/WikipediaDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/WikipediaDialogFragment.java
new file mode 100644
index 0000000000..0030eedf43
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/WikipediaDialogFragment.java
@@ -0,0 +1,291 @@
+package net.osmand.plus.mapcontextmenu;
+
+import android.app.Dialog;
+import android.content.Intent;
+import android.content.res.ColorStateList;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.customtabs.CustomTabsIntent;
+import android.support.design.widget.AppBarLayout;
+import android.support.design.widget.CoordinatorLayout;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.PopupMenu;
+import android.text.Html;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
+import android.text.style.RelativeSizeSpan;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.TextView;
+
+import net.osmand.AndroidUtils;
+import net.osmand.data.Amenity;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.plus.helpers.FileNameTranslationHelper;
+import net.osmand.util.Algorithms;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+public class WikipediaDialogFragment extends DialogFragment {
+
+ public static final String TAG = "WikipediaDialogFragment";
+
+ private View mainView;
+ private boolean darkMode;
+ private Amenity amenity;
+ private String lang;
+
+ public void setAmenity(Amenity amenity) {
+ this.amenity = amenity;
+ }
+
+ public void setLanguage(String lang) {
+ this.lang = lang;
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ OsmandApplication app = getMyApplication();
+ darkMode = app.getDaynightHelper().isNightMode() || !app.getSettings().isLightContent();
+ int themeId = darkMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
+ setStyle(STYLE_NO_FRAME, themeId);
+ }
+
+ @NonNull
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ Dialog dialog = new Dialog(getContext(), getTheme());
+ if (!getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) {
+ dialog.getWindow().getAttributes().windowAnimations = R.style.Animations_Alpha;
+ }
+ return dialog;
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ mainView = inflater.inflate(R.layout.wikipedia_dialog_fragment, container, false);
+
+ mainView.setBackgroundColor(ContextCompat.getColor(getContext(), darkMode ? R.color.ctx_menu_bottom_view_bg_dark : R.color.ctx_menu_bottom_view_bg_light));
+
+ AppBarLayout appBarLayout = (AppBarLayout) mainView.findViewById(R.id.app_bar);
+ appBarLayout.setBackgroundColor(ContextCompat.getColor(getContext(), darkMode ? R.color.ctx_menu_buttons_bg_dark: R.color.ctx_menu_buttons_bg_light));
+
+ int toolbarTextColor = ContextCompat.getColor(getContext(), R.color.dashboard_subheader_text_light);
+
+ ImageButton backButton = (ImageButton) mainView.findViewById(R.id.back_button);
+ backButton.setImageDrawable(getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_arrow_back, toolbarTextColor));
+ backButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+ TextView titleTextView = (TextView) mainView.findViewById(R.id.title_text_view);
+ titleTextView.setTextColor(toolbarTextColor);
+
+ ColorStateList buttonColorStateList = AndroidUtils.createColorStateList(getContext(), darkMode,
+ R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,
+ R.color.ctx_menu_controller_button_text_color_dark_n, R.color.ctx_menu_controller_button_text_color_dark_p);
+
+ final TextView readFullArticleButton = (TextView) mainView.findViewById(R.id.read_full_article);
+ CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) readFullArticleButton.getLayoutParams();
+ params.setBehavior(new CoordinatorLayout.Behavior() {
+ @Override
+ public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
+ return dependency instanceof AppBarLayout;
+ }
+
+ @Override
+ public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
+ if (dependency instanceof AppBarLayout) {
+ int readFullArticleButtonHeight = child.getMeasuredHeight();
+ if (readFullArticleButtonHeight != 0) {
+ CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
+ int viewBottomMargin = lp.bottomMargin;
+ int distanceToScroll = child.getHeight() + viewBottomMargin;
+ float ratio = dependency.getY() / readFullArticleButtonHeight;
+ child.setTranslationY(-distanceToScroll * ratio);
+ }
+ }
+ return true;
+ }
+ });
+ readFullArticleButton.setLayoutParams(params);
+ readFullArticleButton.setBackgroundResource(darkMode ? R.drawable.bt_round_long_night : R.drawable.bt_round_long_day);
+ readFullArticleButton.setTextColor(buttonColorStateList);
+ int paddingLeft = (int) getResources().getDimension(R.dimen.wikipedia_button_left_padding);
+ int paddingRight = (int) getResources().getDimension(R.dimen.dialog_content_margin);
+ readFullArticleButton.setPadding(paddingLeft, 0, paddingRight, 0);
+ readFullArticleButton.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_world_globe_dark), null, null, null);
+ readFullArticleButton.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.content_padding_small));
+
+ final TextView selectLanguageTextView = mainView.findViewById(R.id.select_language_text_view);
+ selectLanguageTextView.setTextColor(buttonColorStateList);
+ selectLanguageTextView.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_map_language), null, null, null);
+ selectLanguageTextView.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.context_menu_padding_margin_small));
+ selectLanguageTextView.setBackgroundResource(darkMode ? R.drawable.wikipedia_select_lang_bg_dark : R.drawable.wikipedia_select_lang_bg_light);
+
+ return mainView;
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ populateWiki();
+ }
+
+ @Override
+ public void onDestroyView() {
+ Dialog dialog = getDialog();
+ if (dialog != null) {
+ dialog.setDismissMessage(null);
+ }
+ super.onDestroyView();
+ }
+
+ private void populateWiki() {
+ if (amenity != null) {
+ String preferredLanguage = lang;
+ if (TextUtils.isEmpty(preferredLanguage)) {
+ preferredLanguage = getMyApplication().getLanguage();
+ }
+
+ final String title = TextUtils.isEmpty(preferredLanguage) ? amenity.getName() : amenity.getName(lang);
+ ((TextView) mainView.findViewById(R.id.title_text_view)).setText(title);
+
+ String lng = amenity.getContentLanguage("content", preferredLanguage, "en");
+ if (Algorithms.isEmpty(lng)) {
+ lng = "en";
+ }
+
+ final String langSelected = lng;
+
+ mainView.findViewById(R.id.read_full_article).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String article = "https://" + langSelected.toLowerCase() + ".wikipedia.org/wiki/" + title.replace(' ', '_');
+ showFullArticle(Uri.parse(article));
+ }
+ });
+
+ final TextView selectLanguageTextView = mainView.findViewById(R.id.select_language_text_view);
+ selectLanguageTextView.setText(langSelected);
+ selectLanguageTextView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ showPopupLangMenu(selectLanguageTextView, langSelected);
+ }
+ });
+
+ String content = amenity.getDescription(langSelected);
+
+ TextView articleTextView = (TextView) mainView.findViewById(R.id.content);
+ Spannable spannableContent = new SpannableString(Html.fromHtml(content));
+ int length = spannableContent.length();
+ spannableContent.setSpan(new RelativeSizeSpan(1.2f), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ int contentTextColor = ContextCompat.getColor(getContext(), darkMode ? R.color.ctx_menu_bottom_view_text_color_dark : R.color.ctx_menu_bottom_view_text_color_light);
+ spannableContent.setSpan(new ForegroundColorSpan(contentTextColor), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ articleTextView.setText(spannableContent);
+ }
+ }
+
+ private void showFullArticle(Uri uri) {
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
+ .setToolbarColor(ContextCompat.getColor(getContext(), darkMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
+ .build();
+ customTabsIntent.launchUrl(getContext(), uri);
+ } else {
+ Intent i = new Intent(Intent.ACTION_VIEW);
+ i.setData(uri);
+ startActivity(i);
+ }
+ }
+
+ private void showPopupLangMenu(View view, final String langSelected) {
+ final PopupMenu optionsMenu = new PopupMenu(getContext(), view, Gravity.RIGHT);
+ Set namesSet = new TreeSet<>();
+ namesSet.addAll(amenity.getNames("content", "en"));
+ namesSet.addAll(amenity.getNames("description", "en"));
+
+ Map names = new HashMap<>();
+ for (String n : namesSet) {
+ names.put(n, FileNameTranslationHelper.getVoiceName(getContext(), n));
+ }
+ String selectedLangName = names.get(langSelected);
+ if (selectedLangName != null) {
+ names.remove(langSelected);
+ }
+ Map sortedNames = AndroidUtils.sortByValue(names);
+
+ if (selectedLangName != null) {
+ MenuItem item = optionsMenu.getMenu().add(selectedLangName);
+ item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ setLanguage(langSelected);
+ populateWiki();
+ return true;
+ }
+ });
+ }
+ for (final Map.Entry e : sortedNames.entrySet()) {
+ MenuItem item = optionsMenu.getMenu().add(e.getValue());
+ item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ setLanguage(e.getKey());
+ populateWiki();
+ return true;
+ }
+ });
+ }
+ optionsMenu.show();
+ }
+
+ private Drawable getIcon(int resId) {
+ int colorId = darkMode ? R.color.ctx_menu_controller_button_text_color_dark_n : R.color.ctx_menu_controller_button_text_color_light_n;
+ return getMyApplication().getIconsCache().getIcon(resId, colorId);
+ }
+
+ private OsmandApplication getMyApplication() {
+ return (OsmandApplication) getActivity().getApplication();
+ }
+
+ public static boolean showInstance(AppCompatActivity activity, Amenity amenity) {
+ try {
+ if (!amenity.getType().isWiki()) {
+ return false;
+ }
+ OsmandApplication app = (OsmandApplication) activity.getApplication();
+ String lang = app.getSettings().MAP_PREFERRED_LOCALE.get();
+
+ WikipediaDialogFragment wikipediaDialogFragment = new WikipediaDialogFragment();
+ wikipediaDialogFragment.setAmenity(amenity);
+ wikipediaDialogFragment.setLanguage(lang);
+ wikipediaDialogFragment.setRetainInstance(true);
+ wikipediaDialogFragment.show(activity.getSupportFragmentManager(), TAG);
+ return true;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
index 67a88c9b70..ce158b58b1 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
@@ -19,6 +19,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import net.osmand.AndroidUtils;
import net.osmand.data.Amenity;
import net.osmand.data.PointDescription;
import net.osmand.osm.AbstractPoiType;
@@ -31,6 +32,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
+import net.osmand.plus.mapcontextmenu.WikipediaDialogFragment;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.views.POIMapLayer;
import net.osmand.plus.widgets.TextViewEx;
@@ -92,7 +94,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
ll.setLayoutParams(llParams);
- ll.setBackgroundResource(resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
+ ll.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
ll.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@@ -131,7 +133,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, collapsable ? dpToPx(13f) : dpToPx(8f), 0, collapsable ? dpToPx(13f) : dpToPx(8f));
textView.setLayoutParams(llTextParams);
textView.setTextSize(16);
- textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
+ textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
boolean textDefined = false;
if (isPhoneNumber || isUrl) {
@@ -217,16 +219,9 @@ public class AmenityMenuBuilder extends MenuBuilder {
button.setTextSize(14);
int paddingSides = dpToPx(10f);
button.setPadding(paddingSides, 0, paddingSides, 0);
- ColorStateList buttonColorStateList = new ColorStateList(
- new int[][] {
- new int[]{android.R.attr.state_pressed},
- new int[]{}
- },
- new int[] {
- view.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p),
- view.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n)
- }
- );
+ ColorStateList buttonColorStateList = AndroidUtils.createColorStateList(view.getContext(), !light,
+ R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,
+ R.color.ctx_menu_controller_button_text_color_dark_n, R.color.ctx_menu_controller_button_text_color_dark_p);
button.setTextColor(buttonColorStateList);
button.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
button.setSingleLine(true);
@@ -234,12 +229,12 @@ public class AmenityMenuBuilder extends MenuBuilder {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- POIMapLayer.showWikipediaDialog(view.getContext(), app, amenity);
+ WikipediaDialogFragment.showInstance(mapActivity, amenity);
}
});
button.setAllCaps(true);
button.setText(R.string.context_menu_read_full_article);
- Drawable compoundDrawable = app.getIconsCache().getIcon(R.drawable.ic_action_note_dark, light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
+ Drawable compoundDrawable = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
button.setCompoundDrawablesWithIntrinsicBounds(compoundDrawable, null, null, null);
button.setCompoundDrawablePadding(dpToPx(8f));
llText.addView(button);
@@ -284,7 +279,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- POIMapLayer.showWikipediaDialog(view.getContext(), app, amenity);
+ WikipediaDialogFragment.showInstance(mapActivity, amenity);
}
});
} else if (isText && text.length() > 200) {
@@ -516,10 +511,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
} else {
link = "https://www.openstreetmap.org/way/";
}
- buildRow(view, R.drawable.ic_action_info_dark, link + (amenity.getId() >> 1),
+ buildRow(view, R.drawable.ic_action_info_dark, null, link + (amenity.getId() >> 1),
0, false, null, true, 0, true, null, false);
}
- buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
+ buildRow(view, R.drawable.ic_action_get_my_location, null, PointDescription.getLocationName(app,
amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true)
.replaceAll("\n", " "), 0, false, null, false, 0, false, null, false);
//if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT)
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java
index 05097d55f2..55056d5279 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java
@@ -78,7 +78,7 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
int disabledColor = light ? R.color.secondary_text_light : R.color.secondary_text_dark;
color = favoriteGroup.visible ? (color | 0xff000000) : view.getResources().getColor(disabledColor);
String name = view.getContext().getString(R.string.context_menu_points_of_group);
- buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_action_folder, color), name, 0, null,
+ buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_action_folder, color), null, name, 0, null,
true, getCollapsableFavouritesView(view.getContext(), true, favoriteGroup, fav),
false, 0, false, null, false);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java
index 10d61daf3e..2058c4ca03 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java
@@ -34,7 +34,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
String description = GpxUiHelper.getDescription(app, item.analysis, false);
String[] lines = description.split("\n");
for (String line : lines) {
- buildRow(view, R.drawable.ic_action_info_dark, line, 0, false, null, false, 0, false, null, false);
+ buildRow(view, R.drawable.ic_action_info_dark, null, line, 0, false, null, false, 0, false, null, false);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java
index 9553e96d39..ddb18b6278 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java
@@ -44,23 +44,23 @@ public class WptPtMenuBuilder extends MenuBuilder {
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
Date date = new Date(wpt.time);
buildRow(view, R.drawable.ic_action_data,
- dateFormat.format(date) + " — " + timeFormat.format(date), 0, false, null, false, 0, false, null, false);
+ null, dateFormat.format(date) + " — " + timeFormat.format(date), 0, false, null, false, 0, false, null, false);
}
if (wpt.speed > 0) {
buildRow(view, R.drawable.ic_action_speed,
- OsmAndFormatter.getFormattedSpeed((float)wpt.speed, app), 0, false, null, false, 0, false, null, false);
+ null, OsmAndFormatter.getFormattedSpeed((float)wpt.speed, app), 0, false, null, false, 0, false, null, false);
}
if (!Double.isNaN(wpt.ele)) {
buildRow(view, R.drawable.ic_action_altitude,
- OsmAndFormatter.getFormattedDistance((float) wpt.ele, app), 0, false, null, false, 0, false, null, false);
+ null, OsmAndFormatter.getFormattedDistance((float) wpt.ele, app), 0, false, null, false, 0, false, null, false);
}
if (!Double.isNaN(wpt.hdop)) {
buildRow(view, R.drawable.ic_action_gps_info,
- Algorithms.capitalizeFirstLetterAndLowercase(app.getString(R.string.plugin_distance_point_hdop)) + ": " + (int)wpt.hdop, 0,
+ null, Algorithms.capitalizeFirstLetterAndLowercase(app.getString(R.string.plugin_distance_point_hdop)) + ": " + (int)wpt.hdop, 0,
false, null, false, 0, false, null, false);
}
if (!Algorithms.isEmpty(wpt.desc)) {
- final View row = buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0, false, null, true, 10, false, null, false);
+ final View row = buildRow(view, R.drawable.ic_action_note_dark, null, wpt.desc, 0, false, null, true, 10, false, null, false);
row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -70,7 +70,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
});
}
if (!Algorithms.isEmpty(wpt.comment)) {
- final View rowc = buildRow(view, R.drawable.ic_action_note_dark, wpt.comment, 0,
+ final View rowc = buildRow(view, R.drawable.ic_action_note_dark, null, wpt.comment, 0,
false, null, true, 10, false, null, false);
rowc.setOnClickListener(new View.OnClickListener() {
@Override
@@ -96,7 +96,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
File file = new File(gpx.path);
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
int color = getPointColor(wpt, getFileColor(selectedGpxFile));
- buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), title, 0, gpxName,
+ buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), null, title, 0, gpxName,
true, getCollapsableWaypointsView(view.getContext(), true, gpx, wpt),
false, 0, false, null, false);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java
index 4821d345d9..a5158139e8 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java
@@ -49,7 +49,7 @@ public class AMapPointMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_get_my_location);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java
index 67529b57f5..ec3460ba28 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java
@@ -1,7 +1,5 @@
package net.osmand.plus.mapcontextmenu.controllers;
-import android.view.View;
-
import net.osmand.data.Amenity;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
@@ -14,16 +12,15 @@ import net.osmand.osm.PoiType;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.OpeningHoursInfo;
+import net.osmand.plus.mapcontextmenu.WikipediaDialogFragment;
import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.resources.TransportIndexRepository;
-import net.osmand.plus.views.POIMapLayer;
-import net.osmand.plus.views.TransportStopsLayer;
+import net.osmand.plus.transport.TransportStopType;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import net.osmand.util.OpeningHoursParser;
@@ -39,6 +36,7 @@ public class AmenityMenuController extends MenuController {
private Amenity amenity;
private List routes = new ArrayList<>();
+ private OpeningHoursInfo openingHoursInfo;
private MapMarker marker;
@@ -71,12 +69,14 @@ public class AmenityMenuController extends MenuController {
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
- POIMapLayer.showWikipediaDialog(mapActivity, mapActivity.getMyApplication(), amenity);
+ WikipediaDialogFragment.showInstance(mapActivity, amenity);
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article);
- leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_note_dark, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
+ leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_read_text, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
}
+
+ openingHoursInfo = processOpeningHours(amenity);
}
@Override
@@ -108,11 +108,11 @@ public class AmenityMenuController extends MenuController {
}
@Override
- public int getLeftIconId() {
- return getLeftIconId(amenity);
+ public int getRightIconId() {
+ return getRightIconId(amenity);
}
- private static int getLeftIconId(Amenity amenity) {
+ private static int getRightIconId(Amenity amenity) {
String id = null;
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
if (st != null) {
@@ -146,8 +146,27 @@ public class AmenityMenuController extends MenuController {
}
@Override
- public OpeningHoursInfo getOpeningHoursInfo() {
- return processOpeningHours(amenity);
+ public int getAdditionalInfoColor() {
+ if (openingHoursInfo != null) {
+ return openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
+ }
+ return super.getAdditionalInfoColor();
+ }
+
+ @Override
+ public String getAdditionalInfoStr() {
+ if (openingHoursInfo != null) {
+ return openingHoursInfo.getInfo(getMapActivity());
+ }
+ return super.getAdditionalInfoStr();
+ }
+
+ @Override
+ public int getAdditionalInfoIconRes() {
+ if (openingHoursInfo != null) {
+ return R.drawable.ic_action_opening_hour_16;
+ }
+ return super.getAdditionalInfoIconRes();
}
public static String getTypeStr(Amenity amenity) {
@@ -201,7 +220,7 @@ public class AmenityMenuController extends MenuController {
public static void addPlainMenuItems(Amenity amenity, String typeStr, MenuBuilder builder) {
if (!Algorithms.isEmpty(typeStr)) {
- int resId = getLeftIconId(amenity);
+ int resId = getRightIconId(amenity);
if (resId == 0) {
PoiCategory pc = amenity.getType();
resId = RenderingIcons.getBigIconResourceId(pc.getIconKeyName());
@@ -254,7 +273,7 @@ public class AmenityMenuController extends MenuController {
if (rts != null) {
for (TransportRoute rs : rts) {
if (!containsRef(rs)) {
- TransportStopController.TransportStopType type = TransportStopController.TransportStopType.findType(rs.getType());
+ TransportStopType type = TransportStopType.findType(rs.getType());
TransportStopRoute r = new TransportStopRoute();
r.type = type;
r.desc = useEnglishNames ? rs.getEnName(true) : rs.getName();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
index 81da068960..0e1ddda8fa 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
@@ -18,6 +18,7 @@ import net.osmand.plus.mapcontextmenu.OpeningHoursInfo;
import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
@@ -27,7 +28,8 @@ public class FavouritePointMenuController extends MenuController {
private FavouritePoint fav;
private MapMarker mapMarker;
- private List routes = new ArrayList<>();
+ private List routes = new ArrayList<>();
+ private OpeningHoursInfo openingHoursInfo;
public FavouritePointMenuController(MapActivity mapActivity, PointDescription pointDescription, final FavouritePoint fav) {
super(new FavouritePointMenuBuilder(mapActivity, fav), pointDescription, mapActivity);
@@ -50,6 +52,11 @@ public class FavouritePointMenuController extends MenuController {
routes = transportStopController.processTransportStop();
builder.setRoutes(routes);
}
+
+ Object originObject = getBuilder().getOriginObject();
+ if (originObject instanceof Amenity) {
+ openingHoursInfo = AmenityMenuController.processOpeningHours((Amenity) originObject);
+ }
}
@Override
@@ -65,7 +72,7 @@ public class FavouritePointMenuController extends MenuController {
}
@Override
- public List getTransportStopRoutes() {
+ public List getTransportStopRoutes() {
return routes;
}
@@ -95,7 +102,7 @@ public class FavouritePointMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), false);
}
@@ -106,7 +113,7 @@ public class FavouritePointMenuController extends MenuController {
@Override
public Drawable getSecondLineTypeIcon() {
- return getIcon(R.drawable.ic_action_group_name_16);
+ return getIcon(R.drawable.ic_action_group_name_16, isLight() ? R.color.icon_color : R.color.ctx_menu_bottom_view_icon_dark);
}
@Override
@@ -132,7 +139,7 @@ public class FavouritePointMenuController extends MenuController {
@Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
if (!Algorithms.isEmpty(fav.getDescription())) {
- addPlainMenuItem(R.drawable.ic_action_note_dark, fav.getDescription(), true, false, null);
+ addPlainMenuItem(R.drawable.ic_action_note_dark, null, fav.getDescription(), true, false, null);
}
Object originObject = getBuilder().getOriginObject();
if (originObject != null) {
@@ -146,11 +153,26 @@ public class FavouritePointMenuController extends MenuController {
}
@Override
- public OpeningHoursInfo getOpeningHoursInfo() {
- Object originObject = getBuilder().getOriginObject();
- if (originObject instanceof Amenity) {
- return AmenityMenuController.processOpeningHours((Amenity) originObject);
+ public int getAdditionalInfoColor() {
+ if (openingHoursInfo != null) {
+ return openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
}
- return null;
+ return 0;
+ }
+
+ @Override
+ public String getAdditionalInfoStr() {
+ if (openingHoursInfo != null) {
+ return openingHoursInfo.getInfo(getMapActivity());
+ }
+ return "";
+ }
+
+ @Override
+ public int getAdditionalInfoIconRes() {
+ if (openingHoursInfo != null) {
+ return R.drawable.ic_action_opening_hour_16;
+ }
+ return 0;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/GpxItemMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/GpxItemMenuController.java
index cb8fc3407a..ccd28b02fd 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/GpxItemMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/GpxItemMenuController.java
@@ -45,7 +45,7 @@ public class GpxItemMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_polygom_dark, R.color.osmand_orange);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/HistoryMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/HistoryMenuController.java
index 4bdd240adb..b0a4f758e1 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/HistoryMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/HistoryMenuController.java
@@ -52,7 +52,7 @@ public class HistoryMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return getIcon(SearchHistoryFragment.getItemIcon(entry.getName()));
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java
index 1d2e6e342a..0877112847 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java
@@ -53,7 +53,7 @@ public class ImpassibleRoadsMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return ContextCompat.getDrawable(getMapActivity(), R.drawable.map_pin_avoid_road);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
index 4cb6cf67fb..a0735a80b2 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
@@ -118,23 +118,6 @@ public class MapDataMenuController extends MenuController {
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
rightDownloadButtonController = new TitleButtonController() {
- @Override
- public void buttonPressed() {
- if (indexItem != null) {
- if (backuped) {
- deleteItem(indexItem.getBackupFile(app));
- } else {
- deleteItem(indexItem.getTargetFile(app));
- }
- } else if (localIndexInfo != null) {
- deleteItem(new File(localIndexInfo.getPathToData()));
- }
- }
- };
- rightDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
- rightDownloadButtonController.leftIconId = R.drawable.ic_action_delete_dark;
-
- bottomTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
getMapActivity().getContextMenu().close();
@@ -158,7 +141,25 @@ public class MapDataMenuController extends MenuController {
mapActivity.getContextMenu().getLatLon(), selectedObjects);
}
};
- bottomTitleButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
+ rightDownloadButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
+ rightDownloadButtonController.leftIconId = R.drawable.ic_plugin_srtm;
+
+ bottomTitleButtonController = new TitleButtonController() {
+ @Override
+ public void buttonPressed() {
+ if (indexItem != null) {
+ if (backuped) {
+ deleteItem(indexItem.getBackupFile(app));
+ } else {
+ deleteItem(indexItem.getTargetFile(app));
+ }
+ } else if (localIndexInfo != null) {
+ deleteItem(new File(localIndexInfo.getPathToData()));
+ }
+ }
+ };
+ bottomTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
+ bottomTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
titleProgressController = new TitleProgressController() {
@Override
@@ -178,6 +179,39 @@ public class MapDataMenuController extends MenuController {
updateData();
}
+ @Override
+ public boolean displayDistanceDirection() {
+ return true;
+ }
+
+ @Override
+ public int getAdditionalInfoColor() {
+ return R.color.icon_color;
+ }
+
+ @Override
+ public String getAdditionalInfoStr() {
+ double mb = 0;
+ if (backuped) {
+ if (localIndexInfo != null) {
+ mb = localIndexInfo.getSize();
+ } else if (indexItem != null) {
+ mb = indexItem.getArchiveSizeMB();
+ }
+ } else if (indexItem != null) {
+ mb = indexItem.getArchiveSizeMB();
+ }
+ if (mb != 0) {
+ return getMapActivity().getString(R.string.file_size_in_mb, mb);
+ }
+ return "";
+ }
+
+ @Override
+ public int getAdditionalInfoIconRes() {
+ return R.drawable.ic_sdcard_16;
+ }
+
@Override
protected void setObject(Object object) {
if (object instanceof DownloadMapObject) {
@@ -197,7 +231,7 @@ public class MapDataMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
int iconResId;
if (getDownloadActivityType() != null) {
iconResId = getDownloadActivityType().getIconResource();
@@ -219,6 +253,10 @@ public class MapDataMenuController extends MenuController {
} else {
res = getMapActivity().getString(R.string.shared_string_map);
}
+ DownloadActivityType downloadActivityType = getDownloadActivityType();
+ if (downloadActivityType != null) {
+ res += ", " + downloadActivityType.getString(getMapActivity());
+ }
if (getMenuType() == MenuType.STANDARD) {
res += "\n";
}
@@ -233,16 +271,16 @@ public class MapDataMenuController extends MenuController {
@Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
if (indexItem != null) {
- addPlainMenuItem(R.drawable.ic_action_info_dark, indexItem.getType().getString(getMapActivity()), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_info_dark, null, indexItem.getType().getString(getMapActivity()), false, false, null);
StringBuilder sizeStr = new StringBuilder();
sizeStr.append(indexItem.getSizeDescription(getMapActivity()));
if (backuped) {
sizeStr.append(" — ").append(LocalIndexType.DEACTIVATED.getHumanString(getMapActivity()));
}
- addPlainMenuItem(R.drawable.ic_action_info_dark, sizeStr.toString(), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_info_dark, null, sizeStr.toString(), false, false, null);
} else if (localIndexInfo != null) {
if (getDownloadActivityType() != null) {
- addPlainMenuItem(R.drawable.ic_action_info_dark, getDownloadActivityType().getString(getMapActivity()), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_info_dark, null, getDownloadActivityType().getString(getMapActivity()), false, false, null);
}
StringBuilder sizeStr = new StringBuilder();
if (localIndexInfo.getSize() >= 0) {
@@ -259,7 +297,7 @@ public class MapDataMenuController extends MenuController {
sizeStr.append(LocalIndexType.DEACTIVATED.getHumanString(getMapActivity()));
}
}
- addPlainMenuItem(R.drawable.ic_action_info_dark, sizeStr.toString(), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_info_dark, null, sizeStr.toString(), false, false, null);
}
if (!Algorithms.isEmpty(mapObject.getWorldRegion().getParams().getWikiLink())) {
String[] items = mapObject.getWorldRegion().getParams().getWikiLink().split(":");
@@ -269,7 +307,7 @@ public class MapDataMenuController extends MenuController {
} else {
url = "https://wikipedia.org/wiki/" + items[0].replace(' ', '_');
}
- addPlainMenuItem(R.drawable.ic_world_globe_dark, url, false, true, null);
+ addPlainMenuItem(R.drawable.ic_world_globe_dark, null, url, false, true, null);
}
if (!Algorithms.isEmpty(mapObject.getWorldRegion().getParams().getPopulation())) {
String population = mapObject.getWorldRegion().getParams().getPopulation();
@@ -283,14 +321,14 @@ public class MapDataMenuController extends MenuController {
b.insert(0, population.charAt(i));
k++;
}
- addPlainMenuItem(R.drawable.ic_action_info_dark, getMapActivity().getResources().getString(R.string.poi_population)
+ addPlainMenuItem(R.drawable.ic_action_info_dark, null, getMapActivity().getResources().getString(R.string.poi_population)
+ ": " + b, false, false, null);
}
if (indexItem != null) {
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(getMapActivity());
- addPlainMenuItem(R.drawable.ic_action_data, indexItem.getRemoteDate(dateFormat), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_data, null, indexItem.getRemoteDate(dateFormat), false, false, null);
} else if (localIndexInfo != null) {
- addPlainMenuItem(R.drawable.ic_action_data, localIndexInfo.getDescription(), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_data, null, localIndexInfo.getDescription(), false, false, null);
}
}
@@ -349,8 +387,8 @@ public class MapDataMenuController extends MenuController {
leftDownloadButtonController.visible = false;
}
- rightDownloadButtonController.visible = downloaded;
- bottomTitleButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0)
+ bottomTitleButtonController.visible = downloaded;
+ rightDownloadButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0)
|| (otherLocalIndexInfos != null && otherLocalIndexInfos.size() > 0);
boolean internetConnectionAvailable =
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
index ce7d2b33ea..c8247d34e5 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
@@ -89,7 +89,7 @@ public class MapMarkerMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return MapMarkerDialogHelper.getMapMarkerIcon(getMapActivity().getMyApplication(), mapMarker.colorIndex);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MyLocationMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MyLocationMenuController.java
index d1f2fc6624..4cb05ddca3 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MyLocationMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MyLocationMenuController.java
@@ -42,7 +42,7 @@ public class MyLocationMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
ApplicationMode appMode = getMapActivity().getMyApplication().getSettings().getApplicationMode();
return getMapActivity().getResources().getDrawable(appMode.getResourceLocationDay());
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java
index 8d875706c2..86f2836b8f 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java
@@ -46,7 +46,7 @@ public class PointDescriptionMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return getIcon(SearchHistoryFragment.getItemIcon(getPointDescription()));
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java
index 3e834bfa46..1e0961b2b0 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java
@@ -49,7 +49,7 @@ public class RenderedObjectMenuController extends MenuController {
}
@Override
- public int getLeftIconId() {
+ public int getRightIconId() {
if (renderedObject.getIconRes() != null && RenderingIcons.containsBigIcon(renderedObject.getIconRes())) {
return RenderingIcons.getBigIconResourceId(renderedObject.getIconRes());
} else {
@@ -95,7 +95,7 @@ public class RenderedObjectMenuController extends MenuController {
if (entry.getKey().equalsIgnoreCase("maxheight")) {
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(entry.getKey());
if (pt != null) {
- addPlainMenuItem(R.drawable.ic_action_note_dark, pt.getTranslation() + ": " + entry.getValue(), false, false, null);
+ addPlainMenuItem(R.drawable.ic_action_note_dark, null, pt.getTranslation() + ": " + entry.getValue(), false, false, null);
}
}
}
@@ -110,7 +110,7 @@ public class RenderedObjectMenuController extends MenuController {
} else {
link = "https://www.openstreetmap.org/way/";
}
- addPlainMenuItem(R.drawable.ic_action_info_dark, link + (renderedObject.getId() >> 7), true, true, null);
+ addPlainMenuItem(R.drawable.ic_action_info_dark, null, link + (renderedObject.getId() >> 7), true, true, null);
}
addMyLocationToPlainItems(latLon);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TargetPointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TargetPointMenuController.java
index 5baf0985cb..da14f135d1 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TargetPointMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TargetPointMenuController.java
@@ -79,7 +79,7 @@ public class TargetPointMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
if (targetPoint.start) {
return getIconOrig(R.drawable.list_startpoint);
} else if (!targetPoint.intermediate) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java
index fe4e748fcf..0809d7a147 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java
@@ -1,5 +1,6 @@
package net.osmand.plus.mapcontextmenu.controllers;
+import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
@@ -12,7 +13,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
-import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.views.TransportStopsLayer;
import java.util.List;
@@ -46,6 +47,30 @@ public class TransportRouteController extends MenuController {
mapActivity.getContextMenu().closeToolbar(TransportRouteController.this);
}
});
+
+ leftTitleButtonController = new TitleButtonController() {
+ @Override
+ public void buttonPressed() {
+ final int previousStop = getPreviousStop();
+ if (previousStop != -1) {
+ showTransportStop(transportRoute.route.getForwardStops().get(previousStop));
+ }
+ }
+ };
+ leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_previous);
+ leftTitleButtonController.leftIconId = R.drawable.ic_arrow_back;
+
+ rightTitleButtonController = new TitleButtonController() {
+ @Override
+ public void buttonPressed() {
+ final int nextStop = getNextStop();
+ if (nextStop != -1) {
+ showTransportStop(transportRoute.route.getForwardStops().get(nextStop));
+ }
+ }
+ };
+ rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_next);
+ rightTitleButtonController.rightIconId = R.drawable.ic_arrow_forward;
}
@Override
@@ -55,13 +80,18 @@ public class TransportRouteController extends MenuController {
}
}
+ @Override
+ public boolean navigateInPedestrianMode() {
+ return true;
+ }
+
@Override
protected Object getObject() {
return transportRoute;
}
@Override
- public int getLeftIconId() {
+ public int getRightIconId() {
return this.transportRoute.type == null ?
R.drawable.mx_public_transport :
this.transportRoute.type.getTopResourceId();
@@ -77,11 +107,6 @@ public class TransportRouteController extends MenuController {
return false;
}
- @Override
- public boolean navigateButtonVisible() {
- return false;
- }
-
@Override
public boolean isClosable() {
return false;
@@ -94,13 +119,17 @@ public class TransportRouteController extends MenuController {
@Override
public String getTypeStr() {
- if (transportRoute.refStop != null) {
- return transportRoute.refStop.getName();
- } else if (transportRoute.stop != null) {
- return transportRoute.stop.getName();
- } else {
- return getPointDescription().getTypeName();
- }
+ return getPointDescription().getName();
+ }
+
+ private String getStopType() {
+ return getMapActivity().getString(transportRoute.getTypeStrRes()) + " " + getMapActivity().getString(R.string.transport_Stop).toLowerCase();
+ }
+
+ @Override
+ public void updateData() {
+ super.updateData();
+ updateControllers();
}
@Override
@@ -121,25 +150,98 @@ public class TransportRouteController extends MenuController {
}
}
+ private void updateControllers() {
+ boolean previousStopEnabled = false;
+ final int previousStop = getPreviousStop();
+ if (previousStop != -1) {
+ previousStopEnabled = true;
+ }
+ leftTitleButtonController.enabled = previousStopEnabled;
+
+ boolean nextStopEnabled = false;
+ final int nextStop = getNextStop();
+ if (nextStop != -1) {
+ nextStopEnabled = true;
+ }
+ rightTitleButtonController.enabled = nextStopEnabled;
+ }
+
+ private void showTransportStop(TransportStop stop) {
+ if (mapContextMenu != null) {
+ transportRoute.stop = stop;
+ transportRoute.refStop = stop;
+ PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
+ transportRoute.getDescription(getMapActivity().getMyApplication(), false));
+
+ updateControllers();
+
+ LatLon stopLocation = stop.getLocation();
+ if (mapContextMenu.isVisible()) {
+ mapContextMenu.updateMapCenter(stopLocation);
+ } else {
+ mapContextMenu.setMapCenter(stopLocation);
+ mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition());
+ }
+ mapContextMenu.setCenterMarker(true);
+ mapContextMenu.setMapZoom(15);
+ mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute);
+ }
+ }
+
+ private int getCurrentStop() {
+ List stops = transportRoute.route.getForwardStops();
+ for (int i = 0; i < stops.size(); i++) {
+ final TransportStop stop = stops.get(i);
+ if (stop.getName().equals(transportRoute.stop.getName())) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private int getNextStop() {
+ List stops = transportRoute.route.getForwardStops();
+ int currentPos = getCurrentStop();
+ if (currentPos != -1 && currentPos + 1 < stops.size()) {
+ return currentPos + 1;
+ }
+ return -1;
+ }
+
+ private int getPreviousStop() {
+ int currentPos = getCurrentStop();
+ if (currentPos > 0) {
+ return currentPos - 1;
+ }
+ return -1;
+ }
+
+ @Override
+ public String getNameStr() {
+ if (transportRoute.refStop != null && !TextUtils.isEmpty(transportRoute.refStop.getName())) {
+ return transportRoute.refStop.getName();
+ } else if (transportRoute.stop != null && !TextUtils.isEmpty(transportRoute.stop.getName())) {
+ return transportRoute.stop.getName();
+ } else if (!TextUtils.isEmpty(getPointDescription().getTypeName())) {
+ return getPointDescription().getTypeName();
+ } else {
+ return getStopType();
+ }
+ }
+
@Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, final LatLon latLon) {
super.addPlainMenuItems(typeStr, pointDescription, latLon);
List stops = transportRoute.route.getForwardStops();
boolean useEnglishNames = getMapActivity().getMyApplication().getSettings().usingEnglishNames();
- int currentStop = -1;
- for (int i = 0; i < stops.size(); i++) {
- final TransportStop stop = stops.get(i);
- if (stop.getName().equals(transportRoute.stop.getName())) {
- currentStop = i;
- break;
- }
- }
+ int currentStop = getCurrentStop();
int defaultIcon = transportRoute.type == null ? R.drawable.mx_route_bus_ref : transportRoute.type.getResourceId();
int startPosition = 0;
if (!transportRoute.showWholeRoute) {
startPosition = (currentStop == -1 ? 0 : currentStop);
if (currentStop > 0) {
- addPlainMenuItem(defaultIcon, getMapActivity().getString(R.string.route_stops_before, currentStop),
+ addPlainMenuItem(defaultIcon, getMapActivity().getString(R.string.shared_string_show),
+ getMapActivity().getString(R.string.route_stops_before, currentStop),
false, false, new OnClickListener() {
@Override
@@ -152,29 +254,16 @@ public class TransportRouteController extends MenuController {
}
for (int i = startPosition; i < stops.size(); i++) {
final TransportStop stop = stops.get(i);
- final String name = useEnglishNames ? stop.getEnName(true) : stop.getName();
+ String name = useEnglishNames ? stop.getEnName(true) : stop.getName();
+ if (TextUtils.isEmpty(name)) {
+ name = getStopType();
+ }
addPlainMenuItem(currentStop == i ? R.drawable.ic_action_marker_dark : defaultIcon,
- name, false, false, new OnClickListener() {
+ null, name, false, false, new OnClickListener() {
@Override
public void onClick(View arg0) {
- if (mapContextMenu != null) {
- transportRoute.stop = stop;
- transportRoute.refStop = stop;
- PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
- transportRoute.getDescription(getMapActivity().getMyApplication(), false));
-
- LatLon stopLocation = stop.getLocation();
- if (mapContextMenu.isVisible()) {
- mapContextMenu.updateMapCenter(stopLocation);
- } else {
- mapContextMenu.setMapCenter(stopLocation);
- mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition());
- }
- mapContextMenu.setCenterMarker(true);
- mapContextMenu.setMapZoom(15);
- mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute);
- }
+ showTransportStop(stop);
/*
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
getMapActivity().getString(R.string.transport_Stop), name);
@@ -202,7 +291,7 @@ public class TransportRouteController extends MenuController {
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
int cz = transportRoute.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
- stopsLayer.setRoute(transportRoute.route);
+ stopsLayer.setRoute(transportRoute);
}
private void resetRoute() {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java
index a0bc74cab8..811c1344fe 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java
@@ -6,17 +6,16 @@ import android.view.View.OnClickListener;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect;
-import net.osmand.data.RotatedTileBox;
import net.osmand.data.TransportRoute;
import net.osmand.data.TransportStop;
-import net.osmand.plus.OsmAndFormatter;
-import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.resources.TransportIndexRepository;
+import net.osmand.plus.transport.TransportStopType;
import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
@@ -29,51 +28,6 @@ import java.util.List;
public class TransportStopController extends MenuController {
- public enum TransportStopType {
- BUS(R.drawable.mx_route_bus_ref, R.drawable.mx_route_bus_ref),
- FERRY(R.drawable.mx_route_ferry_ref, R.drawable.mx_route_ferry_ref),
- FUNICULAR(R.drawable.mx_route_funicular_ref, R.drawable.mx_route_funicular_ref),
- LIGHT_RAIL(R.drawable.mx_route_light_rail_ref, R.drawable.mx_route_light_rail_ref),
- MONORAIL(R.drawable.mx_route_monorail_ref, R.drawable.mx_route_monorail_ref),
- RAILWAY(R.drawable.mx_route_railway_ref, R.drawable.mx_route_railway_ref),
- SHARE_TAXI(R.drawable.mx_route_share_taxi_ref, R.drawable.mx_route_share_taxi_ref),
- TRAIN(R.drawable.mx_route_train_ref, R.drawable.mx_route_train_ref),
- TRAM(R.drawable.mx_route_tram_ref, R.drawable.mx_railway_tram_stop),
- TROLLEYBUS(R.drawable.mx_route_trolleybus_ref, R.drawable.mx_route_trolleybus_ref),
- SUBWAY(R.drawable.mx_subway_station, R.drawable.mx_subway_station);
-
- final int resId;
- final int topResId;
-
- TransportStopType(int resId, int topResId) {
- this.resId = resId;
- this.topResId = topResId;
- }
-
- public int getResourceId() {
- return resId;
- }
-
- public int getTopResourceId() {
- return topResId;
- }
-
- public boolean isTopType() {
- return this == TRAM || this == SUBWAY;
- }
-
- public static TransportStopType findType(String typeName) {
- String tName = typeName.toUpperCase();
- for (TransportStopType t : values()) {
- if (t.name().equals(tName)) {
- return t;
- }
- }
- return null;
- }
-
- }
-
private TransportStop transportStop;
private List routes = new ArrayList<>();
private TransportStopType topType;
@@ -82,26 +36,29 @@ public class TransportStopController extends MenuController {
PointDescription pointDescription, TransportStop transportStop) {
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
this.transportStop = transportStop;
- routes = processTransportStop();
- builder.setRoutes(routes);
+ processRoutes();
}
@Override
protected void setObject(Object object) {
if (object instanceof TransportStop) {
this.transportStop = (TransportStop) object;
- routes = processTransportStop();
- builder.setRoutes(routes);
+ processRoutes();
}
}
+ private void processRoutes() {
+ routes = processTransportStop();
+ builder.setRoutes(routes);
+ }
+
@Override
protected Object getObject() {
return transportStop;
}
@Override
- public int getLeftIconId() {
+ public int getRightIconId() {
if (topType == null) {
return R.drawable.mx_public_transport;
} else {
@@ -204,42 +161,4 @@ public class TransportStopController extends MenuController {
return false;
}
- public static class TransportStopRoute {
- public TransportStop refStop;
- public TransportStopType type;
- public String desc;
- public TransportRoute route;
- public TransportStop stop;
- public int distance;
- public boolean showWholeRoute;
-
- public String getDescription(OsmandApplication ctx, boolean useDistance) {
- if (useDistance && distance > 0) {
- String nm = OsmAndFormatter.getFormattedDistance(distance, ctx);
- if (refStop != null && !refStop.getName().equals(stop.getName())) {
- nm = refStop.getName() + ", " + nm;
- }
- return desc + " (" + nm + ")";
- }
- return desc;
- }
-
- public int calculateZoom(int startPosition, RotatedTileBox currentRotatedTileBox) {
- RotatedTileBox cp = currentRotatedTileBox.copy();
- boolean notContains = true;
- while (cp.getZoom() > 12 && notContains) {
- notContains = false;
- List sts = route.getForwardStops();
- for(int i = startPosition; i < sts.size(); i++) {
- TransportStop st = sts.get(startPosition);
- if (!cp.containsLatLon(st.getLocation())) {
- notContains = true;
- break;
- }
- }
- cp.setZoom(cp.getZoom() - 1);
- }
- return cp.getZoom();
- }
- }
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java
index bef7636dc5..6290b45571 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java
@@ -76,17 +76,17 @@ public class WptPtMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(),
wpt.getColor(ContextCompat.getColor(getMapActivity(), R.color.gpx_color_point)), false);
}
@Override
- public Drawable getAdditionalLineTypeIcon() {
- if (Algorithms.isEmpty(getAdditionalTypeStr())) {
+ public Drawable getSubtypeIcon() {
+ if (Algorithms.isEmpty(getSubtypeStr())) {
return null;
} else {
- return getIcon(R.drawable.ic_action_group_name_16);
+ return getIcon(R.drawable.ic_action_group_name_16, isLight() ? R.color.icon_color : R.color.ctx_menu_bottom_view_icon_dark);
}
}
@@ -111,7 +111,7 @@ public class WptPtMenuController extends MenuController {
}
@Override
- public String getAdditionalTypeStr() {
+ public String getSubtypeStr() {
return wpt.category != null ? wpt.category : "";
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java
index d98a9d30f5..83c8792215 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java
@@ -4,6 +4,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
+import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -38,10 +39,10 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
view = inflater.inflate(R.layout.menu_obj_selection_fragment, container, false);
if (menu.isLandscapeLayout()) {
AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(),
- R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
+ R.drawable.multi_selection_menu_bg_light_land, R.drawable.multi_selection_menu_bg_dark_land);
} else {
AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(),
- R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
+ R.drawable.multi_selection_menu_bg_light, R.drawable.multi_selection_menu_bg_dark);
}
ListView listView = (ListView) view.findViewById(R.id.list);
@@ -49,11 +50,6 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
AndroidUtils.addStatusBarPadding21v(getActivity(), listView);
}
View headerView = inflater.inflate(R.layout.menu_obj_selection_header, listView, false);
- if (!menu.isLight()) {
- ((TextViewEx) headerView.findViewById(R.id.header_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
- ((TextView) view.findViewById(R.id.cancel_row_text)).setTextColor(getResources().getColor(R.color.color_dialog_buttons_dark));
- view.findViewById(R.id.divider).setBackgroundResource(R.color.dashboard_divider_dark);
- }
headerView.setOnClickListener(null);
listView.addHeaderView(headerView);
listAdapter = createAdapter();
@@ -62,6 +58,9 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
runLayoutListener();
+ view.findViewById(R.id.divider).setBackgroundColor(ContextCompat.getColor(getContext(), menu.isLight() ? R.color.multi_selection_menu_divider_light : R.color.multi_selection_menu_divider_dark));
+
+ ((TextView) view.findViewById(R.id.cancel_row_text)).setTextColor(ContextCompat.getColor(getContext(), menu.isLight() ? R.color.multi_selection_menu_close_btn_light : R.color.multi_selection_menu_close_btn_dark));
view.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java
index 627fa10fde..49c164ea01 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java
@@ -259,24 +259,16 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
private void updateViaView(final View parentView) {
String via = generateViaDescription();
View viaLayout = parentView.findViewById(R.id.ViaLayout);
- View fromLayoutEmptyView = parentView.findViewById(R.id.from_layout_empty_view);
- View toLayoutEmptyView = parentView.findViewById(R.id.to_layout_empty_view);
- View dividerFromDropDownEmpty = parentView.findViewById(R.id.divider_from_drop_down_empty);
+ View viaLayoutDivider = parentView.findViewById(R.id.viaLayoutDivider);
ImageView swapDirectionView = (ImageView) parentView.findViewById(R.id.swap_direction_image_view);
if (via.length() == 0) {
viaLayout.setVisibility(View.GONE);
- parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE);
- dividerFromDropDownEmpty.setVisibility(View.GONE);
- fromLayoutEmptyView.setVisibility(View.VISIBLE);
- toLayoutEmptyView.setVisibility(View.VISIBLE);
+ viaLayoutDivider.setVisibility(View.GONE);
swapDirectionView.setVisibility(View.VISIBLE);
} else {
- fromLayoutEmptyView.setVisibility(View.GONE);
- toLayoutEmptyView.setVisibility(View.GONE);
swapDirectionView.setVisibility(View.GONE);
- dividerFromDropDownEmpty.setVisibility(View.VISIBLE);
viaLayout.setVisibility(View.VISIBLE);
- parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE);
+ viaLayoutDivider.setVisibility(View.VISIBLE);
((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
}
@@ -294,7 +286,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
swapDirectionView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_change_navigation_points,
isLight() ? R.color.route_info_control_icon_color_light : R.color.route_info_control_icon_color_dark));
- AndroidUtils.setBackground(mapActivity, swapDirectionView, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
swapDirectionView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -638,7 +629,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
} else {
infoIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_route_distance, R.color.route_info_unchecked_mode_icon_color));
infoIcon.setVisibility(View.VISIBLE);
- durationIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_time, R.color.route_info_unchecked_mode_icon_color));
+ durationIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_time_span, R.color.route_info_unchecked_mode_icon_color));
durationIcon.setVisibility(View.VISIBLE);
infoDistanceView.setVisibility(View.VISIBLE);
infoDurationView.setVisibility(View.VISIBLE);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java
index f55010cfad..b4e151b190 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java
@@ -150,8 +150,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode,
R.color.route_info_divider_light, R.color.route_info_divider_dark);
- AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.divider_from_drop_down_empty), nightMode,
- R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode,
R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode,
@@ -170,14 +168,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.fromTitle), nightMode);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.InfoTextView), nightMode);
- AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.FromLayout), nightMode);
- AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ViaLayout), nightMode);
- AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ToLayout), nightMode);
- AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Info), nightMode);
-
- AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Next), nightMode);
- AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Prev), nightMode);
-
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceText), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceTitle), nightMode);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java
index aec2ad774e..c98342c0e2 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java
@@ -38,8 +38,6 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter {
- private ColorStateList dividerControlColorStateList = new ColorStateList(
- new int[][]{
- new int[]{android.R.attr.state_pressed},
- new int[]{}
- },
- new int[] {
- getResources().getColor(R.color.keyboard_item_divider_control_color_light_pressed),
- getResources().getColor(R.color.keyboard_item_divider_control_color_light)
- }
- );
- private ColorStateList numberColorStateList = new ColorStateList(
- new int[][]{
- new int[]{android.R.attr.state_pressed},
- new int[]{}
- },
- new int[] {
- getResources().getColor(R.color.keyboard_item_text_color_light_pressed),
- getResources().getColor(R.color.keyboard_item_text_color_light)
- }
- );
+ private ColorStateList dividerControlColorStateList = AndroidUtils.createColorStateList(getContext(), false,
+ R.color.keyboard_item_divider_control_color_light, R.color.keyboard_item_divider_control_color_light_pressed,
+ 0, 0);
+ private ColorStateList numberColorStateList = AndroidUtils.createColorStateList(getContext(), false,
+ R.color.keyboard_item_text_color_light, R.color.keyboard_item_text_color_light_pressed,
+ 0, 0);
KeyboardAdapter(@NonNull Context context, @NonNull Object[] objects) {
super(context, 0, objects);
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java
index 742ba1c410..d4e53c0e68 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java
@@ -30,8 +30,8 @@ public class EditPOIMenuBuilder extends MenuBuilder {
if (osmPoint instanceof OsmNotesPoint) {
OsmNotesPoint notes = (OsmNotesPoint) osmPoint;
- buildRow(view, R.drawable.ic_action_note_dark, notes.getText(), 0, false, null, false, 0, false, null, false);
- buildRow(view, R.drawable.ic_group, notes.getAuthor(), 0, false, null, false, 0, false, null, false);
+ buildRow(view, R.drawable.ic_action_note_dark, null, notes.getText(), 0, false, null, false, 0, false, null, false);
+ buildRow(view, R.drawable.ic_group, null, notes.getAuthor(), 0, false, null, false, 0, false, null, false);
} else if (osmPoint instanceof OpenstreetmapPoint) {
OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint;
@@ -56,7 +56,7 @@ public class EditPOIMenuBuilder extends MenuBuilder {
if (resId == 0) {
resId = R.drawable.ic_action_folder_stroke;
}
- buildRow(view, resId, poiTranslation, 0, false, null, false, 0, false, null, false);
+ buildRow(view, resId, null, poiTranslation, 0, false, null, false, 0, false, null, false);
break;
}
}
@@ -67,11 +67,11 @@ public class EditPOIMenuBuilder extends MenuBuilder {
continue;
}
String text = e.getKey() + "=" + e.getValue();
- buildRow(view, R.drawable.ic_action_info_dark, text, 0, false, null, false, 0, false, null, false);
+ buildRow(view, R.drawable.ic_action_info_dark, null, text, 0, false, null, false, 0, false, null, false);
}
}
- buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
+ buildRow(view, R.drawable.ic_action_get_my_location, null, PointDescription.getLocationName(app,
osmPoint.getLatitude(), osmPoint.getLongitude(), true)
.replaceAll("\n", " "), 0, false, null, false, 0, false, null, false);
}
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java
index be90b2bd7a..4808a06256 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java
@@ -5,19 +5,24 @@ import android.graphics.drawable.Drawable;
import android.support.v7.app.AlertDialog;
import net.osmand.data.PointDescription;
+import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.osmedit.OsmPoint.Action;
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
+import net.osmand.plus.render.RenderingIcons;
import net.osmand.util.Algorithms;
+import java.util.Map;
+
public class EditPOIMenuController extends MenuController {
private OsmPoint osmPoint;
private OsmEditingPlugin plugin;
- private String pointTypeStr;
+ private String category;
+ private String actionStr;
public EditPOIMenuController(final MapActivity mapActivity, PointDescription pointDescription, OsmPoint osmPoint) {
super(new EditPOIMenuBuilder(mapActivity, osmPoint), pointDescription, mapActivity);
@@ -70,30 +75,36 @@ public class EditPOIMenuController extends MenuController {
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
+ category = getCategory();
+
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
if(osmPoint.getAction() == Action.DELETE) {
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_deleted_poi);
+ actionStr = getMapActivity().getString(R.string.osm_edit_deleted_poi);
} else if(osmPoint.getAction() == Action.MODIFY) {
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_modified_poi);
+ actionStr = getMapActivity().getString(R.string.osm_edit_modified_poi);
} else/* if(osmPoint.getAction() == Action.CREATE) */{
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_poi);
+ actionStr = getMapActivity().getString(R.string.osm_edit_created_poi);
}
-
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
if(osmPoint.getAction() == Action.DELETE) {
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_removed_note);
+ actionStr = getMapActivity().getString(R.string.osm_edit_removed_note);
} else if(osmPoint.getAction() == Action.MODIFY) {
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_commented_note);
+ actionStr = getMapActivity().getString(R.string.osm_edit_commented_note);
} else if(osmPoint.getAction() == Action.REOPEN) {
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_reopened_note);
+ actionStr = getMapActivity().getString(R.string.osm_edit_reopened_note);
} else/* if(osmPoint.getAction() == Action.CREATE) */{
- pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_note);
+ actionStr = getMapActivity().getString(R.string.osm_edit_created_note);
}
} else {
- pointTypeStr = "";
+ actionStr = "";
}
}
+ @Override
+ public String getTypeStr() {
+ return category;
+ }
+
@Override
protected void setObject(Object object) {
if (object instanceof OsmPoint) {
@@ -112,21 +123,85 @@ public class EditPOIMenuController extends MenuController {
@Override
public boolean needTypeStr() {
- return !Algorithms.isEmpty(pointTypeStr);
+ return !Algorithms.isEmpty(category);
}
@Override
- public Drawable getLeftIcon() {
- return getIcon(R.drawable.ic_action_gabout_dark, R.color.created_poi_icon_color);
+ public boolean displayDistanceDirection() {
+ return true;
}
@Override
- public String getTypeStr() {
- return pointTypeStr;
+ public String getAdditionalInfoStr() {
+ return actionStr;
+ }
+
+ @Override
+ public int getAdditionalInfoColor() {
+ if (osmPoint.getAction() == Action.DELETE) {
+ return R.color.color_osm_edit_delete;
+ } else if (osmPoint.getAction() == Action.MODIFY || osmPoint.getAction() == Action.REOPEN) {
+ return R.color.color_osm_edit_modify;
+ } else {
+ return R.color.color_osm_edit_create;
+ }
+ }
+
+ @Override
+ public int getRightIconId() {
+ if (osmPoint.getGroup() == OsmPoint.Group.POI) {
+ OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint;
+ int iconResId = 0;
+ String poiTranslation = osmP.getEntity().getTag(EditPoiData.POI_TYPE_TAG);
+ if (poiTranslation != null) {
+ Map poiTypeMap = getMapActivity().getMyApplication().getPoiTypes().getAllTranslatedNames(false);
+ PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase());
+ if (poiType != null) {
+ String id = null;
+ if (RenderingIcons.containsBigIcon(poiType.getIconKeyName())) {
+ id = poiType.getIconKeyName();
+ } else if (RenderingIcons.containsBigIcon(poiType.getOsmTag() + "_" + poiType.getOsmValue())) {
+ id = poiType.getOsmTag() + "_" + poiType.getOsmValue();
+ }
+ if (id != null) {
+ iconResId = RenderingIcons.getBigIconResourceId(id);
+ }
+ }
+ }
+ if (iconResId == 0) {
+ iconResId = R.drawable.ic_type_info;
+ }
+ return iconResId;
+ } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
+ return R.drawable.ic_type_bug;
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public int getAdditionalInfoIconRes() {
+ if (osmPoint.getAction() == Action.DELETE) {
+ return R.drawable.ic_action_type_delete_16;
+ } else if (osmPoint.getAction() == Action.MODIFY || osmPoint.getAction() == Action.REOPEN) {
+ return R.drawable.ic_action_type_edit_16;
+ } else {
+ return R.drawable.ic_action_type_add_16;
+ }
}
@Override
public boolean needStreetName() {
return false;
}
+
+ private String getCategory() {
+ String category = "";
+ if (osmPoint.getGroup() == OsmPoint.Group.POI) {
+ category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
+ } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
+ category = getMapActivity().getString(R.string.osn_bug_name);
+ }
+ return category;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java
index 599556335e..02df976545 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java
@@ -73,7 +73,7 @@ public class OsmBugMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
if (bug.isOpened()) {
return getIcon(R.drawable.ic_action_gabout_dark, R.color.osm_bug_unresolved_icon_color);
} else {
@@ -95,7 +95,7 @@ public class OsmBugMenuController extends MenuController {
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
super.addPlainMenuItems(typeStr, pointDescription, latLon);
for (String description : bug.getCommentDescriptionList()) {
- addPlainMenuItem(R.drawable.ic_action_note_dark, description, true, false, null);
+ addPlainMenuItem(R.drawable.ic_action_note_dark, null, description, true, false, null);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoMenuController.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoMenuController.java
index 222d01300b..46e3c463f9 100644
--- a/OsmAnd/src/net/osmand/plus/osmo/OsMoMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoMenuController.java
@@ -96,7 +96,7 @@ public class OsMoMenuController extends MenuController {
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
if (isLight()) {
return getIconOrig(R.drawable.widget_osmo_connected_location_day);
} else {
diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java
index f18a927400..61badd42bb 100644
--- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java
@@ -64,17 +64,17 @@ public class ParkingPositionMenuController extends MenuController {
}
@Override
- public String getAdditionalTypeStr() {
+ public int getAdditionalInfoIconRes() {
+ return R.drawable.ic_action_opening_hour_16;
+ }
+
+ @Override
+ public String getAdditionalInfoStr() {
return parkingLeftDescription;
}
@Override
- public boolean displayAdditionalTypeStrInHours() {
- return true;
- }
-
- @Override
- public int getTimeStrColor() {
+ public int getAdditionalInfoColor() {
return plugin.getParkingType() ? R.color.ctx_menu_amenity_closed_text_color : isLight() ? R.color.icon_color : R.color.dash_search_icon_dark;
}
@@ -83,13 +83,18 @@ public class ParkingPositionMenuController extends MenuController {
return parkingTitle;
}
+ @Override
+ public boolean navigateInPedestrianMode() {
+ return true;
+ }
+
@Override
public boolean displayDistanceDirection() {
return true;
}
@Override
- public Drawable getLeftIcon() {
+ public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_parking_dark, R.color.map_widget_blue);
}
diff --git a/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java b/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java
new file mode 100644
index 0000000000..2cf17fdad1
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java
@@ -0,0 +1,105 @@
+package net.osmand.plus.transport;
+
+import net.osmand.data.RotatedTileBox;
+import net.osmand.data.TransportRoute;
+import net.osmand.data.TransportStop;
+import net.osmand.plus.OsmAndFormatter;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.render.RenderingRuleSearchRequest;
+import net.osmand.render.RenderingRulesStorage;
+
+import java.util.List;
+
+public class TransportStopRoute {
+ public TransportStop refStop;
+ public TransportStopType type;
+ public String desc;
+ public TransportRoute route;
+ public TransportStop stop;
+ public int distance;
+ public boolean showWholeRoute;
+ private int cachedColor;
+ private boolean cachedNight;
+
+ public String getDescription(OsmandApplication ctx, boolean useDistance) {
+ if (useDistance && distance > 0) {
+ String nm = OsmAndFormatter.getFormattedDistance(distance, ctx);
+ if (refStop != null && !refStop.getName().equals(stop.getName())) {
+ nm = refStop.getName() + ", " + nm;
+ }
+ return desc + " (" + nm + ")";
+ }
+ return desc;
+ }
+
+ public int calculateZoom(int startPosition, RotatedTileBox currentRotatedTileBox) {
+ RotatedTileBox cp = currentRotatedTileBox.copy();
+ boolean notContains = true;
+ while (cp.getZoom() > 12 && notContains) {
+ notContains = false;
+ List sts = route.getForwardStops();
+ for (int i = startPosition; i < sts.size(); i++) {
+ TransportStop st = sts.get(startPosition);
+ if (!cp.containsLatLon(st.getLocation())) {
+ notContains = true;
+ break;
+ }
+ }
+ cp.setZoom(cp.getZoom() - 1);
+ }
+ return cp.getZoom();
+ }
+
+ public int getColor(OsmandApplication ctx, boolean nightMode) {
+ if (cachedColor == 0 || cachedNight != nightMode) {
+ cachedColor = ctx.getResources().getColor(R.color.transport_route_line);
+ cachedNight = nightMode;
+ if (type != null) {
+ RenderingRulesStorage rrs = ctx.getRendererRegistry().getCurrentSelectedRenderer();
+ RenderingRuleSearchRequest req = new RenderingRuleSearchRequest(rrs);
+ req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
+ String typeStr = type.getRendeAttr();
+ if (req.searchRenderingAttribute(typeStr)) {
+ cachedColor = req.getIntPropertyValue(rrs.PROPS.R_ATTR_COLOR_VALUE);
+ }
+ }
+ }
+
+ return cachedColor;
+ }
+
+ public int getTypeStrRes() {
+ if (type != null) {
+ switch (type) {
+ case BUS:
+ return R.string.poi_route_bus_ref;
+ case TRAM:
+ return R.string.poi_route_tram_ref;
+ case FERRY:
+ return R.string.poi_route_ferry_ref;
+ case TRAIN:
+ return R.string.poi_route_train_ref;
+ case SHARE_TAXI:
+ return R.string.poi_route_share_taxi_ref;
+ case FUNICULAR:
+ return R.string.poi_route_funicular_ref;
+ case LIGHT_RAIL:
+ return R.string.poi_route_light_rail_ref;
+ case MONORAIL:
+ return R.string.poi_route_monorail_ref;
+ case TROLLEYBUS:
+ return R.string.poi_route_trolleybus_ref;
+ case RAILWAY:
+ return R.string.poi_route_railway_ref;
+ case SUBWAY:
+ return R.string.poi_route_subway_ref;
+ default:
+ return R.string.poi_filter_public_transport;
+ }
+ } else {
+ return R.string.poi_filter_public_transport;
+ }
+ }
+
+}
diff --git a/OsmAnd/src/net/osmand/plus/transport/TransportStopType.java b/OsmAnd/src/net/osmand/plus/transport/TransportStopType.java
new file mode 100644
index 0000000000..63dfcae17c
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/transport/TransportStopType.java
@@ -0,0 +1,54 @@
+package net.osmand.plus.transport;
+
+import net.osmand.plus.R;
+
+public enum TransportStopType {
+ BUS(R.drawable.mx_route_bus_ref, R.drawable.mx_route_bus_ref, "routeBusColor"),
+ FERRY(R.drawable.mx_route_ferry_ref, R.drawable.mx_route_ferry_ref, "routeFerryColor"),
+ FUNICULAR(R.drawable.mx_route_funicular_ref, R.drawable.mx_route_funicular_ref, "routeFunicularColor"),
+ LIGHT_RAIL(R.drawable.mx_route_light_rail_ref, R.drawable.mx_route_light_rail_ref, "routeLightrailColor"),
+ MONORAIL(R.drawable.mx_route_monorail_ref, R.drawable.mx_route_monorail_ref, "routeLightrailColor"),
+ RAILWAY(R.drawable.mx_route_railway_ref, R.drawable.mx_route_railway_ref, "routeTrainColor"),
+ SHARE_TAXI(R.drawable.mx_route_share_taxi_ref, R.drawable.mx_route_share_taxi_ref, "routeShareTaxiColor"),
+ TRAIN(R.drawable.mx_route_train_ref, R.drawable.mx_route_train_ref, "routeTrainColor"),
+ TRAM(R.drawable.mx_route_tram_ref, R.drawable.mx_railway_tram_stop, "routeTramColor"),
+ TROLLEYBUS(R.drawable.mx_route_trolleybus_ref, R.drawable.mx_route_trolleybus_ref, "routeTrolleybusColor"),
+ SUBWAY(R.drawable.mx_subway_station, R.drawable.mx_subway_station, "routeTrainColor");
+
+ final int resId;
+ final int topResId;
+ final String renderAttr;
+
+ TransportStopType(int resId, int topResId, String renderAttr) {
+ this.resId = resId;
+ this.topResId = topResId;
+ this.renderAttr = renderAttr;
+ }
+
+ public int getResourceId() {
+ return resId;
+ }
+
+ public int getTopResourceId() {
+ return topResId;
+ }
+
+ public String getRendeAttr() {
+ return renderAttr;
+ }
+
+ public boolean isTopType() {
+ return this == TRAM || this == SUBWAY;
+ }
+
+ public static TransportStopType findType(String typeName) {
+ String tName = typeName.toUpperCase();
+ for (TransportStopType t : values()) {
+ if (t.name().equals(tName)) {
+ return t;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java
index 4645bc1d82..02f579a3c1 100644
--- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java
@@ -504,7 +504,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
view.setLatLon(lat, lon);
mInChangeMarkerPositionMode = true;
- mMoveMarkerBottomSheetHelper.show(menu.getLeftIcon());
+ mMoveMarkerBottomSheetHelper.show(menu.getRightIcon());
mark(View.INVISIBLE, R.id.map_ruler_layout,
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);
diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
index f3d7b33ee7..580305735c 100644
--- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
@@ -295,7 +295,6 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
cancelRouteButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_cancel, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light));
- AndroidUtils.setBackground(mapActivity, cancelRouteButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -305,7 +304,6 @@ public class MapControlsLayer extends OsmandMapLayer {
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
waypointsButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_flag_dark, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light));
- AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
waypointsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -316,7 +314,6 @@ public class MapControlsLayer extends OsmandMapLayer {
ImageView options = (ImageView) main.findViewById(R.id.map_options_route_button);
options.setImageDrawable(!routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_settings,
R.color.osmand_orange) : app.getIconsCache().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light));
- AndroidUtils.setBackground(mapActivity, options, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
options.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java
index 052fddef22..0d5ccd85be 100644
--- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java
@@ -18,6 +18,7 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
+import android.text.Html;
import android.text.util.Linkify;
import android.util.TypedValue;
import android.view.Gravity;
@@ -289,13 +290,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
return true;
}
- public static void showWikipediaDialog(Context ctx, OsmandApplication app, Amenity a) {
- String lang = app.getSettings().MAP_PREFERRED_LOCALE.get();
- if (a.getType().isWiki()) {
- showWiki(ctx, app, a, lang);
- }
- }
-
public static void showDescriptionDialog(Context ctx, OsmandApplication app, String text, String title) {
showText(ctx, app, text, title);
}
@@ -308,122 +302,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
ctx.getTheme().resolveAttribute(attr, typedvalueattr, true);
return typedvalueattr.resourceId;
}
-
-
- @SuppressWarnings("deprecation")
- private static void showWiki(final Context ctx, final OsmandApplication app, final Amenity a, final String lang) {
- String preferredLang = lang;
- if (Algorithms.isEmpty(preferredLang)) {
- preferredLang = app.getLanguage();
- }
- final Dialog dialog = new Dialog(ctx,
- app.getSettings().isLightContent() ?
- R.style.OsmandLightTheme :
- R.style.OsmandDarkTheme);
- final String title = Algorithms.isEmpty(preferredLang) ? a.getName() : a.getName(preferredLang);
- LinearLayout ll = new LinearLayout(ctx);
- ll.setOrientation(LinearLayout.VERTICAL);
-
- final Toolbar topBar = new Toolbar(ctx);
- topBar.setClickable(true);
- Drawable back = app.getIconsCache().getIcon(R.drawable.ic_arrow_back);
- topBar.setNavigationIcon(back);
- topBar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
- topBar.setTitle(title);
- topBar.setBackgroundColor(ContextCompat.getColor(ctx, getResIdFromAttribute(ctx, R.attr.pstsTabBackground)));
- topBar.setTitleTextColor(ContextCompat.getColor(ctx, getResIdFromAttribute(ctx, R.attr.pstsTextColor)));
-
- String lng = a.getContentLanguage("content", preferredLang, "en");
- if (Algorithms.isEmpty(lng)) {
- lng = "en";
- }
-
- final String langSelected = lng;
- String content = a.getDescription(langSelected);
- final Button bottomBar = new Button(ctx);
- bottomBar.setText(R.string.read_full_article);
- bottomBar.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- String article = "https://" + langSelected.toLowerCase() + ".wikipedia.org/wiki/" + title.replace(' ', '_');
- Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(Uri.parse(article));
- ctx.startActivity(i);
- }
- });
- MenuItem mi = topBar.getMenu().add(langSelected.toUpperCase()).setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(final MenuItem item) {
- showPopupLangMenu(ctx, topBar, app, a, dialog, langSelected);
- return true;
- }
- });
- MenuItemCompat.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_ALWAYS);
- topBar.setNavigationOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(final View v) {
- dialog.dismiss();
- }
- });
- final WebView wv = new WebView(ctx);
- WebSettings settings = wv.getSettings();
- settings.setDefaultTextEncodingName("utf-8");
-
- settings.setBuiltInZoomControls(true);
- settings.setDisplayZoomControls(false);
- settings.setSupportZoom(true);
-
- //Scale web view font size with system font size
- float scale = ctx.getResources().getConfiguration().fontScale;
- if (android.os.Build.VERSION.SDK_INT >= 14) {
- settings.setTextZoom((int) (scale * 100f));
- } else {
- if (scale <= 0.7f) {
- settings.setTextSize(WebSettings.TextSize.SMALLEST);
- } else if (scale <= 0.85f) {
- settings.setTextSize(WebSettings.TextSize.SMALLER);
- } else if (scale <= 1.0f) {
- settings.setTextSize(WebSettings.TextSize.NORMAL);
- } else if (scale <= 1.15f) {
- settings.setTextSize(WebSettings.TextSize.LARGER);
- } else {
- settings.setTextSize(WebSettings.TextSize.LARGEST);
- }
- }
-
- wv.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null);
-// wv.loadUrl(OsMoService.SIGN_IN_URL + app.getSettings().OSMO_DEVICE_KEY.get());
- //For pinch zooming to work WebView must not be inside ScrollView
- //ScrollView scrollView = new ScrollView(ctx);
- ll.addView(topBar);
- LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0);
- lp.weight = 1;
- //ll.addView(scrollView, lp);
- //scrollView.addView(wv);
- ll.addView(wv, lp);
- ll.addView(bottomBar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
- dialog.setContentView(ll);
- wv.setFocusable(true);
- wv.setFocusableInTouchMode(true);
- wv.requestFocus(View.FOCUS_DOWN);
- wv.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_UP:
- if (!v.hasFocus()) {
- v.requestFocus();
- }
- break;
- }
- return false;
- }
- });
-
- dialog.setCancelable(true);
- dialog.show();
- }
private static void showText(final Context ctx, final OsmandApplication app, final String text, String title) {
final Dialog dialog = new Dialog(ctx,
@@ -471,50 +349,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
dialog.show();
}
- protected static void showPopupLangMenu(final Context ctx, Toolbar tb,
- final OsmandApplication app, final Amenity a,
- final Dialog dialog, final String langSelected) {
- final PopupMenu optionsMenu = new PopupMenu(ctx, tb, Gravity.RIGHT);
- Set namesSet = new TreeSet<>();
- namesSet.addAll(a.getNames("content", "en"));
- namesSet.addAll(a.getNames("description", "en"));
-
- Map names = new HashMap<>();
- for (String n : namesSet) {
- names.put(n, FileNameTranslationHelper.getVoiceName(ctx, n));
- }
- String selectedLangName = names.get(langSelected);
- if (selectedLangName != null) {
- names.remove(langSelected);
- }
- Map sortedNames = AndroidUtils.sortByValue(names);
-
- if (selectedLangName != null) {
- MenuItem item = optionsMenu.getMenu().add(selectedLangName);
- item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- dialog.dismiss();
- showWiki(ctx, app, a, langSelected);
- return true;
- }
- });
- }
- for (final Map.Entry e : sortedNames.entrySet()) {
- MenuItem item = optionsMenu.getMenu().add(e.getValue());
- item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- dialog.dismiss();
- showWiki(ctx, app, a, e.getKey());
- return true;
- }
- });
- }
- optionsMenu.show();
-
- }
-
@Override
public PointDescription getObjectName(Object o) {
if (o instanceof Amenity) {
diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java
index be9959b371..7fd642d9df 100644
--- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java
@@ -16,11 +16,11 @@ import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect;
import net.osmand.data.QuadTree;
import net.osmand.data.RotatedTileBox;
-import net.osmand.data.TransportRoute;
import net.osmand.data.TransportStop;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.Way;
import net.osmand.plus.R;
+import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.activities.MapActivity;
import java.util.ArrayList;
@@ -44,7 +44,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
private RenderingLineAttributes attrs;
private MapLayerData> data;
- private TransportRoute route = null;
+ private TransportStopRoute stopRoute = null;
private boolean showTransportStops;
private Path path;
@@ -66,8 +66,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
stopBus = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_bus);
stopSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_transport_stop_small);
attrs = new RenderingLineAttributes("transport_route");
- attrs.defaultWidth = (int) (12 * view.getDensity());
- attrs.defaultColor = view.getResources().getColor(R.color.transport_route_line);
+ attrs.defaultWidth = (int) (6 * view.getDensity());
data = new OsmandMapLayer.MapLayerData>() {
{
ZOOM_THRESHOLD = 0;
@@ -143,12 +142,12 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
}
}
- public TransportRoute getRoute() {
- return route;
+ public TransportStopRoute getRoute() {
+ return stopRoute;
}
- public void setRoute(TransportRoute route) {
- this.route = route;
+ public void setRoute(TransportStopRoute route) {
+ this.stopRoute = route;
}
public boolean isShowTransportStops() {
@@ -175,18 +174,19 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
}
return (int) (r * tb.getDensity());
}
-
@Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
List objects = null;
if (tb.getZoom() >= startZoomRoute) {
- if (route != null) {
- objects = route.getForwardStops();
+ if (stopRoute != null) {
+ objects = stopRoute.route.getForwardStops();
+ int color = stopRoute.getColor(mapActivity.getMyApplication(), settings.isNightMode());
+ attrs.paint.setColor(color);
attrs.updatePaints(view, settings, tb);
try {
path.reset();
- List ws = route.getForwardWays();
+ List ws = stopRoute.route.getForwardWays();
if (ws != null) {
for (Way w : ws) {
TIntArrayList tx = new TIntArrayList();
@@ -286,8 +286,8 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
@Override
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List