Wikipedia Poi Fixes (After review)
This commit is contained in:
parent
c96e1e5324
commit
989417ffab
23 changed files with 233 additions and 128 deletions
|
@ -218,6 +218,18 @@ public class Amenity extends MapObject {
|
|||
return lng;
|
||||
}
|
||||
|
||||
public List<String> getSupportedLocales(List<String> locales) {
|
||||
List<String> supported = new ArrayList<>();
|
||||
if (locales != null) {
|
||||
for (String locale : locales) {
|
||||
if (!Algorithms.isEmpty(getAdditionalInfo("content:" + locale))) {
|
||||
supported.add(locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
public List<String> getNames(String tag, String defTag) {
|
||||
List<String> l = new ArrayList<String>();
|
||||
for (String nm : getAdditionalInfo().keySet()) {
|
||||
|
|
|
@ -1,107 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/setting_list_item_large_height"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/setting_list_item_large_height">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginStart="@dimen/list_content_padding"
|
||||
tools:src="@drawable/ic_map"/>
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
tools:src="@drawable/ic_map" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/text_wrapper"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginStart="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Germany"/>
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="25"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Contour Lines"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/text_wrapper"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/ProgressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"/>
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Germany" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="25"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Contour Lines" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/ProgressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/secondary_icon"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:scaleType="center"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/ic_action_import"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/right_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="33dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/dashFavIconMargin"
|
||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||
android:layout_marginEnd="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:background="@drawable/buy_btn_background_light"
|
||||
android:minWidth="40dp"
|
||||
android:paddingStart="18dp"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingEnd="18dp"
|
||||
android:paddingRight="18dp"
|
||||
android:text="@string/buy"
|
||||
android:textColor="@color/buy_button_color"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/secondary_icon"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:scaleType="center"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/ic_action_import"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/right_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="33dp"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingRight="18dp"
|
||||
android:background="@drawable/buy_btn_background_light"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:textColor="@color/buy_button_color"
|
||||
android:text="@string/buy"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="@dimen/dashFavIconMargin"
|
||||
android:paddingStart="18dp"
|
||||
android:paddingEnd="18dp"
|
||||
android:layout_marginEnd="@dimen/content_padding_half" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="56dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:layout_marginStart="56dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -3582,7 +3582,5 @@
|
|||
<string name="shared_string_languages">اللغات</string>
|
||||
<string name="shared_string_language">اللغة</string>
|
||||
<string name="shared_string_all_languages">جميع اللغات</string>
|
||||
<string name="wikipedia_poi_languages_promo">قد لا تكون بعض مقالات ويكيبيديا متاحة باسمك ، حدد اللغات التي ستظهر بها مقالات ويكيبيديا على الخريطة.
|
||||
\nستتمكن من التبديل بين جميع اللغات المتاحة أثناء قراءة المقالة.</string>
|
||||
<string name="wiki_menu_download_descr">هناك حاجة إلى خرائط إضافية لعرض النقاط المهمة من ويكيبيديا على الخريطة.</string>
|
||||
</resources>
|
|
@ -3619,7 +3619,5 @@ Abasta l\'àrea: %1$s x %2$s</string>
|
|||
<string name="shared_string_languages">Idiomes</string>
|
||||
<string name="shared_string_language">Llengua</string>
|
||||
<string name="shared_string_all_languages">Tots els idiomes</string>
|
||||
<string name="wikipedia_poi_languages_promo">Alguns articles de la Viquipèdia podrien no estar disponibles en la vostra llengua, seleccioneu els idiomes de la Viquipèdia amb els que es localitzaran articles en el mapa.
|
||||
\nPodreu anar canviant entre els idiomes disponibles mentre llegiu l\'article.</string>
|
||||
<string name="wiki_menu_download_descr">Es necessiten mapes addicionals per veure els PDIs de la Viquipèdia al mapa.</string>
|
||||
</resources>
|
|
@ -3599,6 +3599,4 @@ Repræsenterer område: %1$s x %2$s</string>
|
|||
<string name="shared_string_language">Sprog</string>
|
||||
<string name="shared_string_all_languages">Alle sprog</string>
|
||||
<string name="wiki_menu_download_descr">Yderligere kort er nødvendige for at se Wikipedia Interessepunkter på kortet.</string>
|
||||
<string name="wikipedia_poi_languages_promo">Nogle Wikipedia-artikler er muligvis ikke tilgængelige på nogle sprog. Vælg de sprog, som Wikipedia-artikler skal vises på kortet.
|
||||
\nSkift mellem alle tilgængelige sprog, mens artiklen læses.</string>
|
||||
</resources>
|
|
@ -3625,7 +3625,5 @@ Lon %2$s</string>
|
|||
<string name="shared_string_languages">Sprachen</string>
|
||||
<string name="shared_string_language">Sprache</string>
|
||||
<string name="shared_string_all_languages">Alle Sprachen</string>
|
||||
<string name="wikipedia_poi_languages_promo">Manche Wikipedia-Artikel liegen unter Umständen nicht in Ihrer Sprache vor. Wählen Sie die Sprachen aus, in denen Wikipedia-Artikel auf der Karte erscheinen sollen.
|
||||
\nSie können beim Lesen des Artikels zwischen allen verfügbaren Sprachen wechseln.</string>
|
||||
<string name="wiki_menu_download_descr">Zusätzliche Karten werden benötigt um Wikipedia-POIs auf der Karte anzuzeigen.</string>
|
||||
</resources>
|
|
@ -3601,7 +3601,5 @@ Indikas lokon: %1$s x %2$s"</string>
|
|||
<string name="shared_string_languages">Lingvoj</string>
|
||||
<string name="shared_string_language">Lingvo</string>
|
||||
<string name="shared_string_all_languages">Ĉiuj lingvoj</string>
|
||||
<string name="wikipedia_poi_languages_promo">Iuj artikoloj de Vikipedio povas ne esti disponeblaj en via(j) lingvo(j), elektu lingvojn en kiuj artikoloj de Vikipedio estos montrataj sur la mapo.
|
||||
\nVi povas baskuli inter ĉiuj disponeblaj lingvoj dum legi artikolon.</string>
|
||||
<string name="wiki_menu_download_descr">Kromaj mapoj estas necesaj por vidigi punktojn de Vikipedio sur la mapo.</string>
|
||||
</resources>
|
|
@ -3628,7 +3628,5 @@ Area honi dagokio: %1$s x %2$s</string>
|
|||
<string name="shared_string_languages">Hizkuntzak</string>
|
||||
<string name="shared_string_language">Hizkuntza</string>
|
||||
<string name="shared_string_all_languages">Hizkuntza guztiak</string>
|
||||
<string name="wikipedia_poi_languages_promo">Baliteke Wikipediako artikulu batzuk zure hizkuntzan erabilgarri ez egotea, hautatu mapan agertuko diren Wikipediako artikuluen hizkuntzak.
|
||||
\nEskuragarri dauden hizkuntza guztien artean alda dezakezu artikulua irakurtzean.</string>
|
||||
<string name="wiki_menu_download_descr">Mapa osagarriak behar dira Wikipediaren POIak mapan ikusteko.</string>
|
||||
</resources>
|
|
@ -3586,8 +3586,6 @@ représentant la zone : %1$s x %2$s</string>
|
|||
<string name="settings_item_read_error">Impossible de lire %1$s.</string>
|
||||
<string name="settings_item_write_error">Impossible d\'écrire %1$s.</string>
|
||||
<string name="settings_item_import_error">Impossible d\'importer %1$s.</string>
|
||||
<string name="wikipedia_poi_languages_promo">Sélectionnez les langues dans lesquelles les articles Wikipédia apparaîtront sur la carte. Certains articles Wikipédia peuvent ne pas être disponibles dans certaines langues.
|
||||
\nVous pourrez basculer entre toutes les langues disponibles pendant la lecture de l’article.</string>
|
||||
<string name="select_track_file">Sélectionnez le fichier de trace</string>
|
||||
<string name="shared_string_languages">Langues</string>
|
||||
<string name="shared_string_language">Langue</string>
|
||||
|
|
|
@ -3613,6 +3613,4 @@
|
|||
<string name="monitoring_min_accuracy_descr_side_effect">תופעת לוואי: כתוצאה מסינון לפי דיוק, ייתכן שכמה נקודות תיעלמנה עבור למשל מתחת לגשרים, מתחת לעצים, בין בניינים גבוהים או בתנאי מזג אוויר מסוימים.</string>
|
||||
<string name="monitoring_min_accuracy_descr">פעולה זו תקליט רק נקודות שנמדדו עם חיווי של דיוק מזערי (במטרים/רגל כפי שדווח על ידי Android עבור ערכת השבבים שלך). דיוק מתייחס לפיזור המדידות המחזוריות ואינו קשור לדיוק, שמגדיר כמה קרובות המדידות שלך למיקום האמתי שלך.</string>
|
||||
<string name="monitoring_min_speed_descr_recommendation">המלצה: כדאי לנסות להשתמש בזיהוי תנועה דרך המסנן לסף תנועה תחתון (B) קודם לכן, הוא עשוי להביא לתוצאות טובות יותר ופחות מידע ילך לאיבוד. אם המסלולים שלך עדיין רועשים במהירויות נמוכות, כדי לנסות כאן ערכים שונים מאפס. נא לשים לב שחלק מהמדידות לא תדווחנה נתוני מהירות כלל (שיטות מבוססות רשת), שבמקרים כאלה לא יוקלט שום דבר.</string>
|
||||
<string name="wikipedia_poi_languages_promo">חלק מהערכים בוויקיפדיה לא יהיו זמינים בשם שצוין, יש לבחור את השפות בהן יופיעו הערכים של ויקיפדיה במפה.
|
||||
\nניתן יהיה להחליף בין כל השפות הזמינות בזמן קריאת הערך.</string>
|
||||
</resources>
|
|
@ -3623,6 +3623,4 @@ Rappresenta l\'area: %1$s x %2$s</string>
|
|||
<string name="shared_string_languages">Lingue</string>
|
||||
<string name="shared_string_language">Lingua</string>
|
||||
<string name="shared_string_all_languages">Tutti i linguaggi</string>
|
||||
<string name="wikipedia_poi_languages_promo">Scegli la lingua in cui gli articoli Wikipedia appariranno nella mappa, alcuni potrebbero non essere disponibili nella tua lingua.
|
||||
\nPuoi cambiare fra i linguaggi disponibili durante la lettura degli articoli.</string>
|
||||
</resources>
|
|
@ -3606,7 +3606,5 @@ Pôr do Sol: %2$s</string>
|
|||
<string name="shared_string_languages">Idiomas</string>
|
||||
<string name="shared_string_language">Idioma</string>
|
||||
<string name="shared_string_all_languages">Todos os idiomas</string>
|
||||
<string name="wikipedia_poi_languages_promo">Alguns artigos da Wikipédia podem não estar disponíveis em seu nome. Selecione os idiomas nos quais os artigos da Wikipédia aparecerão no mapa.
|
||||
\nVocê poderá alternar entre todos os idiomas disponíveis enquanto lê o artigo.</string>
|
||||
<string name="wiki_menu_download_descr">Mapas adicionais são necessários para visualizar os POIs da Wikipédia no mapa.</string>
|
||||
</resources>
|
|
@ -3608,8 +3608,6 @@
|
|||
<string name="settings_item_write_error">Невозможно записать %1$s.</string>
|
||||
<string name="settings_item_import_error">Невозможно импортировать %1$s.</string>
|
||||
<string name="select_track_file">Выберите файл трека</string>
|
||||
<string name="wikipedia_poi_languages_promo">Некоторые статьи Википедии могут быть недоступны на вашем родном языке, выберите языки, на которых такие статьи будут отображаться на карте.
|
||||
\nВы сможете переключаться между всеми доступными языками во время чтения статьи.</string>
|
||||
<string name="shared_string_languages">Языки</string>
|
||||
<string name="shared_string_language">Язык</string>
|
||||
<string name="shared_string_all_languages">Все языки</string>
|
||||
|
|
|
@ -3618,7 +3618,5 @@ Pro praghere iscrie su còdighe intreu</string>
|
|||
<string name="shared_string_languages">Limbas</string>
|
||||
<string name="shared_string_language">Limba</string>
|
||||
<string name="shared_string_all_languages">Totu sas limbas</string>
|
||||
<string name="wikipedia_poi_languages_promo">Unos cantos artìculos de Wikipedia diant pòdere no èssere disponìbiles in sa limba tua. Issèbera sas limbas de sos artìculos de Wikipedia chi ant a apàrrere in sa mapa.
|
||||
\nAs a pòdere colare dae una limba a s\'àtera in su mentres chi ses leghende un\'artìculu.</string>
|
||||
<string name="wiki_menu_download_descr">Pro bìdere sos PDI de Wikipedia in sa mapa b\'at bisòngiu de mapas agiuntivas.</string>
|
||||
</resources>
|
|
@ -3574,7 +3574,5 @@
|
|||
<string name="shared_string_languages">Diller</string>
|
||||
<string name="shared_string_language">Dil</string>
|
||||
<string name="shared_string_all_languages">Tüm diller</string>
|
||||
<string name="wikipedia_poi_languages_promo">Bazı Wikipedia makaleleri adınızda bulunmayabilir, Wikipedia makalelerinin haritada görüneceği dilleri seçin.
|
||||
\nMakaleyi okurken mevcut tüm diller arasında geçiş yapabileceksiniz.</string>
|
||||
<string name="wiki_menu_download_descr">Wikipedia POI\'lerini haritada görüntülemek için ek haritalara ihtiyaç vardır.</string>
|
||||
</resources>
|
|
@ -3610,7 +3610,5 @@
|
|||
<string name="shared_string_languages">Мови</string>
|
||||
<string name="shared_string_language">Мова</string>
|
||||
<string name="shared_string_all_languages">Усі мови</string>
|
||||
<string name="wikipedia_poi_languages_promo">Деякі статті у Вікіпедії можуть бути недоступними для Вашої мови, виберіть мови, якими статті на Вікіпедії будуть відображатися на мапі.
|
||||
\nВи зможете перемикатися між усіма доступними мовами під час читання статті.</string>
|
||||
<string name="wiki_menu_download_descr">Для перегляду POI Вікіпедії на мапі потрібні додаткові мапи.</string>
|
||||
</resources>
|
|
@ -3610,7 +3610,5 @@
|
|||
<string name="shared_string_languages">語言</string>
|
||||
<string name="shared_string_language">語言</string>
|
||||
<string name="shared_string_all_languages">所有語言</string>
|
||||
<string name="wikipedia_poi_languages_promo">某些維基百科文章可能無法以您的名稱提供,選取維基百科文章要在地圖上顯示何種語言。
|
||||
\n您可以在閱讀文章時切換到所有可用的語言。</string>
|
||||
<string name="wiki_menu_download_descr">需要額外的地圖才能在地圖上檢視維基百科的 POI。</string>
|
||||
<string name="wiki_menu_download_descr">需要其他地圖才能在地圖上檢視維基百科的 POI。</string>
|
||||
</resources>
|
|
@ -11,8 +11,36 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="lang_lmo">Lombard</string>
|
||||
<string name="lang_an">Aragonese</string>
|
||||
<string name="lang_ba">Bashkir</string>
|
||||
<string name="lang_bar">Bavarian</string>
|
||||
<string name="lang_ce">Chechen</string>
|
||||
<string name="lang_cv">Chuvash</string>
|
||||
<string name="lang_gu">Gujarati</string>
|
||||
<string name="lang_jv">Javanese</string>
|
||||
<string name="lang_kk">Kazakh</string>
|
||||
<string name="lang_ky">Kyrgyz</string>
|
||||
<string name="lang_mg">Malagasy</string>
|
||||
<string name="lang_min">Minangkabau</string>
|
||||
<string name="lang_mn">Mongolian</string>
|
||||
<string name="lang_my">Burmese</string>
|
||||
<string name="lang_nap">Neapolitan</string>
|
||||
<string name="lang_ne">Nepali</string>
|
||||
<string name="lang_pnb">Punjabi</string>
|
||||
<string name="lang_scn">Sicilian</string>
|
||||
<string name="lang_sco">Scots</string>
|
||||
<string name="lang_tg">Tajik</string>
|
||||
<string name="lang_tt">Tatar</string>
|
||||
<string name="lang_ur">Urdu</string>
|
||||
<string name="lang_uz">Uzbek</string>
|
||||
<string name="lang_war">Waray</string>
|
||||
<string name="lang_yo">Yoruba</string>
|
||||
<string name="lang_zhminnan">Southern Min</string>
|
||||
<string name="lang_zhyue">Cantonese</string>
|
||||
<string name="some_articles_may_not_available_in_lang">Some Wikipedia articles may not be available in your language.</string>
|
||||
<string name="select_wikipedia_article_langs">Select the languages in which Wikipedia articles will appear on the map. You can switch between all available languages while reading the article.</string>
|
||||
<string name="wiki_menu_download_descr">Additional maps are needed to view Wikipedia POIs on the map.</string>
|
||||
<string name="wikipedia_poi_languages_promo">Some Wikipedia articles may not be available in your name, select the languages in which Wikipedia articles will appear on the map.\nYou will be able to switch between all available languages while reading the article.</string>
|
||||
<string name="shared_string_all_languages">All languages</string>
|
||||
<string name="shared_string_language">Language</string>
|
||||
<string name="shared_string_languages">Languages</string>
|
||||
|
|
|
@ -17,6 +17,11 @@ public class DividerItem extends BaseBottomSheetItem {
|
|||
@ColorRes
|
||||
private int colorId;
|
||||
|
||||
private int topMargin = INVALID_VALUE;
|
||||
private int bottomMargin = INVALID_VALUE;
|
||||
private int startMargin = INVALID_VALUE;
|
||||
private int endMargin = INVALID_VALUE;
|
||||
|
||||
public DividerItem(Context context) {
|
||||
setupView(context, INVALID_ID, INVALID_POSITION);
|
||||
}
|
||||
|
@ -42,7 +47,8 @@ public class DividerItem extends BaseBottomSheetItem {
|
|||
int height = getHeight(context);
|
||||
|
||||
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view.getLayoutParams();
|
||||
AndroidUtils.setMargins(params, getStartMargin(context), getTopMargin(context), 0, getBottomMargin(context));
|
||||
AndroidUtils.setMargins(params, getStartMargin(context),
|
||||
getTopMargin(context), getEndMargin(context), getBottomMargin(context));
|
||||
params.height = height;
|
||||
|
||||
view.setMinimumHeight(height);
|
||||
|
@ -50,15 +56,28 @@ public class DividerItem extends BaseBottomSheetItem {
|
|||
}
|
||||
|
||||
protected int getTopMargin(Context context) {
|
||||
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
|
||||
return topMargin != INVALID_VALUE ? topMargin :
|
||||
context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
|
||||
}
|
||||
|
||||
protected int getStartMargin(Context context) {
|
||||
return 0;
|
||||
return startMargin != INVALID_VALUE ? startMargin : 0;
|
||||
}
|
||||
|
||||
protected int getBottomMargin(Context context) {
|
||||
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
|
||||
return bottomMargin != INVALID_VALUE ? bottomMargin :
|
||||
context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
|
||||
}
|
||||
|
||||
protected int getEndMargin(Context context) {
|
||||
return endMargin != INVALID_VALUE ? endMargin : 0;
|
||||
}
|
||||
|
||||
public void setMargins(int start, int top, int end, int bottom) {
|
||||
this.startMargin = start;
|
||||
this.topMargin = top;
|
||||
this.endMargin = end;
|
||||
this.bottomMargin = bottom;
|
||||
}
|
||||
|
||||
protected int getHeight(Context ctx) {
|
||||
|
|
|
@ -249,9 +249,10 @@ public class ConfigureMapMenu {
|
|||
WikipediaPoiMenu.toggleWikipediaPoi(ma, isChecked, true,
|
||||
new CallbackWithObject<Boolean>() {
|
||||
@Override
|
||||
public boolean processResult(Boolean result) {
|
||||
item.setSelected(result);
|
||||
item.setColorRes(result ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
||||
public boolean processResult(Boolean selected) {
|
||||
item.setSelected(selected);
|
||||
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
||||
item.setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(ma.getMyApplication()) : null);
|
||||
adapter.notifyDataSetChanged();
|
||||
return true;
|
||||
}
|
||||
|
@ -551,6 +552,7 @@ public class ConfigureMapMenu {
|
|||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(WIKIPEDIA_ID)
|
||||
.setTitleId(R.string.shared_string_wikipedia, activity)
|
||||
.setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(app) : null)
|
||||
.setSelected(selected)
|
||||
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||
.setIcon(R.drawable.ic_plugin_wikipedia)
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.osmand.osm.PoiCategory;
|
|||
import net.osmand.osm.PoiFilter;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
|
@ -21,6 +22,7 @@ import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder;
|
|||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
|
||||
|
@ -72,7 +74,10 @@ public class AmenityMenuController extends MenuController {
|
|||
public void buttonPressed() {
|
||||
MapActivity activity = getMapActivity();
|
||||
if (activity != null) {
|
||||
WikipediaDialogFragment.showInstance(activity, amenity);
|
||||
OsmandApplication app = activity.getMyApplication();
|
||||
String preferredLocale = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||
WikipediaDialogFragment.showInstance(activity, amenity,
|
||||
WikipediaPoiMenu.getWikiArticleLocale(app, preferredLocale, amenity));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.wikipedia;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -8,6 +9,8 @@ import android.widget.CompoundButton;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.os.ConfigurationCompat;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.CallbackWithObject;
|
||||
|
@ -19,13 +22,17 @@ import net.osmand.plus.UiUtilities;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.ENABLED_WIKI_POI_LANGUAGES_KEY;
|
||||
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.GLOBAL_WIKI_POI_ENABLED_KEY;
|
||||
|
@ -65,15 +72,18 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
|
||||
boolean nightMode = isNightMode(app);
|
||||
final int activeColorResId = AndroidUtils.resolveAttribute(app, R.attr.active_color_basic);
|
||||
final int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
final int profileColorResId = appMode.getIconColorInfo().getColor(nightMode);
|
||||
|
||||
final int paddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||
final int paddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
||||
final int contentPadding = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
final int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||
final int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
||||
|
||||
items.add(new TitleItem(getString(R.string.shared_string_languages)));
|
||||
items.add(new LongDescriptionItem(getString(R.string.wikipedia_poi_languages_promo)));
|
||||
items.add(new DividerSpaceItem(app, paddingSmall));
|
||||
items.add(new LongDescriptionItem(getString(R.string.some_articles_may_not_available_in_lang)));
|
||||
items.add(new DividerSpaceItem(app, contentPadding));
|
||||
items.add(new LongDescriptionItem(getString(R.string.select_wikipedia_article_langs)));
|
||||
items.add(new DividerSpaceItem(app, contentPaddingSmall));
|
||||
|
||||
final BottomSheetItemWithCompoundButton[] btnSelectAll = new BottomSheetItemWithCompoundButton[1];
|
||||
btnSelectAll[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
|
||||
|
@ -92,10 +102,17 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
})
|
||||
.create();
|
||||
items.add(btnSelectAll[0]);
|
||||
items.add(new DividerSpaceItem(app, paddingHalf));
|
||||
items.add(new DividerSpaceItem(app, contentPaddingHalf));
|
||||
|
||||
languageItems = new ArrayList<>();
|
||||
boolean categoryChanged = false;
|
||||
for (final WikiLanguageItem language : languages) {
|
||||
if (!categoryChanged && !language.isTopDefined()) {
|
||||
categoryChanged = true;
|
||||
DividerItem divider = new DividerItem(app);
|
||||
divider.setMargins(contentPadding, 0, 0, 0);
|
||||
items.add(divider);
|
||||
}
|
||||
final BottomSheetItemWithCompoundButton[] languageItem = new BottomSheetItemWithCompoundButton[1];
|
||||
languageItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
|
||||
.setChecked(language.isChecked())
|
||||
|
@ -111,13 +128,21 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
})
|
||||
.create();
|
||||
languageItems.add(languageItem[0]);
|
||||
items.add(languageItem[0]);
|
||||
}
|
||||
items.addAll(languageItems);
|
||||
}
|
||||
|
||||
private void initLanguagesData() {
|
||||
languages = new ArrayList<>();
|
||||
|
||||
Set<String> preferredLocales = new HashSet<>();
|
||||
LocaleListCompat locales = ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration());
|
||||
for (int i = 0; i < locales.size(); i++) {
|
||||
preferredLocales.add(locales.get(i).getLanguage());
|
||||
}
|
||||
preferredLocales.add(app.getLanguage());
|
||||
preferredLocales.add(Locale.getDefault().getLanguage());
|
||||
|
||||
Bundle wikiPoiSettings = WikipediaPoiMenu.getWikiPoiSettings(app);
|
||||
List<String> enabledWikiPoiLocales = null;
|
||||
if (wikiPoiSettings != null) {
|
||||
|
@ -127,11 +152,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
if (enabledWikiPoiLocales != null) {
|
||||
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
|
||||
boolean checked = enabledWikiPoiLocales.contains(locale);
|
||||
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked));
|
||||
boolean topDefined = preferredLocales.contains(locale) || checked;
|
||||
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked, topDefined));
|
||||
}
|
||||
} else {
|
||||
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
|
||||
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false));
|
||||
boolean topDefined = preferredLocales.contains(locale);
|
||||
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false, topDefined));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,6 +203,7 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
}
|
||||
|
||||
private View getCustomButtonView() {
|
||||
boolean nightMode = isNightMode(app);
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app == null) {
|
||||
return null;
|
||||
|
@ -183,8 +211,8 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
View buttonView = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.bottom_sheet_item_title_with_swith_56dp, null);
|
||||
CompoundButton cb = buttonView.findViewById(R.id.compound_button);
|
||||
|
||||
int color = AndroidUtils.getColorFromAttr(app, R.attr.divider_color_basic);
|
||||
int bgColor = UiUtilities.getColorWithAlpha(color, 0.5f);
|
||||
int color = nightMode ? R.color.divider_color_dark : R.color.divider_color_light;
|
||||
int bgColor = UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, color), 0.5f);
|
||||
|
||||
int bgResId = R.drawable.rectangle_rounded_right;
|
||||
Drawable bgDrawable = app.getUIUtilities().getPaintedIcon(bgResId, bgColor);
|
||||
|
@ -208,11 +236,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
private String locale;
|
||||
private String title;
|
||||
private boolean checked;
|
||||
private boolean topDefined;
|
||||
|
||||
public WikiLanguageItem(String locale, String title, boolean checked) {
|
||||
public WikiLanguageItem(String locale, String title, boolean checked, boolean topDefined) {
|
||||
this.locale = locale;
|
||||
this.title = title;
|
||||
this.checked = checked;
|
||||
this.topDefined = topDefined;
|
||||
}
|
||||
|
||||
public String getLocale() {
|
||||
|
@ -227,13 +257,18 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
this.checked = checked;
|
||||
}
|
||||
|
||||
public boolean isTopDefined() {
|
||||
return topDefined;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(WikiLanguageItem other) {
|
||||
return this.title.compareToIgnoreCase(other.title);
|
||||
int result = other.topDefined ? (!this.topDefined ? 1 : 0) : (this.topDefined ? -1 : 0);
|
||||
return result != 0 ? result : this.title.compareToIgnoreCase(other.title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.widget.ArrayAdapter;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
|
@ -354,7 +355,7 @@ public class WikipediaPoiMenu {
|
|||
ph.clearSelectedPoiFilters(PoiTemplateList.WIKI);
|
||||
}
|
||||
|
||||
private static String getLanguagesSummary(OsmandApplication app) {
|
||||
public static String getLanguagesSummary(OsmandApplication app) {
|
||||
Bundle wikiLanguagesSetting = getWikiPoiSettings(app);
|
||||
if (wikiLanguagesSetting != null) {
|
||||
boolean globalWikiEnabled = wikiLanguagesSetting.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
||||
|
@ -379,4 +380,21 @@ public class WikipediaPoiMenu {
|
|||
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) {
|
||||
return new WikipediaPoiMenu(mapActivity).createLayersItems();
|
||||
}
|
||||
|
||||
public static String getWikiArticleLocale(OsmandApplication app, String preferredLocale, Amenity amenity) {
|
||||
Bundle wikiPoiSettings = getWikiPoiSettings(app);
|
||||
if (wikiPoiSettings != null) {
|
||||
boolean globalWikiPoiEnabled = wikiPoiSettings.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
||||
List<String> enabledWikiPoiLocales = wikiPoiSettings.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
|
||||
if (!globalWikiPoiEnabled && enabledWikiPoiLocales != null) {
|
||||
if (!enabledWikiPoiLocales.contains(preferredLocale) && amenity.getType().isWiki()) {
|
||||
List<String> supportedLanguages = amenity.getSupportedLocales(enabledWikiPoiLocales);
|
||||
if (supportedLanguages != null && supportedLanguages.size() > 0) {
|
||||
preferredLocale = supportedLanguages.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return preferredLocale;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue