Merge branch 'r3.6'

This commit is contained in:
max-klaus 2020-02-25 14:31:34 +03:00
commit d29e839ed9
40 changed files with 755 additions and 321 deletions

View file

@ -1,75 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout 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="match_parent"
android:layout_height="match_parent"
android:background="?attr/activity_background_basic"
android:orientation="vertical">
<LinearLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:minHeight="@dimen/toolbar_height" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/list_header_settings_top_margin"
android:text="@string/shared_string_import"
android:textColor="?attr/app_bar_primary_item_color"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium" />
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/list_header_settings_top_margin"
android:text="@string/select_data_to_import"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />
<include layout="@layout/card_bottom_divider" />
android:background="?attr/activity_background_basic">
<ExpandableListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"
android:drawSelectorOnTop="false"
android:focusable="false"
android:groupIndicator="@android:color/transparent"
android:listSelector="@android:color/transparent" />
<include layout="@layout/card_top_divider" />
android:listSelector="@android:color/transparent"
android:paddingBottom="@dimen/dialog_button_ex_height"
osmand:layout_behavior="@string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="@+id/buttons_container"
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_button_ex_height"
android:layout_gravity="bottom"
android:background="?attr/bg_color"
android:gravity="center"
android:orientation="vertical">
<include layout="@layout/divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
@ -133,4 +96,44 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@android:color/transparent">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height_expanded"
android:background="?attr/colorPrimary"
osmand:collapsedTitleTextAppearance="@style/AppBarTitle"
osmand:expandedTitleGravity="start|bottom"
osmand:expandedTitleTextAppearance="@style/AppBarTitle"
osmand:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:minHeight="@dimen/toolbar_height"
osmand:layout_collapseMode="pin"
osmand:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed"
osmand:title="@string/shared_string_import">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<ImageView
android:id="@+id/shadowView"
android:layout_width="match_parent"
android:layout_height="@dimen/abp__shadow_height"
android:src="@drawable/preference_activity_action_bar_shadow"
tools:ignore="ContentDescription" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>

View file

@ -1,38 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/activity_background_basic"
android:orientation="vertical">
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/activity_background_basic">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
osmand:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:minHeight="@dimen/toolbar_height" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/list_header_settings_top_margin"
android:text="@string/import_duplicates_title"
android:textColor="?attr/app_bar_primary_item_color"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium" />
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
@ -44,8 +28,7 @@
android:paddingBottom="@dimen/list_header_settings_top_margin"
android:text="@string/import_duplicates_description"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />
android:textSize="@dimen/default_list_text_size" />
<include
android:id="@+id/description_divider"
@ -57,13 +40,23 @@
android:layout_height="0dp"
android:layout_weight="1" />
<include
layout="@layout/card_top_divider" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<LinearLayout
android:id="@+id/buttons_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/bg_color"
android:orientation="vertical">
<include layout="@layout/divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/content_padding">
@ -102,6 +95,48 @@
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height_expanded"
android:background="?attr/colorPrimary"
osmand:collapsedTitleTextAppearance="@style/AppBarTitle"
osmand:expandedTitleGravity="start|bottom"
osmand:expandedTitleTextAppearance="@style/AppBarTitle"
osmand:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:minHeight="@dimen/toolbar_height"
osmand:layout_collapseMode="pin"
osmand:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed"
osmand:title="@string/import_duplicates_title">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<ImageView
android:id="@+id/shadowView"
android:layout_width="match_parent"
android:layout_height="@dimen/abp__shadow_height"
android:src="@drawable/preference_activity_action_bar_shadow"
tools:ignore="ContentDescription" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:paddingBottom="@dimen/list_header_settings_top_margin"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="@string/select_data_to_import" />
<include layout="@layout/card_bottom_divider" />
</LinearLayout>

View file

@ -4,14 +4,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/setting_list_item_small_height"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_color"
android:gravity="center_vertical"
android:minHeight="66dp">
android:gravity="center_vertical">
<ImageView
android:id="@+id/icon"
@ -23,12 +23,16 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="OffRoad" />
@ -37,6 +41,8 @@
android:id="@+id/sub_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Navigation type: Car" />

View file

@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/setting_list_item_small_height"
android:orientation="vertical">
<FrameLayout
@ -15,8 +16,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="66dp">
android:gravity="center_vertical">
<ImageView
android:id="@+id/icon"
@ -30,12 +30,16 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Quick actions" />
@ -44,6 +48,8 @@
android:id="@+id/sub_title_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
android:visibility="gone"

View file

@ -64,13 +64,25 @@
android:layout_marginBottom="@dimen/content_padding"
android:background="?attr/list_divider" />
<FrameLayout
android:id="@+id/check_box_container"
android:layout_width="@dimen/acceptable_touch_radius"
android:layout_height="@dimen/acceptable_touch_radius"
android:layout_marginEnd="@dimen/text_margin_small"
android:layout_marginRight="@dimen/text_margin_small"
android:background="?attr/selectableItemBackgroundBorderless">
<net.osmand.view.ThreeStateCheckbox
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:layout_gravity="center"
android:clickable="false"
android:enabled="false"
android:focusable="false" />
</FrameLayout>
</LinearLayout>
</FrameLayout>

View file

@ -3463,7 +3463,6 @@
\n
\nسيبقى المكوّن الإضافي على الجهاز بعد إزالة أوسماند.</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_custom_rendering_style">أسلوب تقديم مخصص</string>
<string name="import_profile_dialog_description">يحتوي ملف التعريف المستوردة على بيانات إضافية. انقر فوق \"استيراد\" لاستيراد بيانات ملف التعريف فقط أو حدد بيانات إضافية لاستيرادها.</string>
<string name="shared_string_app_default_w_val">التطبيق الافتراضي (%s)</string>
<string name="no_recalculation_setting">تعطيل إعادة الحساب</string>

View file

@ -3500,5 +3500,4 @@ Repræsenterer område: %1$s x %2$s</string>
<string name="shared_string_include_data">Medtag yderligere data</string>
<string name="export_profile_dialog_description">Vælg yderligere data, der skal eksporteres sammen med profilen.</string>
<string name="index_name_antarctica">Antarktis</string>
<string name="shared_string_custom_rendering_style">Brugerdefineret renderingssstil</string>
</resources>

View file

@ -3533,7 +3533,6 @@ Lon %2$s</string>
<string name="shared_string_menu">Menü</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Routing</string>
<string name="shared_string_custom_rendering_style">Benutzerdefinierter Rendering-Stil</string>
<string name="shared_string_include_data">Zusätzliche Daten einschließen</string>
<string name="import_profile_dialog_description">Das importierte Profil enthält zusätzliche Daten. Klicken Sie auf \'Importieren\', um nur Profildaten zu importieren, oder wählen Sie zusätzliche Daten zum Importieren aus.</string>
<string name="export_profile_dialog_description">Sie können zusätzliche Daten zum Exportieren zusammen mit dem Profil auswählen.</string>

View file

@ -3516,7 +3516,6 @@ Indikas lokon: %1$s x %2$s"</string>
<string name="shared_string_menu">Menuo</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Kursdifinado</string>
<string name="shared_string_custom_rendering_style">Propra stilo de bildigado</string>
<string name="shared_string_include_data">Ampleksi kromajn datumojn</string>
<string name="import_profile_dialog_description">La enportata profilo enhavas kromajn datumojn. Frapetu “enporti” por enporti nur profilajn datumojn aŭ elektu kromajn datumojn por enporti.</string>
<string name="export_profile_dialog_description">Vi povas elekti kromajn datumojn por elporti kune kun la profilo.</string>

View file

@ -3535,7 +3535,6 @@ Lon %2$s</string>
<string name="shared_string_menu">Menú</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s → %2$s → %3$s</string>
<string name="shared_string_routing">Enrutamiento</string>
<string name="shared_string_custom_rendering_style">Vista de estilo propia</string>
<string name="shared_string_include_data">Incluir datos adicionales</string>
<string name="import_profile_dialog_description">El perfil importado contiene datos adicionales. Pulsa en «Importar» para importar sólo datos de perfil o marca datos adicionales para importar.</string>
<string name="export_profile_dialog_description">Puedes marcar datos adicionales para exportar junto con el perfil.</string>

View file

@ -3535,7 +3535,6 @@ Lon %2$s</string>
<string name="shared_string_menu">Menú</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s → %2$s → %3$s</string>
<string name="shared_string_routing">Enrutamiento</string>
<string name="shared_string_custom_rendering_style">Vista de estilo propia</string>
<string name="shared_string_include_data">Incluir datos adicionales</string>
<string name="import_profile_dialog_description">El perfil importado contiene datos adicionales. Pulsa en «Importar» para importar sólo datos de perfil o marca datos adicionales para importar.</string>
<string name="export_profile_dialog_description">Puedes marcar datos adicionales para exportar junto con el perfil.</string>

View file

@ -3515,7 +3515,6 @@
<string name="shared_string_menu">Menú</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Enrutado</string>
<string name="shared_string_custom_rendering_style">Estilo de representación personalizado</string>
<string name="shared_string_include_data">Incluir datos adicionales</string>
<string name="import_profile_dialog_description">El perfil importado contiene datos adicionales. Pulsa en Importar para importar solo datos de perfil o seleccione datos adicionales para importar.</string>
<string name="export_profile_dialog_description">Puedes seleccionar datos adicionales para exportar junto con el perfil.</string>

View file

@ -3561,7 +3561,6 @@
<string name="shared_string_menu">منو</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">مسیریابی</string>
<string name="shared_string_custom_rendering_style">سبک رندر سفارشی</string>
<string name="shared_string_include_data">شامل دادهٔ بیشتر</string>
<string name="import_profile_dialog_description">پروفایلِ درون‌بردی حاوی دادهٔ بیشتری است. «درون‌برد» را بزنید تا فقط دادهٔ پروفایل درون‌برد شود. «دادهٔ بیشتر» را انتخاب کنید تا آن را نیز درون‌برد کنید.</string>
<string name="export_profile_dialog_description">می‌توانید دادهٔ بیشتری را انتخاب کنید تا همراه با پروفایل برون‌برد کنید.</string>

View file

@ -3505,7 +3505,6 @@ représentant la zone : %1$s x %2$s</string>
<string name="shared_string_menu">Menu</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Calcul d\'itinéraire</string>
<string name="shared_string_custom_rendering_style">Style de rendu personnalisé</string>
<string name="shared_string_include_data">Inclure des données supplémentaires</string>
<string name="import_profile_dialog_description">Le profil importé contient des données supplémentaires. Cliquez sur Importer pour n\'importer que les données de profil ou sélectionnez des données supplémentaires à importer.</string>
<string name="export_profile_dialog_description">Vous pouvez sélectionner des données supplémentaires à exporter en même temps que le profil.</string>

View file

@ -3585,7 +3585,6 @@ Lon %2$s</string>
<string name="shared_string_menu">Menú</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Enrutamento</string>
<string name="shared_string_custom_rendering_style">Estilo de renderización personalizado</string>
<string name="shared_string_include_data">Incluír datos adicionais</string>
<string name="import_profile_dialog_description">O perfil importado contén datos adicionais. Preme en \"Importar\" para importar só datos de perfil ou marca datos adicionais para importar.</string>
<string name="export_profile_dialog_description">Podes marcar datos adicionais para exportar ó carón do perfil.</string>

View file

@ -3513,7 +3513,6 @@ Stendur fyrir svæði: %1$s x %2$s</string>
<string name="shared_string_menu">Valmynd</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Leiðagerð</string>
<string name="shared_string_custom_rendering_style">Sérsniðinn myndgerðaðrstíll</string>
<string name="shared_string_include_data">Taka með viðbótargögn</string>
<string name="index_name_antarctica">Suðurskautslandið</string>
<string name="use_system_screen_timeout_promo">Þetta er sjálfgefið óvirkt, ef OsmAnd keyrir í forgrunni rennur skjárinn ekki út á tíma.

View file

@ -3536,7 +3536,6 @@ POIの更新は利用できません</string>
<string name="shared_string_menu">メニュー</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">ルート検索</string>
<string name="shared_string_custom_rendering_style">描写スタイル</string>
<string name="shared_string_include_data">追加データを内包</string>
<string name="import_profile_dialog_description">インポートされたプロファイルには追加データが含まれています。 [インポート]をタップしてプロファイルデータのみをインポートするか、インポートする追加データを選択してください。</string>
<string name="export_profile_dialog_description">プロファイルとともにエクスポートする追加データを選択できます。</string>

View file

@ -3278,7 +3278,6 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="shared_string_menu">Izvēlne</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Maršrutēšana</string>
<string name="shared_string_custom_rendering_style">Pielāgots renderēšanas stils</string>
<string name="shared_string_include_data">Iekļaut papildus datus</string>
<string name="import_profile_dialog_description">Importētais profils satur papildus datus. Spiediet uz Importēt, lai importētu tikai profilu datus vai izvēlieties arī papildus datus, ko importēt.</string>
<string name="export_profile_dialog_description">Jūs varat izvēlēties arī papildus datus, ko eksportēt kopā ar profilu.</string>

View file

@ -3513,7 +3513,6 @@ Reprezentuje obszar: %1$s x %2$s</string>
\n
\nWtyczka pozostanie na urządzeniu po usunięciu OsmAnd.</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_custom_rendering_style">Własny styl wyświetlania</string>
<string name="shared_string_include_data">Uwzględnij dodatkowe dane</string>
<string name="import_profile_dialog_description">Zaimportowany profil zawiera dodatkowe dane. Kliknij przycisk Importuj, aby zaimportować tylko dane profilu lub wybierz dodatkowe dane do zaimportowania.</string>
<string name="export_profile_dialog_description">Można wybrać dodatkowe dane do wyeksportowania wraz z profilem.</string>

View file

@ -3522,7 +3522,6 @@ Pôr do Sol: %2$s</string>
<string name="shared_string_menu">Menu</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Roteamento</string>
<string name="shared_string_custom_rendering_style">Estilo de renderização personalizado</string>
<string name="shared_string_include_data">Incluir dados adicionais</string>
<string name="import_profile_dialog_description">O perfil importado contém dados adicionais. Clique em Importar para importar apenas dados do perfil ou selecione dados adicionais a serem importados.</string>
<string name="export_profile_dialog_description">Você pode selecionar dados adicionais para exportar junto com o perfil.</string>

View file

@ -3501,7 +3501,6 @@ Pro praghere iscrie su còdighe intreu</string>
<string name="shared_string_menu">Menù</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Càrculu de s\'àndala</string>
<string name="shared_string_custom_rendering_style">Istile de renderizatzione personalizadu</string>
<string name="shared_string_include_data">Inclue datos additzionales</string>
<string name="import_profile_dialog_description">Su profilu importadu tenet datos additzionales. Incarca in \"Importa\" pro importare sos datos de su profilu ebbia o ischerta sos datos additzionales de importare.</string>
<string name="export_profile_dialog_description">Podes ischertare datos additzionales de esportare in paris cun su profilu.</string>

View file

@ -3501,7 +3501,6 @@
<string name="plugin_disabled">Додатак искључен</string>
<string name="shared_string_menu">Мени</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_custom_rendering_style">Произвољни стил исцртавања</string>
<string name="shared_string_include_data">Укључи додатне податке</string>
<string name="import_profile_dialog_description">Увезени профил садржи додатне податке. Кликните на Увоз да увезете да увезете само профилне податке или одаберите које додатне податке увести.</string>
<string name="export_profile_dialog_description">Поред профила, можете одабрати додатне податке за извоз.</string>

View file

@ -3490,7 +3490,6 @@
<string name="shared_string_menu">Menü</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Yönlendirme</string>
<string name="shared_string_custom_rendering_style">Özel görselleştirme stili</string>
<string name="shared_string_include_data">İlave veriler ekle</string>
<string name="import_profile_dialog_description">İçe aktarılan profil ilave veriler içermektedir. Yalnızca profil verilerini içe aktarmak için İçe Aktar\'ı tıklayın veya içe aktarılacak ilave verileri seçin.</string>
<string name="export_profile_dialog_description">Profil ile birlikte dışa aktarılacak ilave veriler seçebilirsiniz.</string>

View file

@ -3523,7 +3523,6 @@
<string name="shared_string_menu">Меню</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">Маршрутизація</string>
<string name="shared_string_custom_rendering_style">Власний стиль відмальовування</string>
<string name="shared_string_include_data">Включати додаткові дані</string>
<string name="import_profile_dialog_description">Імпортований профіль містить додаткові дані. Натисніть кнопку імпортувати, щоб імпортувати лише дані профілю або вибрати додаткові дані для імпорту.</string>
<string name="export_profile_dialog_description">Ви можете вибрати додаткові дані для експорту разом із профілем.</string>

View file

@ -3525,7 +3525,6 @@
<string name="shared_string_menu">選單</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="shared_string_routing">路徑</string>
<string name="shared_string_custom_rendering_style">自訂彩現樣式</string>
<string name="shared_string_include_data">包含額外資料</string>
<string name="import_profile_dialog_description">已匯入的設定檔包含了額外資料。點擊匯入僅匯入設定檔資料或選取額外的資料以匯入。</string>
<string name="export_profile_dialog_description">您可以選取額外的資料以與設定檔一起匯出。</string>

View file

@ -319,6 +319,7 @@
<dimen name="coords_input_keyboard_item_height">56dp</dimen>
<dimen name="toolbar_height">56dp</dimen>
<dimen name="toolbar_height_expanded">112dp</dimen>
<dimen name="wikivoyage_search_list_header_height">36dp</dimen>
<dimen name="wikivoyage_article_card_icon_size">80dp</dimen>
@ -353,5 +354,6 @@
<dimen name="setting_profile_item_switch_margin">18dp</dimen>
<dimen name="settings_divider_margin_start">72dp</dimen>
<dimen name="setting_list_item_large_height">72dp</dimen>
<dimen name="setting_list_item_small_height">42dp</dimen>
</resources>

View file

@ -72,7 +72,7 @@
<string name="sunset_at">Sunset at %1$s</string>
<string name="sunrise_at">Sunrise at %1$s</string>
<string name="shared_string_routing">Routing</string>
<string name="shared_string_custom_rendering_style">Custom rendering style</string>
<string name="shared_string_rendering_style">Rendering style</string>
<string name="shared_string_include_data">Include additional data</string>
<string name="import_profile_dialog_description">The imported profile contains additional data. Click Import to import only profile data or select additional data to import.</string>
<string name="export_profile_dialog_description">You can select additional data to export along with the profile.</string>

View file

@ -749,4 +749,9 @@
<item name="colorControlHighlight">?attr/app_bar_primary_item_color</item>
</style>
<style name="AppBarTitle" parent="TextAppearance.AppCompat.Title">
<item name="android:textColor">?attr/app_bar_primary_item_color</item>
<item name="android:textSize">@dimen/dialog_header_text_size</item>
</style>
</resources>

View file

@ -14,6 +14,7 @@ import com.google.gson.reflect.TypeToken;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.osm.MapPoiTypes;
@ -21,6 +22,8 @@ import net.osmand.osm.PoiCategory;
import net.osmand.plus.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.ApplicationMode.ApplicationModeBuilder;
import net.osmand.plus.OsmandSettings.OsmandPreference;
import net.osmand.plus.helpers.AvoidSpecificRoads;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionRegistry;
@ -147,6 +150,7 @@ public class SettingsHelper {
QUICK_ACTION,
POI_UI_FILTERS,
MAP_SOURCES,
AVOID_ROADS
}
public abstract static class SettingsItem {
@ -233,14 +237,16 @@ public class SettingsHelper {
}
SettingsItem item = (SettingsItem) other;
return item.getType() == getType() && item.getName().equals(getName());
return item.getType() == getType()
&& item.getName().equals(getName())
&& item.getFileName().equals(getFileName());
}
}
public abstract static class CollectionSettingsItem<T> extends SettingsItem {
protected List<T> items;
protected List<T> duplicateItems;
protected List<T> duplicateItems = new ArrayList<>();
protected List<T> existingItems;
CollectionSettingsItem(@NonNull SettingsItemType type, @NonNull List<T> items) {
@ -258,7 +264,17 @@ public class SettingsHelper {
}
@NonNull
public abstract List<T> excludeDuplicateItems();
public List<T> excludeDuplicateItems() {
if (!items.isEmpty()) {
for (T item : items) {
if (isDuplicate(item)) {
duplicateItems.add(item);
}
}
}
items.removeAll(duplicateItems);
return duplicateItems;
}
public abstract boolean isDuplicate(@NonNull T item);
@ -801,7 +817,7 @@ public class SettingsHelper {
@Override
public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException {
OutputStream output;
if (shouldReplace || !file.exists()) {
if (!file.exists() || shouldReplace) {
output = new FileOutputStream(file);
} else {
output = new FileOutputStream(renameFile(file));
@ -864,19 +880,6 @@ public class SettingsHelper {
return actionRegistry.generateUniqueName(item, app);
}
@NonNull
@Override
public List<QuickAction> excludeDuplicateItems() {
duplicateItems = new ArrayList<>();
for (QuickAction item : items) {
if (isDuplicate(item)) {
duplicateItems.add(item);
}
}
items.removeAll(duplicateItems);
return duplicateItems;
}
@Override
public void apply() {
if (!items.isEmpty() || !duplicateItems.isEmpty()) {
@ -1054,22 +1057,6 @@ public class SettingsHelper {
return false;
}
@NonNull
@Override
public List<PoiUIFilter> excludeDuplicateItems() {
duplicateItems = new ArrayList<>();
if (!items.isEmpty()) {
for (PoiUIFilter item : items) {
if (isDuplicate(item)) {
duplicateItems.add(item);
}
}
}
items.removeAll(duplicateItems);
return duplicateItems;
}
@NonNull
@Override
public PoiUIFilter renameItem(@NonNull PoiUIFilter item) {
@ -1253,22 +1240,6 @@ public class SettingsHelper {
}
}
@NonNull
@Override
public List<ITileSource> excludeDuplicateItems() {
duplicateItems = new ArrayList<>();
for (String name : existingItemsNames) {
for (ITileSource tileSource : items) {
if (name.equals(tileSource.getName())) {
duplicateItems.add(tileSource);
}
}
}
items.removeAll(duplicateItems);
return duplicateItems;
}
@NonNull
@Override
public ITileSource renameItem(@NonNull ITileSource item) {
@ -1440,6 +1411,183 @@ public class SettingsHelper {
}
}
public static class AvoidRoadsSettingsItem extends CollectionSettingsItem<AvoidRoadInfo> {
private OsmandApplication app;
private OsmandSettings settings;
private AvoidSpecificRoads specificRoads;
public AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @NonNull List<AvoidRoadInfo> items) {
super(SettingsItemType.AVOID_ROADS, items);
this.app = app;
settings = app.getSettings();
specificRoads = app.getAvoidSpecificRoads();
existingItems = new ArrayList<>(specificRoads.getImpassableRoads().values());
}
AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
super(SettingsItemType.AVOID_ROADS, json);
this.app = app;
settings = app.getSettings();
specificRoads = app.getAvoidSpecificRoads();
existingItems = new ArrayList<>(specificRoads.getImpassableRoads().values());
}
@NonNull
@Override
public String getName() {
return "avoid_roads";
}
@NonNull
@Override
public String getPublicName(@NonNull Context ctx) {
return "avoid_roads";
}
@NonNull
@Override
public String getFileName() {
return getName() + ".json";
}
@Override
public void apply() {
if (!items.isEmpty() || !duplicateItems.isEmpty()) {
for (AvoidRoadInfo duplicate : duplicateItems) {
if (shouldReplace) {
LatLon latLon = new LatLon(duplicate.latitude, duplicate.longitude);
if (settings.removeImpassableRoad(latLon)) {
settings.addImpassableRoad(duplicate);
}
} else {
settings.addImpassableRoad(renameItem(duplicate));
}
}
for (AvoidRoadInfo avoidRoad : items) {
settings.addImpassableRoad(avoidRoad);
}
specificRoads.loadImpassableRoads();
specificRoads.initRouteObjects(true);
}
}
@Override
public boolean isDuplicate(@NonNull AvoidRoadInfo item) {
return existingItems.contains(item);
}
@Override
public boolean shouldReadOnCollecting() {
return true;
}
@NonNull
@Override
public AvoidRoadInfo renameItem(@NonNull AvoidRoadInfo item) {
int number = 0;
while (true) {
number++;
AvoidRoadInfo renamedItem = new AvoidRoadInfo();
renamedItem.name = item.name + "_" + number;
if (!isDuplicate(renamedItem)) {
renamedItem.id = item.id;
renamedItem.latitude = item.latitude;
renamedItem.longitude = item.longitude;
renamedItem.appModeKey = item.appModeKey;
return renamedItem;
}
}
}
@NonNull
@Override
SettingsItemReader getReader() {
return new SettingsItemReader(this) {
@Override
public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException {
StringBuilder buf = new StringBuilder();
try {
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
buf.append(str);
}
} catch (IOException e) {
throw new IOException("Cannot read json body", e);
}
String jsonStr = buf.toString();
if (Algorithms.isEmpty(jsonStr)) {
throw new IllegalArgumentException("Cannot find json body");
}
final JSONObject json;
try {
items = new ArrayList<>();
json = new JSONObject(jsonStr);
JSONArray jsonArray = json.getJSONArray("items");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
double latitude = object.optDouble("latitude");
double longitude = object.optDouble("longitude");
String name = object.optString("name");
String appModeKey = object.optString("appModeKey");
AvoidRoadInfo roadInfo = new AvoidRoadInfo();
roadInfo.id = 0;
roadInfo.latitude = latitude;
roadInfo.longitude = longitude;
roadInfo.name = name;
if (ApplicationMode.valueOfStringKey(appModeKey, null) != null) {
roadInfo.appModeKey = appModeKey;
} else {
roadInfo.appModeKey = app.getRoutingHelper().getAppMode().getStringKey();
}
items.add(roadInfo);
}
} catch (JSONException e) {
throw new IllegalArgumentException("Json parse error", e);
}
}
};
}
@NonNull
@Override
SettingsItemWriter getWriter() {
return new SettingsItemWriter(this) {
@Override
public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException {
JSONObject json = new JSONObject();
JSONArray jsonArray = new JSONArray();
if (!items.isEmpty()) {
try {
for (AvoidRoadInfo avoidRoad : items) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("latitude", avoidRoad.latitude);
jsonObject.put("longitude", avoidRoad.longitude);
jsonObject.put("name", avoidRoad.name);
jsonObject.put("appModeKey", avoidRoad.appModeKey);
jsonArray.put(jsonObject);
}
json.put("items", jsonArray);
} catch (JSONException e) {
LOG.error("Failed write to json", e);
}
}
if (json.length() > 0) {
try {
String s = json.toString(2);
outputStream.write(s.getBytes("UTF-8"));
} catch (JSONException e) {
LOG.error("Failed to write json to stream", e);
}
return true;
}
return false;
}
};
}
}
private static class SettingsItemsFactory {
private OsmandApplication app;
@ -1505,6 +1653,9 @@ public class SettingsHelper {
case MAP_SOURCES:
item = new MapSourcesSettingsItem(app, json);
break;
case AVOID_ROADS:
item = new AvoidRoadsSettingsItem(app, json);
break;
}
return item;
}
@ -1603,12 +1754,10 @@ public class SettingsHelper {
} finally {
zis.closeEntry();
}
SettingsItemsFactory itemsFactory;
try {
itemsFactory = new SettingsItemsFactory(app, itemsJson);
if (collecting) {
try {
SettingsItemsFactory itemsFactory = new SettingsItemsFactory(app, itemsJson);
items.addAll(itemsFactory.getItems());
}
} catch (IllegalArgumentException e) {
LOG.error("Error parsing items: " + itemsJson, e);
throw new IllegalArgumentException("No items");
@ -1616,9 +1765,16 @@ public class SettingsHelper {
LOG.error("Error parsing items: " + itemsJson, e);
throw new IllegalArgumentException("No items");
}
}
while ((entry = zis.getNextEntry()) != null) {
String fileName = entry.getName();
SettingsItem item = itemsFactory.getItemByFileName(fileName);
SettingsItem item = null;
for (SettingsItem settingsItem : items) {
if (settingsItem != null && settingsItem.getFileName().equals(fileName)) {
item = settingsItem;
break;
}
}
if (item != null && collecting && item.shouldReadOnCollecting()
|| item != null && !collecting && !item.shouldReadOnCollecting()) {
try {

View file

@ -140,6 +140,7 @@ import net.osmand.plus.settings.BaseSettingsFragment;
import net.osmand.plus.settings.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.settings.ConfigureProfileFragment;
import net.osmand.plus.settings.DataStorageFragment;
import net.osmand.plus.settings.ImportSettingsFragment;
import net.osmand.plus.settings.ProfileAppearanceFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
import net.osmand.plus.views.AnimateDraggingMapThread;
@ -732,6 +733,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if ( quickActionListFragment != null && quickActionListFragment.isVisible()) {
this.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, null);
}
ImportSettingsFragment importSettingsFragment = getImportSettingsFragment();
if (importSettingsFragment != null) {
importSettingsFragment.showExitDialog();
return;
}
super.onBackPressed();
}
@ -2447,6 +2453,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(QuickActionListFragment.TAG);
}
public ImportSettingsFragment getImportSettingsFragment() {
return getFragment(ImportSettingsFragment.TAG);
}
public void backToConfigureProfileFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount();

View file

@ -37,6 +37,7 @@ import net.osmand.plus.routing.RoutingHelper.RouteSegmentSearchResult;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.router.RouteSegmentResult;
import net.osmand.router.RoutingConfiguration;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import java.util.ArrayList;
@ -54,6 +55,10 @@ public class AvoidSpecificRoads {
public AvoidSpecificRoads(final OsmandApplication app) {
this.app = app;
loadImpassableRoads();
}
public void loadImpassableRoads(){
for (AvoidRoadInfo avoidRoadInfo : app.getSettings().getImpassableRoadPoints()) {
impassableRoads.put(new LatLon(avoidRoadInfo.latitude, avoidRoadInfo.longitude), avoidRoadInfo);
}
@ -398,5 +403,20 @@ public class AvoidSpecificRoads {
public double longitude;
public String name;
public String appModeKey;
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AvoidRoadInfo other = (AvoidRoadInfo) obj;
return Math.abs(latitude - other.latitude) < 0.00001
&& Math.abs(longitude - other.longitude) < 0.00001
&& Algorithms.objectEquals(name, other.name);
}
}
}

View file

@ -782,7 +782,7 @@ public class ImportHelper {
if (fragmentManager != null) {
ImportSettingsFragment.showInstance(fragmentManager, items, file);
}
} else {
} else if (empty) {
app.showShortToastMessage(app.getString(R.string.file_import_error, name, app.getString(R.string.shared_string_unexpected_error)));
}
}

View file

@ -31,6 +31,7 @@ public class AdditionalDataWrapper {
POI_TYPES,
MAP_SOURCES,
CUSTOM_RENDER_STYLE,
CUSTOM_ROUTING
CUSTOM_ROUTING,
AVOID_ROADS
}
}

View file

@ -239,6 +239,17 @@ public class RendererRegistry {
}
public void initRenderers(IProgress progress) {
updateExternalRenderers();
String r = app.getSettings().RENDERER.get();
if(r != null){
RenderingRulesStorage obj = getRenderer(r);
if(obj != null){
setCurrentSelectedRender(obj);
}
}
}
public void updateExternalRenderers() {
File file = app.getAppPath(IndexConstants.RENDERERS_DIR);
file.mkdirs();
Map<String, File> externalRenderers = new LinkedHashMap<String, File>();
@ -256,13 +267,6 @@ public class RendererRegistry {
}
}
this.externalRenderers = externalRenderers;
String r = app.getSettings().RENDERER.get();
if(r != null){
RenderingRulesStorage obj = getRenderer(r);
if(obj != null){
setCurrentSelectedRender(obj);
}
}
}
public Collection<String> getRendererNames(){

View file

@ -15,6 +15,7 @@ import net.osmand.plus.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.profiles.ProfileIconColors;
import net.osmand.plus.quickaction.QuickAction;
@ -118,6 +119,11 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter<RecyclerView
itemHolder.icon.setVisibility(View.INVISIBLE);
}
itemHolder.subTitle.setVisibility(View.GONE);
} else if (currentItem instanceof AvoidRoadInfo) {
itemHolder.title.setText(((AvoidRoadInfo) currentItem).name);
itemHolder.icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_alert, nightMode));
itemHolder.subTitle.setVisibility(View.GONE);
itemHolder.icon.setVisibility(View.VISIBLE);
}
itemHolder.divider.setVisibility(shouldShowDivider(position) ? View.VISIBLE : View.GONE);
}

View file

@ -7,6 +7,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@ -17,6 +18,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.profiles.AdditionalDataWrapper;
import net.osmand.plus.profiles.ProfileIconColors;
@ -73,6 +75,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
TextView titleTv = group.findViewById(R.id.title_tv);
TextView subTextTv = group.findViewById(R.id.sub_text_tv);
final ThreeStateCheckbox checkBox = group.findViewById(R.id.check_box);
FrameLayout checkBoxContainer = group.findViewById(R.id.check_box_container);
ImageView expandIv = group.findViewById(R.id.explist_indicator);
View lineDivider = group.findViewById(R.id.divider);
View cardTopDivider = group.findViewById(R.id.card_top_divider);
@ -99,9 +102,10 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
}
checkBox.setState(contains ? MISC : UNCHECKED);
}
checkBox.setOnClickListener(new View.OnClickListener() {
checkBoxContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkBox.performClick();
if (checkBox.getState() == CHECKED) {
for (Object object : listItems) {
if (!dataToOperate.contains(object)) {
@ -213,6 +217,13 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
icon.setVisibility(View.VISIBLE);
subText.setVisibility(View.GONE);
break;
case AVOID_ROADS:
AvoidRoadInfo avoidRoadInfo = (AvoidRoadInfo) currentItem;
title.setText(avoidRoadInfo.name);
icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_alert, nightMode));
icon.setVisibility(View.VISIBLE);
subText.setVisibility(View.GONE);
break;
default:
return child;
}
@ -270,9 +281,11 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
case MAP_SOURCES:
return R.string.quick_action_map_source_title;
case CUSTOM_RENDER_STYLE:
return R.string.shared_string_custom_rendering_style;
return R.string.shared_string_rendering_style;
case CUSTOM_ROUTING:
return R.string.shared_string_routing;
case AVOID_ROADS:
return R.string.avoid_road;
default:
return R.string.access_empty_list;
}

View file

@ -15,12 +15,12 @@ import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.plus.ApplicationMode;
@ -33,6 +33,7 @@ import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.profiles.AdditionalDataWrapper;
import net.osmand.plus.quickaction.QuickAction;
@ -245,6 +246,13 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
}
}
Map<LatLon, AvoidRoadInfo> impassableRoads = app.getAvoidSpecificRoads().getImpassableRoads();
if (!impassableRoads.isEmpty()) {
dataList.add(new AdditionalDataWrapper(
AdditionalDataWrapper.Type.AVOID_ROADS,
new ArrayList<>(impassableRoads.values())
));
}
return dataList;
}
@ -262,6 +270,7 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
List<QuickAction> quickActions = new ArrayList<>();
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
List<ITileSource> tileSourceTemplates = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
for (Object object : adapter.getDataToOperate()) {
if (object instanceof QuickAction) {
quickActions.add((QuickAction) object);
@ -272,6 +281,8 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
tileSourceTemplates.add((ITileSource) object);
} else if (object instanceof File) {
settingsItems.add(new SettingsHelper.FileSettingsItem(app, (File) object));
} else if (object instanceof AvoidRoadInfo) {
avoidRoads.add((AvoidRoadInfo) object);
}
}
if (!quickActions.isEmpty()) {
@ -283,6 +294,9 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
if (!tileSourceTemplates.isEmpty()) {
settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(app, tileSourceTemplates));
}
if (!avoidRoads.isEmpty()) {
settingsItems.add(new SettingsHelper.AvoidRoadsSettingsItem(app, avoidRoads));
}
return settingsItems;
}

View file

@ -1,24 +1,34 @@
package net.osmand.plus.settings;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.NestedScrollView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.LinearLayout;
import net.osmand.AndroidUtils;
import net.osmand.map.ITileSource;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.SettingsHelper;
import net.osmand.plus.SettingsHelper.SettingsItem;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.view.ComplexButton;
@ -27,15 +37,18 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.plus.settings.ImportSettingsFragment.getDuplicatesData;
public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implements View.OnClickListener {
public static final String TAG = ImportSettingsFragment.class.getSimpleName();
public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View.OnClickListener {
public static final String TAG = ImportDuplicatesFragment.class.getSimpleName();
private OsmandApplication app;
private RecyclerView list;
private LinearLayout buttonsContainer;
private NestedScrollView nestedScroll;
private List<? super Object> duplicatesList;
private List<SettingsItem> settingsItems;
private DuplicatesSettingsAdapter adapter;
private File file;
private boolean nightMode;
@ -45,15 +58,21 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
fragment.setDuplicatesList(duplicatesList);
fragment.setSettingsItems(settingsItems);
fragment.setFile(file);
fragment.setRetainInstance(true);
fragment.show(fm, TAG);
fm.beginTransaction().replace(R.id.fragmentContainer, fragment, TAG).addToBackStack(null).commit();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
app = getMyApplication();
nightMode = !getSettings().isLightContent();
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
if (settingsItems == null) {
settingsItems = app.getSettingsHelper().getSettingsItems();
duplicatesList = getDuplicatesData(settingsItems);
}
if (file == null) {
file = app.getSettingsHelper().getSettingsFile();
}
}
@Nullable
@ -64,6 +83,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
setupToolbar((Toolbar) root.findViewById(R.id.toolbar));
ComplexButton replaceAllBtn = root.findViewById(R.id.replace_all_btn);
ComplexButton keepBothBtn = root.findViewById(R.id.keep_both_btn);
buttonsContainer = root.findViewById(R.id.buttons_container);
nestedScroll = root.findViewById(R.id.nested_scroll);
keepBothBtn.setIcon(getPaintedContentIcon(R.drawable.ic_action_keep_both,
nightMode
? getResources().getColor(R.color.icon_color_active_dark)
@ -77,14 +98,34 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
keepBothBtn.setOnClickListener(this);
replaceAllBtn.setOnClickListener(this);
list = root.findViewById(R.id.list);
ViewTreeObserver treeObserver = buttonsContainer.getViewTreeObserver();
treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (buttonsContainer != null) {
ViewTreeObserver vts = buttonsContainer.getViewTreeObserver();
int height = buttonsContainer.getMeasuredHeight();
nestedScroll.setPadding(0, 0, 0, height);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
vts.removeOnGlobalLayoutListener(this);
} else {
vts.removeGlobalOnLayoutListener(this);
}
}
}
});
if (Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(app, root);
}
return root;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
adapter = new DuplicatesSettingsAdapter(getMyApplication(), prepareDuplicates(), nightMode);
DuplicatesSettingsAdapter adapter = new DuplicatesSettingsAdapter(app, prepareDuplicates(), nightMode);
list.setLayoutManager(new LinearLayoutManager(getMyApplication()));
list.setAdapter(adapter);
}
@ -97,6 +138,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
List<ITileSource> tileSources = new ArrayList<>();
List<File> renderFilesList = new ArrayList<>();
List<File> routingFilesList = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
for (Object object : duplicatesList) {
if (object instanceof ApplicationMode.ApplicationModeBean) {
@ -114,6 +156,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
} else if (file.getAbsolutePath().contains("files/routing")) {
routingFilesList.add(file);
}
} else if (object instanceof AvoidRoadInfo) {
avoidRoads.add((AvoidRoadInfo) object);
}
}
if (!profiles.isEmpty()) {
@ -137,9 +181,13 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
duplicates.addAll(routingFilesList);
}
if (!renderFilesList.isEmpty()) {
duplicates.add(getString(R.string.shared_string_custom_rendering_style));
duplicates.add(getString(R.string.shared_string_rendering_style));
duplicates.addAll(renderFilesList);
}
if (!avoidRoads.isEmpty()) {
duplicates.add(getString(R.string.avoid_road));
duplicates.addAll(avoidRoads);
}
return duplicates;
}
@ -157,6 +205,11 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
}
}
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
private void importItems(boolean shouldReplace) {
for (SettingsItem item : settingsItems) {
item.setShouldReplace(shouldReplace);
@ -166,12 +219,26 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
public void onSettingsImportFinished(boolean succeed, boolean empty, @NonNull List<SettingsHelper.SettingsItem> items) {
if (succeed) {
app.showShortToastMessage(app.getString(R.string.file_imported_successfully, file.getName()));
app.getRendererRegistry().updateExternalRenderers();
AppInitializer.loadRoutingFiles(app, new AppInitializer.LoadRoutingFilesCallback() {
@Override
public void onRoutingFilesLoaded() {
}
});
} else if (empty) {
app.showShortToastMessage(app.getString(R.string.file_import_error, file.getName(), app.getString(R.string.shared_string_unexpected_error)));
}
}
});
dismiss();
FragmentManager fm = getFragmentManager();
if (fm != null) {
fm.popBackStackImmediate();
Fragment fragment = fm.findFragmentByTag(ImportSettingsFragment.TAG);
if (fragment != null) {
fm.beginTransaction().remove(fragment).commit();
fm.popBackStackImmediate();
}
}
}
private void setupToolbar(Toolbar toolbar) {
@ -183,7 +250,11 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
FragmentManager fm = getFragmentManager();
if (fm != null) {
fm.popBackStackImmediate();
ImportSettingsFragment.showInstance(fm, null, file);
}
}
});
}

View file

@ -1,17 +1,26 @@
package net.osmand.plus.settings;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -19,7 +28,8 @@ import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.SettingsHelper;
import net.osmand.plus.SettingsHelper.SettingsItem;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.profiles.AdditionalDataWrapper;
import net.osmand.plus.quickaction.QuickAction;
@ -29,7 +39,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class ImportSettingsFragment extends BaseOsmAndDialogFragment
public class ImportSettingsFragment extends BaseOsmAndFragment
implements View.OnClickListener {
public static final String TAG = ImportSettingsFragment.class.getSimpleName();
@ -42,18 +52,18 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
private boolean allSelected;
private boolean nightMode;
public static void showInstance(@NonNull FragmentManager fm, @NonNull List<SettingsItem> settingsItems, @NonNull File file) {
public static void showInstance(@NonNull FragmentManager fm, List<SettingsItem> settingsItems, @NonNull File file) {
ImportSettingsFragment fragment = new ImportSettingsFragment();
fragment.setSettingsItems(settingsItems);
fragment.setFile(file);
fragment.show(fm, TAG);
fm.beginTransaction().replace(R.id.fragmentContainer, fragment, TAG).addToBackStack(null).commit();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
app = getMyApplication();
nightMode = !getSettings().isLightContent();
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
if (settingsItems == null) {
settingsItems = app.getSettingsHelper().getSettingsItems();
}
@ -71,15 +81,23 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
TextViewEx continueBtn = root.findViewById(R.id.continue_button);
selectBtn = root.findViewById(R.id.select_button);
expandableList = root.findViewById(R.id.list);
ViewCompat.setNestedScrollingEnabled(expandableList, true);
View header = inflater.inflate(R.layout.list_item_description_header, container, false);
TextView description = header.findViewById(R.id.description);
description.setText(R.string.select_data_to_import);
expandableList.addHeaderView(header);
continueBtn.setOnClickListener(this);
selectBtn.setOnClickListener(this);
if (Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(app, root);
}
return root;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
adapter = new ExportImportSettingsAdapter(getMyApplication(), getSettingsToOperate(), nightMode, true);
adapter = new ExportImportSettingsAdapter(app, getSettingsToOperate(), nightMode, true);
expandableList.setAdapter(adapter);
}
@ -112,20 +130,27 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
public void onSettingsImportFinished(boolean succeed, boolean empty, @NonNull List<SettingsHelper.SettingsItem> items) {
if (succeed) {
app.showShortToastMessage(app.getString(R.string.file_imported_successfully, file.getName()));
app.getRendererRegistry().updateExternalRenderers();
AppInitializer.loadRoutingFiles(app, new AppInitializer.LoadRoutingFilesCallback() {
@Override
public void onRoutingFilesLoaded() {
}
});
} else if (empty) {
app.showShortToastMessage(app.getString(R.string.file_import_error, file.getName(), app.getString(R.string.shared_string_unexpected_error)));
}
}
});
dismiss();
FragmentManager fm = getFragmentManager();
if (fm != null) {
fm.popBackStackImmediate();
}
} else {
ImportDuplicatesFragment.showInstance(getFragmentManager(), duplicateItems, settingsItems, file);
dismiss();
ImportDuplicatesFragment.showInstance(requireActivity().getSupportFragmentManager(), duplicateItems, settingsItems, file);
}
}
@SuppressWarnings("unchecked")
private List<Object> getDuplicatesData(List<SettingsItem> items) {
public static List<Object> getDuplicatesData(List<SettingsItem> items) {
List<Object> duplicateItems = new ArrayList<>();
for (SettingsItem item : items) {
if (item instanceof SettingsHelper.ProfileSettingsItem) {
@ -151,6 +176,11 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
if (item.exists()) {
duplicateItems.add(((SettingsHelper.FileSettingsItem) item).getFile());
}
} else if (item instanceof SettingsHelper.AvoidRoadsSettingsItem) {
List<AvoidRoadInfo> avoidRoads = ((SettingsHelper.AvoidRoadsSettingsItem) item).excludeDuplicateItems();
if (!avoidRoads.isEmpty()) {
duplicateItems.addAll(avoidRoads);
}
}
}
return duplicateItems;
@ -165,6 +195,7 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
List<QuickAction> quickActions = new ArrayList<>();
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
List<ITileSource> tileSourceTemplates = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
for (Object object : dataToOperate) {
if (object instanceof ApplicationMode.ApplicationModeBean) {
settingsItems.add(new SettingsHelper.ProfileSettingsItem(app, (ApplicationMode.ApplicationModeBean) object));
@ -177,22 +208,26 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|| object instanceof SQLiteTileSource) {
tileSourceTemplates.add((ITileSource) object);
} else if (object instanceof File) {
settingsItems.add(new SettingsHelper.FileSettingsItem(getMyApplication(), (File) object));
settingsItems.add(new SettingsHelper.FileSettingsItem(app, (File) object));
} else if (object instanceof AvoidRoadInfo) {
avoidRoads.add((AvoidRoadInfo) object);
}
}
if (!quickActions.isEmpty()) {
settingsItems.add(new SettingsHelper.QuickActionSettingsItem(getMyApplication(), quickActions));
settingsItems.add(new SettingsHelper.QuickActionSettingsItem(app, quickActions));
}
if (!poiUIFilters.isEmpty()) {
settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(getMyApplication(), poiUIFilters));
settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(app, poiUIFilters));
}
if (!tileSourceTemplates.isEmpty()) {
settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(getMyApplication(), tileSourceTemplates));
settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(app, tileSourceTemplates));
}
if (!avoidRoads.isEmpty()) {
settingsItems.add(new SettingsHelper.AvoidRoadsSettingsItem(app, avoidRoads));
}
return settingsItems;
}
@SuppressWarnings("unchecked")
private List<AdditionalDataWrapper> getSettingsToOperate() {
List<AdditionalDataWrapper> settingsToOperate = new ArrayList<>();
List<ApplicationMode.ApplicationModeBean> profiles = new ArrayList<>();
@ -201,6 +236,7 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
List<ITileSource> tileSourceTemplates = new ArrayList<>();
List<File> routingFilesList = new ArrayList<>();
List<File> renderFilesList = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
for (SettingsHelper.SettingsItem item : settingsItems) {
if (item.getType().equals(SettingsHelper.SettingsItemType.PROFILE)) {
@ -217,6 +253,8 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
} else if (item.getName().startsWith("/routing/")) {
routingFilesList.add(((SettingsHelper.FileSettingsItem) item).getFile());
}
} else if (item.getType().equals(SettingsHelper.SettingsItemType.AVOID_ROADS)) {
avoidRoads.addAll(((SettingsHelper.AvoidRoadsSettingsItem) item).getItems());
}
}
@ -253,18 +291,47 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
routingFilesList
));
}
if (!avoidRoads.isEmpty()) {
settingsToOperate.add(new AdditionalDataWrapper(
AdditionalDataWrapper.Type.AVOID_ROADS,
avoidRoads
));
}
return settingsToOperate;
}
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
public void showExitDialog() {
Context themedContext = UiUtilities.getThemedContext(getActivity(), nightMode);
AlertDialog.Builder dismissDialog = new AlertDialog.Builder(themedContext);
dismissDialog.setTitle(getString(R.string.shared_string_dismiss));
dismissDialog.setMessage(getString(R.string.exit_without_saving));
dismissDialog.setNegativeButton(R.string.shared_string_cancel, null);
dismissDialog.setPositiveButton(R.string.shared_string_exit, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
FragmentManager fm = getFragmentManager();
if (fm != null) {
fm.popBackStackImmediate();
}
}
});
dismissDialog.show();
}
private void setupToolbar(Toolbar toolbar) {
toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.headline_close_button, nightMode
toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.ic_action_close, nightMode
? getResources().getColor(R.color.active_buttons_and_links_text_dark)
: getResources().getColor(R.color.active_buttons_and_links_text_light)));
toolbar.setNavigationContentDescription(R.string.shared_string_close);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
showExitDialog();
}
});
}