Merge branch 'master' into ProfileSelectDrawer

This commit is contained in:
nazar-kutz 2019-09-10 11:08:29 +03:00 committed by GitHub
commit 3bed81f855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
82 changed files with 5802 additions and 400 deletions

View file

@ -36,6 +36,8 @@ public class GeneralRouter implements VehicleRouter {
public static final String DEFAULT_SPEED = "default_speed";
public static final String MIN_SPEED = "min_speed";
public static final String MAX_SPEED = "max_speed";
public static final String VEHICLE_HEIGHT = "height";
public static final String VEHICLE_WEIGHT = "weight";
private final RouteAttributeContext[] objectAttributes;
public final Map<String, String> attributes;

View file

@ -384,6 +384,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'

View file

@ -0,0 +1,9 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#D9F0B400">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/active_color_primary_light" />
<corners android:radius="4dp" />
</shape>
</item>
</ripple>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="@color/app_bar_color_light"
app:contentInsetLeft="4dp"
app:contentInsetStart="4dp">
<ImageButton
android:id="@+id/close_button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="56dp"
android:layout_height="56dp"
android:contentDescription="@string/access_shared_string_navigate_up"
android:src="@drawable/ic_action_mode_back" />
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:scaleType="center"
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
tools:text="Toolbar"
tools:visibility="visible" />
<ProgressBar
android:id="@+id/ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/card_and_list_background_basic"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@android:id/list_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
</LinearLayout>

View file

@ -0,0 +1,51 @@
<?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="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/shared_string_other" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,73 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
<Switch
android:id="@android:id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:clickable="true"
android:focusable="true"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="18dp"
android:layout_marginBottom="18dp"
android:background="?attr/divider_color_basic" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,33 @@
<?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="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:minHeight="@dimen/bottom_sheet_list_item_height">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
tools:icon="@drawable/ic_action_info_dark"
tools:tint="?attr/default_icon_color" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/list_header_settings_top_margin"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>

View file

@ -0,0 +1,17 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>

View file

@ -0,0 +1,59 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height">
<RadioButton
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:background="@null"
android:clickable="true"
android:focusable="true" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,66 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
<Switch
android:id="@android:id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:clickable="true"
android:focusable="true"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,54 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
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" />
</LinearLayout>
<Switch
android:id="@android:id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:clickable="true"
android:focusable="true"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,56 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,70 @@
<android.support.v7.widget.Toolbar 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:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="56dp"
osmand:contentInsetLeft="0dp"
osmand:contentInsetStart="0dp"
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/card_and_list_background_basic"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/dashboard_map_toolbar"
android:orientation="horizontal">
<ImageButton
android:id="@+id/close_button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="56dp"
android:layout_height="56dp"
android:contentDescription="@string/access_shared_string_navigate_up"
android:src="@drawable/ic_action_mode_back"
android:tint="?attr/default_icon_color" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/toolbar_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_weight="1"
android:text="@string/routing_settings_2"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size_large"
android:textStyle="bold"
osmand:typeface="@string/font_roboto_regular" />
<FrameLayout
android:id="@+id/switch_profile_button"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:background="@drawable/bg_transparent_rounded_profile">
<ImageView
android:id="@+id/profile_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:src="@drawable/ic_action_car_dark"
tools:tint="@color/active_color_primary_light" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>

View file

@ -0,0 +1,145 @@
<android.support.v7.widget.Toolbar 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:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="56dp"
osmand:contentInsetLeft="0dp"
osmand:contentInsetStart="0dp"
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/card_and_list_background_basic"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/dashboard_map_toolbar"
android:orientation="horizontal">
<ImageButton
android:id="@+id/close_button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="56dp"
android:layout_height="56dp"
android:contentDescription="@string/access_shared_string_navigate_up"
android:src="@drawable/ic_action_mode_back"
android:tint="?attr/default_icon_color" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/toolbar_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_weight="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size_large"
android:textStyle="bold"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/routing_settings_2" />
<ImageView
android:id="@+id/menu_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="@dimen/content_padding"
android:src="@drawable/ic_overflow_menu_dark"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="@+id/profile_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/switch_profile_button"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="6dp"
android:background="@drawable/bg_transparent_rounded_profile"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/profile_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
android:src="@drawable/ic_action_coordinates_latitude"
tools:tint="?attr/default_icon_color" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/profile_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/profile_type_base_string"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/profile_type"
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"
osmand:typeface="@string/font_roboto_regular"
tools:text="Item additional description" />
</LinearLayout>
<ImageView
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginRight="@dimen/bottom_sheet_image_text_margin_start"
android:src="@drawable/ic_action_arrow_drop_down"
android:tint="?attr/default_icon_color" />
</LinearLayout>
<View
android:id="@+id/toolbar_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:visibility="visible"
tools:background="?attr/active_color_basic" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>

View file

@ -3720,4 +3720,5 @@
<string name="poi_goods_designated">ausgewiesen</string>
<string name="poi_disabled_yes">ja</string>
<string name="poi_disabled_designated">ausgewiesen</string>
<string name="poi_cellar_entrance">Kellereingang</string>
</resources>

View file

@ -807,11 +807,11 @@
<!-- string name="search_tabs_location">Position</string -->
<string name="context_menu_item_update_map">Karte aktualisieren</string>
<string name="context_menu_item_create_poi">POI erstellen</string>
<string name="shared_string_yes">Ja</string>
<string name="shared_string_yes">ja</string>
<string name="shared_string_cancel">Abbrechen</string>
<string name="shared_string_apply">Anwenden</string>
<string name="shared_string_add">Hinzufügen</string>
<string name="shared_string_no">Nein</string>
<string name="shared_string_no">nein</string>
<string name="add_favorite_dialog_top_text">Favorit benennen</string>
<string name="add_favorite_dialog_default_favourite_name">Favorit</string>
<string name="add_favorite_dialog_favourite_added_template">Favorit \'\'{0}\'\' hinzugefügt.</string>
@ -3240,7 +3240,7 @@ Abgedeckte Fläche: %1$s x %2$s</string>
<string name="years_5">Jahre</string>
<string name="months_3">Drei Monate</string>
<string name="price_free">Kostenlos</string>
<string name="get_free_trial_title">Beginnen Sie Ihre %1$d %2$s Probezeit.</string>
<string name="get_free_trial_title">Probezeit für %1$d %2$s beginnen.</string>
<string name="get_discount_second_part">dann %1$s</string>
<string name="cancel_subscription">Abonnement beenden</string>
<string name="price_and_discount">%1$s • Spare %2$s</string>

View file

@ -3182,6 +3182,6 @@ Area honi dagokio: %1$s x %2$s</string>
<string name="select_base_profile_dialog_message">"Oinarritu zure profil pertsonala lehenetsitako aplikazio profil batean, hau da, oinarrizko konfigurazioa, widgeten eta abiadura eta distantziaren lehenetsitako ikusgarritasuna definitzen duena. Hauek dira aplikazio profil lehenetsiak, profil pertsonalizatuen adibideekin batera:"</string>
<string name="app_mode_scooter">Motoa</string>
<string name="shared_string_default">Lehenetsia</string>
<string name="day"></string>
<string name="day"/>
<string name="days_2_4">Egunak</string>
</resources>

View file

@ -1096,7 +1096,7 @@ Memoria in proporzione %4$s MB (limite di Android %5$s MB, Dalvik %6$s MB).</str
<string name="lang_cs">Ceco</string>
<string name="lang_da">Danese</string>
<string name="lang_nl">Olandese</string>
<string name="lang_fi">Finnico</string>
<string name="lang_fi">Finlandese</string>
<string name="lang_fr">Francese</string>
<string name="lang_ka">Georgiano</string>
<string name="lang_de">Tedesco</string>
@ -3127,8 +3127,8 @@ Rappresenta l\'area: %1$s x %2$s</string>
<string name="routing_attr_max_num_changes_name">Numero di cambiamenti</string>
<string name="settings_privacy_and_security_desc">Seleziona i dati che stai condividendo con noi</string>
<string name="osmand_routing_promo">Puoi aggiungere la tua versione modificata del file routing.xml in ..osmand/routing</string>
<string name="app_mode_skiing">Sciare</string>
<string name="base_profile_descr_ski">Sciare</string>
<string name="app_mode_skiing">Sci</string>
<string name="base_profile_descr_ski">Sci</string>
<string name="routing_profile_ski">Sci</string>
<string name="profile_type_base_string">Profilo base</string>
<string name="profile_alert_duplicate_name_title">Nome duplicato</string>
@ -3213,4 +3213,29 @@ Rappresenta l\'area: %1$s x %2$s</string>
<string name="shared_string_default">Predefinita</string>
<string name="app_mode_wagon">Carrozza</string>
<string name="app_mode_pickup_truck">Fuoristrada pickup</string>
<string name="weeks_5">Settimane</string>
<string name="month">Mese</string>
<string name="months_2_4">Mesi</string>
<string name="months_5">Mesi</string>
<string name="year">Anno</string>
<string name="years_2_4">Anni</string>
<string name="years_5">Anni</string>
<string name="months_3">Tre mesi</string>
<string name="price_free">Gratuito</string>
<string name="get_discount_title">Ottieni %1$d %2$s al %3$s di sconto.</string>
<string name="get_free_trial_title">Inizia il tuo %1$d %2$s periodo di prova gratuito.</string>
<string name="get_discount_first_part">%1$s per il primo %2$s</string>
<string name="get_discount_first_few_part">%1$s per il primo %2$s</string>
<string name="get_discount_second_part">poi %1$s</string>
<string name="cancel_subscription">Cancella la sottoscrizione</string>
<string name="price_and_discount">%1$s • Risparmi %2$s</string>
<string name="routing_attr_allow_classic_only_name">Permetti solo i percorsi classici</string>
<string name="new_route_calculated_dist_dbg">PeErcorso: distanza %s, durata %s
\nCalcolo: %.1f sec, %d strade, %d mattonelle)</string>
<string name="lang_oc">Occitano</string>
<string name="day">Giorno</string>
<string name="days_2_4">Giorni</string>
<string name="days_5">Giorni</string>
<string name="week">Settimana</string>
<string name="weeks_2_4">Settimane</string>
</resources>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="plugins_screen">Spraudņu pārvaldnieks</string>
<string name="prefs_plugins_descr">Spraudņi papildina aplikācijas iespējas un piešķir tai papildus funkcionalitāti</string>
<string name="prefs_plugins_descr">Spraudņi papildina lietotnes iespējas un piešķir papildus funkcionalitāti.</string>
<string name="prefs_plugins">Spraudņi</string>
<string name="osm_editing_plugin_description">Rādīt iestatījumus OSM pilnveidošanai - OSM POI objektu izveidei/labošanai, GPX treku izplatīšanai un ziņošanai par OSM kļūdām. Vairāk uzziniet https://openstreetmap.org vietnē. Ikviens ir aicināts ņemt aktīvu dalību, ko ir iespējams darīt caur OsmAnd aplikāciju, norādot jūsu OSM lietotāja datus.</string>
<string name="vector_maps_may_display_faster_on_some_devices">Vektoru kartes tiks attēlotas ātrāk, bet var nestrādāt uz visām ierīcēm.</string>
@ -113,15 +113,15 @@
<string name="fav_export_confirmation">Fails ar iepriekš eksportētu izlasi jau pastāv. Vai vēlaties to pārrakstīt?</string>
<string name="profile_settings">Profila iestatījumi</string>
<string name="settings_preset">Noklusētais profils</string>
<string name="settings_preset_descr">Kartes un navigācijas uzstādījumi tiek saglabāti katrā profilā atsevišķi. Izvēlieties noklusēto profilu.</string>
<string name="settings_preset_descr">Izvēlieties noklusēto profilu (iestatījumi tiek saglabāti katrā profilā atsevišķi).</string>
<string name="routing_settings">Navigācija</string>
<string name="routing_settings_descr">Mainīt maršruta iestatījumus</string>
<string name="global_settings">Globālie iestatījumi</string>
<string name="index_settings">Kartes faili</string>
<string name="index_settings_descr">"Lejupielādēt un pārraudzīt kartes daļas, balss pakas un vikipēdijas interešu punktus (POI)"</string>
<string name="general_settings">Vispārīgie iestatījumi</string>
<string name="general_settings_descr">Mainīt aplikācijas iestatījumus</string>
<string name="global_app_settings">Globālie aplikācijas iestatījumi</string>
<string name="general_settings_descr">Mainīt lietotnes iestatījumus.</string>
<string name="global_app_settings">Globālie lietotnes iestatījumi</string>
<string name="user_name">OSM lietotāja vārds</string>
<string name="open_street_map_login_descr">Nepieciešams, lai veiktu augšupielādes openstreetmap.org</string>
<string name="user_password">Jūsu OSM parole</string>
@ -160,7 +160,7 @@
<string name="old_poi_file_should_be_deleted">POI datu fails \'%1$s\' vairs nav nepieciešams un to var izdzēst.</string>
<string name="update_poi_file_not_found">Nevar atrast un izveidot failu, kurā uzturēt POI izmaiņas.</string>
<string name="button_upgrade_osmandplus">Atjaunināt OsmAnd+</string>
<string name="map_version_changed_info">Serveris satur kartes failus, kuri nav savietojami ar pašreizējo aplikācijas versiju. Lai varētu lejupielādēt un lietot šos failus, lūdzu atjauniniet aplikāciju uz jaunāku versiju.</string>
<string name="map_version_changed_info">Lai izmantotu jaunos karšu failus, ir nepieciešams atjaunināt lietotni.</string>
<string name="shared_string_rename">Pārsaukt</string>
<string name="poi_filter_nominatim">Tiešaistes POI - Nominatim</string>
<string name="search_position_current_location_search">Meklē atrašanās vietu…</string>
@ -234,7 +234,7 @@
<string name="voice_stream_voice_call">Tālruņa skaļrunis (ietverot auto bluetooth)</string>
<string name="voice_stream_notification">Ziņojumu kanāls</string>
<string name="voice_stream_music">Multimēdiju skaļrunis</string>
<string name="warning_tile_layer_not_downloadable">Aplikācija nevar lejupielādēt kartes slāni %1$s, lūdzu mēģiniet to pārinstalēt.</string>
<string name="warning_tile_layer_not_downloadable">Lietotne nevar lejupielādēt kartes slāni %1$s, mēģiniet to pārinstalēt.</string>
<string name="overlay_transparency_descr">Modificēt pārklāja caurspīdīgumu</string>
<string name="overlay_transparency">Pārklāja caurspīdīgums</string>
<string name="map_transparency_descr">Modificēt bāzes kartes caurspīdīgumu</string>
@ -330,14 +330,14 @@
<string name="loading_builds">Lejupielādē OsmAnd versijas…</string>
<string name="select_build_to_install">Izvēlieties, kuru OsmAnd versiju instalēt</string>
<string name="contribution_activity">Instalācijas versija</string>
<string name="gps_status_app_not_found">GPS statusa aplikācija nav instalēta. Meklēt Play veikalā?</string>
<string name="gps_status_app_not_found">GPS statusa lietotne nav instalēta. Meklēt Google Play veikalā\?</string>
<string name="voice_is_not_available_msg">"Nav pieejama balss vadība, lūdzu ejiet uz \'Iestatījumi\' → \'Vispārīgie Iestatījumi\' → \'Balss vadība\' un izvēlieties vai lejupielādējiet balss pakotni."</string>
<string name="voice_is_not_available_title">Nav izvēlēta balss vadība</string>
<string name="daynight_mode_day">Diena</string>
<string name="daynight_mode_night">Nakts</string>
<string name="daynight_mode_auto">Saullēkts/saulriets</string>
<string name="daynight_mode_sensor">Gaismas sensors</string>
<string name="daynight_descr">Izvēlieties dienas/nakts pārslēgšanas kārtību</string>
<string name="daynight_descr">Izvēlieties dienas un nakts režīma pārslēgšanās kārtību.</string>
<string name="daynight">Dienas/nakts režīms</string>
<string name="download_files_question">Lejupielādēt {0} failu(s) ({1} MB)?</string>
<string name="items_were_selected">izvēlēta {0} vienība(s)</string>
@ -445,7 +445,7 @@
<string name="route_head">Turpināt</string>
<string name="first_time_continue">Vēlāk</string>
<string name="first_time_download">Lejupielādēt reģionus</string>
<string name="first_time_msg">Paldies, ka izvēlējāties OsmAnd. Lai izmantotu aplikācijas pamatfunkcijas, ir nepieciešams lejupielādēt reģiona bezsaistes datus. Tos jūs varat lejupielādēt caur \'Iestatījumi\' -&gt; → \'Bezsaistes dati\'. Pēc tam jūs varēsiet lietot kartes, atrast adreses vai interešu punktus, meklēt sabiedrisko transportu.</string>
<string name="first_time_msg">"Paldies, ka izvēlējāties OsmAnd. Lejupielādējiet reģiona datus bezsaistes lietošanai caur \'Izvēlne\' -&gt; → \'Lejupielādes\'. Pēc tam jūs varēsiet skatīt kartes, atrast adreses, interešu punktus (POI), meklēt sabiedrisko transportu un vēl."</string>
<string name="search_poi_location">Meklē signālu…</string>
<string name="search_near_map">Meklēt blakus kartes centram</string>
<string name="search_nearby">Meklēt tuvumā</string>
@ -565,7 +565,7 @@
<string name="shared_string_add_to_favorites">Pievienot izlasei</string>
<string name="use_english_names_descr">Izvēlieties angļu, lai vietvārdus ar nestandarta rakstuzīmēm būtu vieglāk atrast un izlasīt</string>
<string name="use_english_names">Lietot angļu nosaukumus</string>
<string name="app_settings">Aplikācijas iestatījumi</string>
<string name="app_settings">Lietotnes iestatījumi</string>
<string name="search_address">Meklēt adresi</string>
<string name="choose_building">Izvēlieties māju</string>
<string name="choose_street">Izvēlieties ielu</string>
@ -662,7 +662,7 @@
<string name="left_side_navigation_descr">Ieslēdziet, ja jūs atrodieties valstīs ar kreisās joslas kustību</string>
<string name="unknown_from_location">Sākuma punkts vēl nav noteikts</string>
<string name="confirm_interrupt_download">Vai pārtraukt faila lejupielādi?</string>
<string name="basemap_was_selected_to_download">Pamatkarte, kas ir nepieciešama aplikācijas normālai darbībai, tika pievienota lejupielādei.</string>
<string name="basemap_was_selected_to_download">Pamatkarte ir nepieciešama lietotnes darbībai, tāpēc tā ir pievienota lejupielādei.</string>
<string name="map_online_plugin_is_not_installed">Aktivizēt tiešsaistes karšu spraudni, lai atlasītu citus karšu avotus</string>
<string name="map_online_data">Tiešsaistes kartes</string>
<string name="map_online_data_descr">Lietot tiešaistes kartes (lejuplādējot un kešojot bildes SD kartē)</string>
@ -760,13 +760,14 @@
<string name="screen_is_locked">Lai atslēgtu ekrānu, nospiediet atslēdziņas ikonu</string>
<string name="bg_service_screen_unlock">Atslēgt ekrānu</string>
<string name="bg_service_sleep_mode_off">Darbināt aplikāciju fonā</string>
<string name="bg_service_sleep_mode_on">Izslēgt\n aplikācijas darbību fonā</string>
<string name="bg_service_sleep_mode_on">Izslēgt
\nlietotnes darbību fonā</string>
<string name="layer_map_appearance">Ekrāns</string>
<string name="show_lanes">Joslas</string>
<string name="avoid_unpaved">Izvairīties no grants ceļiem</string>
<string name="avoid_ferries">Izvairīties no pārceltuvēm</string>
<string name="avoid_in_routing_title">Izvairīties…</string>
<string name="avoid_in_routing_descr">Izvairīties no maksas ceļiem, pārceltuvēm un ceļiem bez seguma</string>
<string name="avoid_in_routing_title">Izvairīties no</string>
<string name="avoid_in_routing_descr">Izvairīties no maksas vai grants ceļiem un prāmjiem.</string>
<string name="show_warnings_title">Rādīt signālus…</string>
<string name="show_warnings_descr">Satiksmes ierobežojumus (ātruma limitus, stopzīmes, rampas), gājēju pārejas, fotoradarus, ceļa joslas</string>
<string name="map_widget_fluorescent">Fluorescējošs maršruts</string>
@ -800,29 +801,18 @@
<string name="avoid_motorway">Izvairīties no automaģistrālēm</string>
<string name="snap_to_road_descr">Navigācijas laikā tuvināt ceļam</string>
<string name="snap_to_road">Tuvināt ceļam</string>
<string name="osmand_short_description_80_chars">OsmAnd ir atvērtā koda navigācijas aplikācija bezsaistes un tiešsaistes kartēm</string>
<string name="osmand_long_description_1000_chars">"
OsmAnd (OSM Automated Navigation Directions)
OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem OpenStreetMap (OSM) datiem. Visi kartes dati (vektoru un bilžu kartes) var tikt saglabāti telefona atmiņā, lai vēlāk tos izmantotu bezsaistē. OsmAnd piedāvā arī bezsaistes un tiešsaistes navigācijas funkcionalitāti t.sk. balss vadību.
\t\tProgrammas pamata funcionalitāte iekļauj:
\t\t - Pilnīga bezsaistes funkcionalitāte (vektoru un bilžu kartes saglabātas izvēlētajā mapē)
\t\t- Kompaktas bezsaistes kartes visai pasaulei - valsts vai reģiona kartes lejupielādējamas tieši no aplikācijas
\t\t - Iespējama vairāku karšu pārklāšana ar dažādiem caurspīdīguma līmeņiem (piem. GPX sekošanas ceļš, intereses vietas (POI), izlase, kontūra līnijas, sabiedriskā transporta pieturas, papildus kartes)
\t\t - Bezsaistes adrešu un POI meklēšana.
\t\t - Bezsaistes navigācija (eksperimentāla)
\t\t - Auto, velo un kājāmgājēju režīmi
\t\t - ieslēdzama dienas un nakts režīmu pārslēgšanās
\t\t - ieslēdzama joslu uzrādīšana, ātruma ierobežojuma attēlošana, ierakstītas un TTS valodas.
\t\t Šai bezmaksas OsmAnd versijai ir sekojoši ierobežojumi:
\t\t - Ierobežots lejuplādējamo karšu skaits
\t\t - Nav pieejams Wikipēdijas bezsaistes POI.
\t\tOsmAnd tiek atkīvi izstrādāts un mūsu projekta tālākais progress ir balstīts uz ziedojumiem, lai finansētu jaunas funkcionalitātes izstrādi un testēšanu. Lūdzu izvēlēties iespēju iegādāties OsmAnd+ vai izvēlieties finansēt speciālās funkcijas, vai arī ziedot tieši osmand.net.
"</string>
<string name="osmand_plus_short_description_80_chars">OsmAnd ir atvērtā koda navigācijas aplikācija bezsaistes un tiešsaistes kartēm</string>
<string name="osmand_short_description_80_chars">OsmAnd ir atvērtā koda navigācijas lietotne bezsaistes un tiešsaistes kartēm</string>
<string name="osmand_long_description_1000_chars">OsmAnd (OSM Automated Navigation Directions)
\n
\nOsmAnd ir atvērtā koda navigācijas lietotne ar piekļuvi vispusīgiem OpenStreetMap (OSM) datiem. Visi kartes dati (vektoru un bilžu kartes) var tikt saglabāti telefona atmiņā, lai vēlāk tos izmantotu bezsaistē. OsmAnd piedāvā arī bezsaistes un tiešsaistes navigācijas funkcionalitāti t.sk. balss vadību.
\n
\n\t\tProgrammas pamata funcionalitāte iekļauj: \t\t - Pilnīga bezsaistes funkcionalitāte (vektoru un bilžu kartes saglabātas izvēlētajā mapē)
\n \t\t- Kompaktas bezsaistes kartes visai pasaulei - valsts vai reģiona kartes lejupielādējamas tieši no aplikācijas \t\t - Iespējama vairāku karšu pārklāšana ar dažādiem caurspīdīguma līmeņiem (piem. GPX sekošanas ceļš, intereses vietas (POI), izlase, kontūra līnijas, sabiedriskā transporta pieturas, papildus kartes) \t\t - Bezsaistes adrešu un POI meklēšana. \t\t - Bezsaistes navigācija (eksperimentāla) \t\t - Auto, velo un kājāmgājēju režīmi \t\t - ieslēdzama dienas un nakts režīmu pārslēgšanās \t\t - ieslēdzama joslu uzrādīšana, ātruma ierobežojuma attēlošana, ierakstītas un TTS valodas.
\n
\n\t\t Šai bezmaksas OsmAnd versijai ir sekojoši ierobežojumi: \t\t - Ierobežots lejuplādējamo karšu skaits \t\t - Nav pieejams Wikipēdijas bezsaistes POI.
\n
\n\t\tOsmAnd tiek atkīvi izstrādāts un mūsu projekta tālākais progress ir balstīts uz ziedojumiem, lai finansētu jaunas funkcionalitātes izstrādi un testēšanu. Lūdzu izvēlēties iespēju iegādāties OsmAnd+ vai izvēlieties finansēt speciālās funkcijas, vai arī ziedot tieši osmand.net.</string>
<string name="osmand_plus_short_description_80_chars">OsmAnd ir atvērtā koda navigācijas lietotne bezsaistes un tiešsaistes kartēm</string>
<string name="filterpoi_activity">Izveidot POI filtru</string>
<string name="select_navigation_mode">Izvēlieties transporta veidu</string>
<string name="day_night_info_description">Saullēkts: %1$s\nSaulriets: %2$s</string>
@ -839,7 +829,7 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="delete_target_point">Noņemt punktu</string>
<string name="intermediate_point">Starpposma punkts %1$s</string>
<string name="close_changeset">Aizvērt izmaiņu kopu</string>
<string name="zxing_barcode_scanner_not_found">Nav instalēta ZXing Barcode Scanner aplikācija. Meklēt Google Play veikalā?</string>
<string name="zxing_barcode_scanner_not_found">Nav instalēta ZXing Barcode Scanner lietotne. Meklēt Google Play veikalā\?</string>
<string name="rendering_attr_roadColors_description">Izvēlieties ceļu krāsu shēmu:</string>
<string name="rendering_attr_roadColors_name">Ceļu krāsu shēma</string>
<string name="map_widget_map_rendering">Kartes renderēšana</string>
@ -917,7 +907,7 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="distance_measurement_finish_subtrack">Jauns apakšposms</string>
<string name="distance_measurement_clear_route">Noņemt visus mērķus</string>
<string name="distance_measurement_load_gpx">Atvērt GPX failu</string>
<string name="wait_current_task_finished">Lūdzu uzgaidiet, kamēr tiks pabeigta darbība</string>
<string name="wait_current_task_finished">Lūdzu uzgaidiet, kamēr tiks pabeigta patreizējā darbība</string>
<string name="use_kalman_filter_compass_descr">"Samazina kompasa svārstības, palielinot inertumu"</string>
<string name="use_kalman_filter_compass">Lietot Kalmana filtru</string>
<string name="use_magnetic_sensor_descr">Lietot magnētisko sensoru orientācijas sensora vietā, lai noteiktu kompasa stāvokli</string>
@ -934,8 +924,8 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="hno">Mājas numurs</string>
<string name="monitoring_settings">Maršruta ieraksts</string>
<string name="monitoring_settings_descr">GPX failā vai sekošanai tīklā</string>
<string name="choose_osmand_theme_descr">Mainīt aplikācijas vizuālo izskatu</string>
<string name="choose_osmand_theme">Aplikācijas motīvs</string>
<string name="choose_osmand_theme_descr">Mainīt lietotnes vizuālo skatu.</string>
<string name="choose_osmand_theme">Lietotnes motīvs</string>
<string name="accessibility_options">Pieejamība</string>
<string name="select_address_activity">Atlasīt adresi</string>
<string name="favourites_list_activity">Atlasīt favorītu</string>
@ -1077,24 +1067,24 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="copying_osmand_files">Kopē OsmAnd failus…</string>
<string name="calculate_osmand_route_gpx">Aprēķināt OsmAnd bezsaistes maršrutu</string>
<string name="app_mode_truck">Kravas mašīna</string>
<string name="guidance_preferences_descr">Navigācijas uzstādījumi</string>
<string name="routing_preferences_descr">Maršruta uzstādījumi</string>
<string name="guidance_preferences_descr">Navigācijas iestatījumi</string>
<string name="routing_preferences_descr">Maršruta iestatījumi</string>
<string name="routing_attr_prefer_motorway_name">Priekšroka automaģistrālēm</string>
<string name="routing_attr_prefer_motorway_description">Maršruta plānošanā vispirms tiks dota priekšroka automaģistrālēm (ātrgaitas šosejām)</string>
<string name="routing_attr_avoid_toll_name">Izvairīties no maksas ceļiem</string>
<string name="routing_attr_avoid_toll_description">Jāmaksā nodeva par ceļa lietošanu</string>
<string name="routing_attr_avoid_unpaved_name">Izvairīties no grants ceļiem</string>
<string name="routing_attr_avoid_unpaved_description">Izvairīties no neapstrādātiem ceļiem bez seguma</string>
<string name="routing_attr_avoid_unpaved_description">Izvairīties no grants ceļiem.</string>
<string name="routing_attr_avoid_ferries_name">Izvairīties no prāmjiem</string>
<string name="routing_attr_avoid_ferries_description">Izvairīties no prāmju ceļiem un pārceltuvēm pāri upēm</string>
<string name="routing_attr_avoid_ferries_description">Izvairīties no prāmjiem</string>
<string name="routing_attr_avoid_motorway_name">Izvairīties no automaģistrālēm</string>
<string name="routing_attr_avoid_motorway_description">Izvairīties no automaģistrālēm jeb ātrgaitas šosejām</string>
<string name="routing_attr_avoid_motorway_description">Izvairīties no automaģistrālēm</string>
<string name="routing_attr_weight_name">Svara robežas</string>
<string name="routing_attr_weight_description">Norādiet transportlīdzekļa svaru, ko ņemt vērā maršrutu aprēķinos</string>
<string name="select_gpx">Paņemt GPX…</string>
<string name="route_descr_select_destination">Atlasīt galamērķi</string>
<string name="shared_string_select_on_map">Atzīmēt uz kartes</string>
<string name="route_preferences">Maršruta uzstādījumi</string>
<string name="route_preferences">Maršruta iestatījumi</string>
<string name="route_info">Maršruta informācija</string>
<string name="keep_and_add_destination_point">Pievienot kā nākamo galamērķi</string>
<string name="shared_string_favorite">Izlase</string>
@ -1382,9 +1372,9 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="general_settings_2">Vispārējie iestatījumi</string>
<string name="shared_string_ellipsis"></string>
<string name="shared_string_enable">Ieslēgt</string>
<string name="shared_string_disable">Atslēgts</string>
<string name="shared_string_disable">Izslēgt</string>
<string name="shared_string_enabled">Ieslēgts</string>
<string name="shared_string_disabled">Atslēgts</string>
<string name="shared_string_disabled">Izslēgts</string>
<string name="shared_string_selected">Atlasīts</string>
<string name="shared_string_deselect">Noņemt iezīmi</string>
<string name="shared_string_deselect_all">Neatlasīt neko</string>
@ -1466,7 +1456,7 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="copying_osmand_file_failed">Neizdevās nokopēt failus</string>
<string name="storage_directory_external">Ārējā krātuve</string>
<string name="storage_directory_multiuser">Vairāklietotāju krātuve</string>
<string name="storage_directory_internal_app">Aplikācijas iekšējā atmiņa</string>
<string name="storage_directory_internal_app">Lietotnes iekšējā atmiņa</string>
<string name="storage_directory_manual">Manuāli norādīts</string>
<string name="storage_directory_default">Iekšējā atmiņa</string>
<string name="storage_directory">Karšu krātuve</string>
@ -1667,7 +1657,7 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="favorite_category_add_new_title">Izveidot jaunu kategoriju</string>
<string name="region_maps">Apgabala kartes</string>
<string name="world_maps">Pasaules kartes</string>
<string name="hillshade_layer_disabled">Hillshade layer ir atslēgts</string>
<string name="hillshade_layer_disabled">Kalnu reljefs izslēgts</string>
<string name="srtm_plugin_disabled">Kontūrlīnijas ir deaktivizētas</string>
<string name="favorite_category_add_new">Izveidot jaunu</string>
<string name="favorite_category_select">Izvēlieties kategoriju</string>
@ -1743,7 +1733,7 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="lang_et">Igauniešu</string>
<string name="lang_ceb">Cebuanu</string>
<string name="disable_recording_once_app_killed">Nerakstīt automātiski</string>
<string name="rendering_value_disabled_name">Atslēgts</string>
<string name="rendering_value_disabled_name">Izslēgts</string>
<string name="rendering_value_walkingRoutesScopeOSMC_name">Krāsas pēc infrastruktūras veida</string>
<string name="rendering_value_walkingRoutesOSMC_name">Krāsas pēc OSMC simbola</string>
<string name="local_recordings_delete_all_confirm">"Vai vēlaties izdzēst %1$d ierakstus?"</string>
@ -1751,7 +1741,7 @@ OsmAnd ir atvērtā koda navigācijas aplikācija ar piekļuvi vispusīgiem Open
<string name="rendering_attr_roadStyle_description">Pārklājuma veidi</string>
<string name="routing_attr_avoid_stairs_name">Izvairīties no kāpnēm</string>
<string name="routing_attr_avoid_stairs_description">Izvairīties no kāpnēm</string>
<string name="routing_attr_avoid_borders_name">Izvairīties no robežu šķēršošanas</string>
<string name="routing_attr_avoid_borders_name">Izvairīties pārbraukt robežas</string>
<string name="rendering_attr_alpineHiking_name">Kalnu tūrisms (SAC)</string>
<string name="shared_string_release">Izlaists</string>
<string name="favourites_context_menu_add">Pievienot izlasei</string>
@ -1812,7 +1802,7 @@ failu(s)?
<string name="lang_fy">Frisku</string>
<string name="nm">nm</string>
<string name="nm_h">nm/h</string>
<string name="routing_attr_avoid_shuttle_train_description">Izvairīties no piepilsētas vilcieniem</string>
<string name="routing_attr_avoid_shuttle_train_description">Izvairīties no starppilsētu vilcieniem</string>
<string name="confirm_download_roadmaps">Jums jau ir standarta (pilnā) karte, vai lejupielādēt arī ceļu sazarojuma karti?</string>
<string name="value_downloaded_of_max">%1$.1f no %2$.1f MB</string>
<string name="file_size_in_mb">%.1f MB</string>
@ -1884,7 +1874,7 @@ failu(s)?
<string name="no_map_markers_found">Lūdzu, pievienojiet marķierus caur karti</string>
<string name="no_waypoints_found">Nav atrasts neviens ceļa punkts</string>
<string name="report">Pārskats</string>
<string name="storage_permission_restart_is_required">Aplikācijai ir piešķirta atļauja rakstīt ārējā glabātuvē. Ir nepieciešams aplikācijas restarts.</string>
<string name="storage_permission_restart_is_required">"Lietotnei tika piešķirta atļauja rakstīt ārējā glabātuvē, tagad nepieciešams restartēt lietotni."</string>
<string name="shared_string_move_up">Uz augšu</string>
<string name="shared_string_move_down">Uz leju</string>
<string name="finish_navigation">Beigt navigāciju</string>
@ -1952,7 +1942,7 @@ failu(s)?
<string name="osm_live_payment_desc">Abonoments tiks apmaksāts automātiski katru mēnesi. Jūs varat atteikties no abonomenta Google Play jebkurā laikā.</string>
<string name="donation_to_osm">Ziedojums OpenStreetMap kopienai</string>
<string name="donation_to_osm_desc">Daļa no jūsu ziedojuma tiks OSM lietotājiem, kuri piedalās OpenStreetMaps kartes veidošanā. Abonomenta izmaksas paliek nemainīgas.</string>
<string name="osm_live_subscription_desc">Abonoments iespējo ik stundas, dienas vai nedēļas jauninājumus un neierobežotas lejupielādes visām kartēm pasaulē.</string>
<string name="osm_live_subscription_desc">"Abonoments iespējo ik stundu, dienu vai nedēļu atjauninājumus un neierobežotas lejupielādes visām pasaules kartēm."</string>
<string name="get_it">Saņemt</string>
<string name="get_for">Saņemt par %1$s</string>
<string name="get_for_month">Saņemt par %1$s mēnesī</string>
@ -2142,7 +2132,7 @@ Apraksta laukumu: %1$s x %2$s</string>
<string name="quick_action_map_source_title">Kartes avoti</string>
<string name="quick_action_map_source_action">Pievienot kartes avotu</string>
<string name="quick_action_map_source_switch">Kartes avots tika nomainīts uz \"%s\".</string>
<string name="configure_screen_quick_action">Ātrā darbība</string>
<string name="configure_screen_quick_action">Ātrās darbības</string>
<string name="quick_action_item_action">Darbība %d</string>
<string name="quick_action_item_screen">Ekrāns %d</string>
<string name="quick_favorites_name_preset">Vieta no izlases</string>
@ -2154,27 +2144,26 @@ Apraksta laukumu: %1$s x %2$s</string>
<string name="shared_string_action_name">Darbības vārds</string>
<string name="auto_split_recording_descr">Sākt jaunu segmentu pēc 6 minūšu pārtraukuma, jaunu treku pēc 2 stundu pārtraukuma vai jaunu failu pēc ilgāka pārtraukuma, ja ir izmainīts datums.</string>
<string name="auto_split_recording_title">Automātiski sadalīt ierakstus pēc pārtraukuma</string>
<string name="osmand_plus_long_description_1000_chars">"
OsmAnd+ (OSM Automated Navigation Directions)
Osmand+ ir atvērtā koda navigācijas aplikācija ar pieeju daudzpusīgiem globāliem OpenStreetMap (OSM) datiem. Visus kartes datus (vektoru vai bilžu) iespējams saglabāt telefona atmiņas kartē vēlākai lietošanai bezsaistē. Tāpat OsmAnd piedāvā bezsaistes un tiešsaistes maršrutēšanas funkcionalitāti, ieskaitot turn-by-turn balss vadību.
OsmAnd+ piedāvā maksas aplikācijas versiju, kuru nopērkot, jūs atbalstīsiet pašu projektu, jaunu iespēju izstrādi un saņemsiet jaunākos atjauninājumus.
Dažas no iespējām:
- Pilnīga bezsaistes navigācija (saglabā lejupielādētās vektoru un bilžu kartes ierīces iekšējā atmiņā)
- Kompaktas bezsaistes kartes no visas pasaules
- Neierobežotas valstu un reğionu karšu lejupielādes caur aplikāciju
- Bezsaistes vikipēdija (POI lejupielādes no vikipēdijas), neaizvietojams palīgs skatu vietu atrašanai
- Virsklājs no vairākiem atsevišķiem karšu klājiem kā GPX vai navigācijas trases, interešu punkti (POI), izlase, kontūrlīnijas, sabtransporta pieturas, papildus kartes ar maināmu caurspīdīgumu
- Bezsaistes adrešu un vietu meklēšana (POIs)
- Bezsaistes maršrutēšana vidēja attāluma distancēm
- Automašīnu, velosipēdistu un gājēju režīmi ar:
- optionālu auto dienas/nakts režīmu pārslēgšanu
- optionālu no ātruma atkarīgu kartes tuvināšanu
- optionālu kartes taisnošanu pēc kompasa vai kustības virzienā
- optionālu joslu vadību, ātruma limita rādīšanu, ierakstītās un TTS balsis
"</string>
<string name="osmand_plus_long_description_1000_chars">OsmAnd+ (OSM Automated Navigation Directions)
\n
\n Osmand+ ir atvērtā koda navigācijas lietotne ar pieeju daudzpusīgiem globāliem OpenStreetMap (OSM) datiem. Visus kartes datus (vektoru vai bilžu) iespējams saglabāt telefona atmiņas kartē vēlākai lietošanai bezsaistē. Tāpat OsmAnd piedāvā bezsaistes un tiešsaistes maršrutēšanas funkcionalitāti, ieskaitot turn-by-turn balss vadību.
\n
\n OsmAnd+ piedāvā maksas aplikācijas versiju, kuru nopērkot, jūs atbalstīsiet pašu projektu, jaunu iespēju izstrādi un saņemsiet jaunākos atjauninājumus.
\n
\n Dažas no iespējām:
\n - Pilnīga bezsaistes navigācija (saglabā lejupielādētās vektoru un bilžu kartes ierīces iekšējā atmiņā)
\n - Kompaktas bezsaistes kartes no visas pasaules
\n - Neierobežotas valstu un reğionu karšu lejupielādes caur aplikāciju
\n - Bezsaistes vikipēdija (POI lejupielādes no vikipēdijas), neaizvietojams palīgs skatu vietu atrašanai
\n - Virsklājs no vairākiem atsevišķiem karšu klājiem kā GPX vai navigācijas trases, interešu punkti (POI), izlase, kontūrlīnijas, sabtransporta pieturas, papildus kartes ar maināmu caurspīdīgumu
\n - Bezsaistes adrešu un vietu meklēšana (POIs)
\n - Bezsaistes maršrutēšana vidēja attāluma distancēm
\n - Automašīnu, velosipēdistu un gājēju režīmi ar:
\n - optionālu auto dienas/nakts režīmu pārslēgšanu
\n - optionālu no ātruma atkarīgu kartes tuvināšanu
\n - optionālu kartes taisnošanu pēc kompasa vai kustības virzienā
\n - optionālu joslu vadību, ātruma limita rādīšanu, ierakstītās un TTS balsis
\n</string>
<string name="rendering_attr_depthContours_description">Rādīt dziļuma kontūras un punktus</string>
<string name="rendering_attr_depthContours_name">Jūras dziļuma kontūras</string>
<string name="add_new_folder">Pievienot jaunu mapi</string>
@ -2253,7 +2242,7 @@ Apraksta laukumu: %1$s x %2$s</string>
<string name="no_overlay">Nav virsklāja</string>
<string name="no_underlay">Nav apakšklāja</string>
<string name="subscribe_email_error">Kļūda</string>
<string name="subscribe_email_desc">"Pierakstieties mūsu epastu sūtīšanas listei par aplikācijas atlaidēm un saņemiet vēl 3 karšu lejupielādes!"</string>
<string name="subscribe_email_desc">"Pierakstieties epastu ziņojumiem par lietotnes atlaidēm un saņemiet 3 papildus lejupielādes kartēm!"</string>
<string name="depth_contour_descr">Kartes, kas satur jūras dziļuma kontūrlīnijas un punktus.</string>
<string name="sea_depth_thanks">Paldies par jūras dziļuma kontūrkaršu pirkumu!</string>
<string name="index_item_depth_contours_osmand_ext">Jūras dziļuma kontūras</string>
@ -2264,10 +2253,10 @@ Apraksta laukumu: %1$s x %2$s</string>
<string name="restore_purchases">Atjaunot pirkumus</string>
<string name="fonts_header">Fonti kartei</string>
<string name="right_side_navigation">Navigācija ar stūri labajā pusē</string>
<string name="do_not_send_anonymous_app_usage">Nesūtīt anonīmu aplikācijas lietošanas statistiku</string>
<string name="do_not_send_anonymous_app_usage_desc">OsmAnd apkopo informāciju, kuras aplikācijas daļas jūs izmantojat. Jūsu lokācija nekad netiek izpausta, tāpat arī nekas, kas tiek rakstīts aplikācijā vai skatītās, meklētās un lejupielādētās vietas.</string>
<string name="do_not_send_anonymous_app_usage">Nesūtīt anonīmo lietotnes izmantošanas statistiku</string>
<string name="do_not_send_anonymous_app_usage_desc">OsmAnd apkopo informāciju, kuras lietotnes daļas jūs izmantojat visbiežāk. Jūsu lokācija nekad netiek nosūtīta, tāpat nekas, kas tiek rakstīts aplikācijā un skatītās, meklētās vai lejupielādētās vietas.</string>
<string name="do_not_show_startup_messages">Nerādīt ziņojumus startējot</string>
<string name="do_not_show_startup_messages_desc">Aplikācijas atlaižu kuponi un īpaši vietējo notikumu ziņojumi.</string>
<string name="do_not_show_startup_messages_desc">Nerādīt atlaižu kuponus un īpašo vietējo notikumu ziņojumus.</string>
<string name="parking_options">Stāvvietas opcijas</string>
<string name="full_version_thanks">Paldies par OsmAnd pilnās versijas iegādi!</string>
<string name="routing_attr_relief_smoothness_factor_hills_name">Kalnains</string>
@ -2304,9 +2293,9 @@ Apraksta laukumu: %1$s x %2$s</string>
<string name="quick_action_auto_zoom_off">Automērogošana izslēgta</string>
<string name="index_item_depth_points_southern_hemisphere">Jūras dziļuma punkti dienvidu puslodē</string>
<string name="index_item_depth_points_northern_hemisphere">Jūras dziļuma punkti ziemeļu puslodē</string>
<string name="osmand_extended_description_part1">" OsmAnd (OSM Automated Navigation Directions) ir karšu un navigācijas aplikācija ar brīvu piekļuvi augstas kvalitātes OpenStreetMap (OSM) datiem no visas pasaules.
\n
\n Izbaudiet balss un vizuālo navigatoru, skatiet POIs (interešu punktus), veidojiet un pārvaldiet GPX trekus, lietojiet kontūrlīniju vizualizāciju and altitūdas informāciju (caur spraudni), izvēlieties auto, velobraucēju, kājāmgājēju režīmus, labojiet OSM datus un daudz vairāk. "</string>
<string name="osmand_extended_description_part1">OsmAnd (OSM Automated Navigation Directions) ir karšu un navigācijas lietotne ar brīvu piekļuvi augstas kvalitātes OpenStreetMap (OSM) datiem no visas pasaules.
\n
\n Izbaudiet balss un vizuālo navigatoru, skatiet POIs (interešu punktus), veidojiet un pārvaldiet GPX trekus, lietojiet kontūrlīniju vizualizāciju and altitūdas informāciju (caur spraudni), izvēlieties auto, velobraucēju, kājāmgājēju režīmus, labojiet OSM datus un daudz vairāk.</string>
<string name="osmand_extended_description_part2">GPS navigācija
\n • Izvēlieties bezsaistes (bez viesabonēšanas maksas, kad esat ārvalstīs) vai tiešsaistes (ātrāks) režīmu
\n • Turn-by-turn balss vadība jūsu maršrutā (ierakstītās un sintizētās balsis)
@ -2342,31 +2331,27 @@ Apraksta laukumu: %1$s x %2$s</string>
• Caur aplikāciju augšupielādēt GPX trases uz OSM
• Pievienot POIs un augšupielādēt tos uzreiz (vai vēlāk, ja esat bezsaistē) uz OSM
"</string>
<string name="osmand_extended_description_part8">"
OsmAnd ir atvērtā koda aplikācija, kas tiek aktīvi izstrādāta un pilnveidota. Ikviens var piedalīties tā izstrādē, ziņojot par kļūdām, uzlabojot tulkojumus vai kodējot jaunas papildiespējas. Šis projekts tiek nepārtraukti uzlabots, mijiedarbojoties aplikācijas izstrādātājiem ar tās lietotājiem. Projekta progress atkarīgs arī no finsansēm, lai atbalstītu kodēšanu un jaunas funkcionalitātes testēšanu.
Aptuvenais karšu pārklājums un detalizācija:
• Rietumeiropa: ****
• Austrumeiropa: ***
• Krievija: ***
• Ziemeļamerika: ***
• Dienvidamerika: **
• Āzija: **
• Japāna &amp; Koreja: ***
• Tuvie austrumi: **
• Āfrika: **
• Antarktīda: *
Lejupielādei ir pieejamas kartes no gandrīz visām pasaules valstīm!
Saņemiet uzticamu navigatoru jūsu valstij - vai tā būtu Francija, Vācija, Meksika, Apvienotā Karaliste, Spānija, Nīderlande, ASV, Krievija, Brazīlija vai kāda cita
"</string>
<string name="osmand_plus_extended_description_part1">"
OsmAnd+ (OSM Automated Navigation Directions) ir karšu un navigācijas aplikācija ar brīvu piekļuvi augstas kvalitātes OpenStreetMap (OSM) datiem no visas pasaules.
Izbaudiet balss un vizuālo navigatoru, skatiet POIs (interešu punktus), veidojiet un pārvaldiet GPX trekus, lietojiet kontūrlīniju vizualizāciju and altitūdas informāciju (caur spraudni), izvēlieties auto, velobraucēju, kājāmgājēju režīmus, labojiet OSM datus un daudz vairāk.
Osmand+ ir maksas aplikācijas versija. To nopērkot, jūs atbalstīsiet projektu, nodrošināsiet jaunu iespēju izstrādi un saņemsiet jaunākos atjauninājumus
Dažas no pamatiespējām:
"</string>
<string name="osmand_extended_description_part8">OsmAnd ir atvērtā koda lietotne, kas tiek aktīvi izstrādāta un pilnveidota. Ikviens var piedalīties tā izstrādē, ziņojot par kļūdām, uzlabojot tulkojumus vai kodējot jaunas papildiespējas. Šis projekts tiek nepārtraukti uzlabots, mijiedarbojoties aplikācijas izstrādātājiem ar tās lietotājiem. Projekta progress atkarīgs arī no finsansēm, lai atbalstītu kodēšanu un jaunas funkcionalitātes testēšanu.
\n Aptuvenais karšu pārklājums un detalizācija:
\n • Rietumeiropa: ****
\n • Austrumeiropa: ***
\n • Krievija: ***
\n • Ziemeļamerika: ***
\n • Dienvidamerika: **
\n • Āzija: **
\n • Japāna &amp; Koreja: ***
\n • Tuvie austrumi: **
\n • Āfrika: **
\n • Antarktīda: *
\n Lejupielādei ir pieejamas kartes no gandrīz visām pasaules valstīm!
\n Saņemiet uzticamu navigatoru jūsu valstij - vai tā būtu Francija, Vācija, Meksika, Apvienotā Karaliste, Spānija, Nīderlande, ASV, Krievija, Brazīlija vai kāda cita.</string>
<string name="osmand_plus_extended_description_part1">OsmAnd+ (OSM Automated Navigation Directions) ir karšu un navigācijas lietotne ar brīvu piekļuvi augstas kvalitātes OpenStreetMap (OSM) datiem no visas pasaules.
\n
\n Izbaudiet balss un vizuālo navigatoru, skatiet POIs (interešu punktus), veidojiet un pārvaldiet GPX trekus, lietojiet kontūrlīniju vizualizāciju and altitūdas informāciju (caur spraudni), izvēlieties auto, velobraucēju, kājāmgājēju režīmus, labojiet OSM datus un daudz vairāk.
\n
\nOsmand+ ir maksas lietotnes versija. To nopērkot, jūs atbalstīsiet projektu, nodrošināsiet jaunu iespēju izstrādi un saņemsiet jaunākos atjauninājumus
\n
\nDažas no pamatiespējām:</string>
<string name="osmand_plus_extended_description_part2">"
Navigācija
• Darbojas tešsaistē (ātrāk) vai bezsaistē (bez viesabonēšanas maksas, kad esat ārvalstīs)
@ -2418,14 +2403,13 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
\n • Optionāli ceļa ierakstīšana lokālā GPX failā vai tiešsaistes servisā
\n • Optionāli ātruma un altitūtas rādīšana
\n • Konktūrlīniju un kalnu ēnojuma attēlošana (caur atsevišķu spraudni)</string>
<string name="osmand_plus_extended_description_part7">"
Piedalieties OSM veidošanā
• Ziņojiet par datu kļūdām
• Augšupielādējiet GPX trekus uz OSM caur aplikāciju
• Pievienojiet POIs un augšupielādējiet uzreiz uz OSM (vai vēlāk, ja esat bezsaistē)
• Optionāli ceļojuma ierakstīšana arī fona režīmā (kamēr ierīce atrodas miega režīmā)
OsmAnd ir atvērtā koda un aktīvā izstrādē esoša aplikācija. Ikviens var piedalīties tā veidošanā, ziņojot par kļūdām, uzlabojot tulkojumus vai kodējot jaunas iespējas. Projekts atrodas patstāvīgā mijiedarbībā starp izstrādātājiem un aplikācijas lietotājiem. Tāpat arī projekta progress balstās uz finansiālajiem ziedojumiem aplikācijas kodēšanai un jauno iespēju testēšanai
"</string>
<string name="osmand_plus_extended_description_part7">Piedalieties OSM veidošanā
\n • Ziņojiet par datu kļūdām
\n • Augšupielādējiet GPX trekus uz OSM caur aplikāciju
\n • Pievienojiet POIs un augšupielādējiet uzreiz uz OSM (vai vēlāk, ja esat bezsaistē)
\n • Optionāli ceļojuma ierakstīšana arī fona režīmā (kamēr ierīce atrodas miega režīmā)
\n OsmAnd ir atvērtā koda un aktīvā izstrādē esoša lietotne. Ikviens var piedalīties tā veidošanā, ziņojot par kļūdām, uzlabojot tulkojumus vai kodējot jaunas iespējas. Projekts atrodas patstāvīgā mijiedarbībā starp izstrādātājiem un lietotnes lietotājiem. Tāpat arī projekta progress balstās uz finansiālajiem ziedojumiem aplikācijas kodēšanai un jauno iespēju testēšanai
\n</string>
<string name="shared_string_add_photos">Pievienot fotogrāfijas</string>
<string name="mapillary_action_descr">Pievienojiet savus ielas līmeņa skatus ar Mapillary.</string>
<string name="mapillary_widget">Mapillary logrīks</string>
@ -2465,33 +2449,33 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="wrong_format">Nepareizs formāts</string>
<string name="shared_string_road">Ceļš</string>
<string name="show_map">Rādīt karti</string>
<string name="route_is_calculated">Maršruts ir aprēķināts</string>
<string name="route_is_calculated">Maršruts aprēķināts</string>
<string name="round_trip">Turp un atpakaļ</string>
<string name="plan_route_no_markers_toast">Jums vajag pievienot vismaz vienu marķieri, lai lietotu šo funkciju.</string>
<string name="osn_modify_dialog_error">Notika atteice: piezīme nav izlabota</string>
<string name="osn_modify_dialog_error">Piezīmei nevarēja veikt izmaiņas</string>
<string name="osn_modify_dialog_title">Labot piezīmi</string>
<string name="context_menu_item_modify_note">!abot OSM piezīmi</string>
<string name="make_round_trip_descr">Dublēt sākuma punktu kā galamērķi.</string>
<string name="make_round_trip_descr">Nokopēt sākuma punktu kā galamērķi.</string>
<string name="make_round_trip">Turp un atpakaļ maršruts</string>
<string name="shared_string_markers">Marķieri</string>
<string name="coordinates_format">Koordināšu formāts</string>
<string name="use_system_keyboard">Lietot sistēmas klaviatūru</string>
<string name="fast_coordinates_input_descr">Izvēlieties koordināšu ievades formātu. To vienmēr varēsiet izmainīt, spiežot uz iestatījumiem.</string>
<string name="fast_coordinates_input">Ātrā koordināšu ievade</string>
<string name="fast_coordinates_input_descr">Izvēlieties koordināšu ievades formātu. To vienmēr varēsiet izmainīt, spiežot uz \"Iestatījumi\".</string>
<string name="fast_coordinates_input">Ātrā ievade koordinātēm</string>
<string name="routing_attr_avoid_ice_roads_fords_name">No ledus ceļiem un brasla</string>
<string name="routing_attr_avoid_ice_roads_fords_description">Izvairīties no ledus ceļiem un brasliem.</string>
<string name="use_location">Lietot pozīciju</string>
<string name="add_location_as_first_point_descr">Pievienot jūsu pozīciju kā sākuma punktu maršruta plānošanai.</string>
<string name="add_location_as_first_point_descr">Pievienot jūsu atrašanās vietu kā sākuma punktu maršrutam.</string>
<string name="my_location">Mana pozīcija</string>
<string name="shared_string_finish">Finišs</string>
<string name="plan_route">Plānot maršrutu</string>
<string name="shared_string_sort">Kārtot</string>
<string name="coordinate_input">Koordināšu ievade</string>
<string name="marker_save_as_track_descr">Eksportēt marķierus jūsu izvēlētajā failā:</string>
<string name="marker_save_as_track">Saglabāt kā treku</string>
<string name="marker_save_as_track_descr">Eksportēt marķierus sekojošajā GPX failā:</string>
<string name="marker_save_as_track">Saglabāt kā GPX failu</string>
<string name="move_to_history">Pārvietot uz vēsturi</string>
<string name="group_will_be_removed_after_restart">Grupa tiks noņemta pēc restarta</string>
<string name="show_guide_line">Rādīt vadlīniju</string>
<string name="group_will_be_removed_after_restart">Pēc lietotnes restarta šī grupa vairs neeksistēs.</string>
<string name="show_guide_line">Rādīt vadošās līnijas</string>
<string name="show_arrows_on_the_map">Rādīt bultas uz kartes</string>
<string name="show_passed">Rādīt paveikto</string>
<string name="hide_passed">Slēpt paveikto</string>
@ -2529,7 +2513,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="show_direction">Distances indikācija</string>
<string name="sort_by">Kārtot pēc</string>
<string name="do_not_use_animations">Nelietot animāciju</string>
<string name="do_not_use_animations_descr">Aplikācija nelietos animācijas efektus.</string>
<string name="do_not_use_animations_descr">Neanimēt darbības uz ekrāna.</string>
<string name="keep_showing_on_map">Turpināt rādīt uz kartes</string>
<string name="exit_without_saving">Aizvērt bez saglabāšanas?</string>
<string name="line">Līnija</string>
@ -2561,8 +2545,8 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="of">%1$d no %2$d</string>
<string name="ascent_descent">Pacelšanās/nolaišanās</string>
<string name="moving_time">Laiks kustībā</string>
<string name="max_min">Maks./Min.</string>
<string name="min_max">Min./Maks.</string>
<string name="max_min">Maks/Min</string>
<string name="min_max">Min/Maks</string>
<string name="live_monitoring_max_interval_to_send">Laika buferis tiešsaistes sekošanai</string>
<string name="live_monitoring_max_interval_to_send_desrc">Nosakiet laika buferi turpināt sūtīt lokācijas, ja zūd savienojums</string>
<string name="mappilary_no_internet_desc">Lai redzētu Mapillary bildes, ir nepieciešams interneta savienojums.</string>
@ -2689,9 +2673,9 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="osm_live_subscriptions">Abonomenti</string>
<string name="swap_start_and_destination">Samainīt vietām startu ar galamērķi</string>
<string name="add_destination_point">Pievienot galamērķi</string>
<string name="add_intermediate_point">Pievienot \'braukt caur\' punktu</string>
<string name="add_intermediate_point">Pievienot starppunktu</string>
<string name="add_start_point">Pievienot starta punktu</string>
<string name="intermediate_waypoint">Braukt caur</string>
<string name="intermediate_waypoint">Starppunkts</string>
<string name="transfers">Pārsēšanās</string>
<string name="on_foot">Kājām</string>
<string name="route_way">Ceļš</string>
@ -2703,7 +2687,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="simulate_navigation">Animēt navigāciju</string>
<string name="choose_track_file_to_follow">Izvēlieties treka failu sekošanai</string>
<string name="voice_announcements">Balss uzvednes</string>
<string name="intermediate_destinations">Braukt caur</string>
<string name="intermediate_destinations">Starppunkti</string>
<string name="arrive_at_time">Ierašanās %1$s</string>
<string name="cubic_m"></string>
<string name="metric_ton">t</string>
@ -2777,7 +2761,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="rendering_attr_undefined_name">Nenoteikts</string>
<string name="public_transport_warning_descr_blog">Uzziniet vairāk kā OsmAnd aprēķina maršrutus mūsu blogā.</string>
<string name="public_transport_warning_title">Publiskā transporta navigācija atrodas beta stadijā, tāpēc ir iespējamas kļūdas un neprecizitātes.</string>
<string name="add_intermediate">Pievienot \'braukt caur\' punktu</string>
<string name="add_intermediate">Pievienot starppunktu</string>
<string name="shared_string_walk">Ar kājām</string>
<string name="save_poi_value_exceed_length">Maksimālais taga garums ir \"%s\" ir 255 rakstu zīmes.
\nIzvēlieties īsāku vārdu, lai turpinātu.</string>
@ -2816,9 +2800,9 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="public_transport_type">Transporta veids</string>
<string name="searching_gps">Meklē GPS</string>
<string name="coordinates_widget">Koordināšu logrīks</string>
<string name="make_osmand_better_descr">Ļaujiet OsmAnd iegūt un apstrādāt anonīmus aplikācijas lietošanas datus. Mēs neiekļaujam jūsu atrašanās vietas datus vai vietas, kuras pārlūkojat uz kartes.
<string name="make_osmand_better_descr">Ļaujiet OsmAnd iegūt un apstrādāt anonīmus lietotnes izmantošanas datus. Mēs neiekļaujam jūsu atrašanās vietas datus vai vietas, kuras pārlūkojat uz kartes.
\n
\nJūs varat mainīt izvēlēto jebkurā laikā Iestatījumos &gt; Privātums un Drošība.</string>
\nJūs variet mainīt izvēlēto jebkurā laikā Iestatījumos &gt; Privātums un Drošība.</string>
<string name="choose_data_to_share">Izvēlieties, kurus datus gribat koplietot:</string>
<string name="downloaded_maps">Lejupielādētās kartes</string>
<string name="visited_screens">Atvērtie ekrāni</string>
@ -2849,7 +2833,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="profile_type_descr_string">Veids: %s</string>
<string name="profile_type_base_string">Pamata profils</string>
<string name="profile_alert_need_routing_type_title">Izvēlieties navigācijas veidu</string>
<string name="profile_alert_need_routing_type_msg">Lūdzu izvēlieties navigācijas veidu jaunajam aplikācijas profilam</string>
<string name="profile_alert_need_routing_type_msg">Lūdzu izvēlieties navigācijas veidu jaunajam lietotnes profilam</string>
<string name="profile_alert_need_profile_name_title">Ievadiet profila vārdu</string>
<string name="profile_alert_need_profile_name_msg">Profila vārds nedrīkst būt tukšs!</string>
<string name="profile_alert_duplicate_name_title">Dublikāts</string>
@ -2860,7 +2844,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="profile_alert_delete_title">Izdzēst profilu</string>
<string name="profile_alert_delete_msg">Vai esiet pārliecināts, ka vēlaties izdzēst %s profilu</string>
<string name="select_base_profile_dialog_title">Atzīmējiet pamata profilu</string>
<string name="select_base_profile_dialog_message">Balstiet savu profilu uz vienu no noklusētajiem profiliem, kas definēs tādus pamata iestatījumus kā logrīku redzamību un attāluma vai ātruma mērvienības. Šie ir noklusētie aplikācijas profili, kopā ar lietotāja veidotajiem profiliem tie var tikt paplašināti uz:</string>
<string name="select_base_profile_dialog_message">Balstiet savu profilu uz vienu no noklusētajiem profiliem, kas definēs tādus pamata iestatījumus kā logrīku redzamību un attāluma vai ātruma mērvienības. Šie ir noklusētie lietotnes profili, kopā ar lietotāja veidotajiem profiliem tie var tikt paplašināti uz:</string>
<string name="select_nav_profile_dialog_title">Izvēlieties navigācijas veidu</string>
<string name="base_profile_descr_car">"Auto, kravas auto, motocikls"</string>
<string name="base_profile_descr_bicycle">MTB, mopēds, zirgs</string>
@ -2884,7 +2868,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="rendering_attr_highway_class_track_grade4_name">4. klase</string>
<string name="rendering_attr_highway_class_track_grade5_name">5. klase</string>
<string name="routeInfo_road_types_name">Ceļu tipi</string>
<string name="turn_on_profile_desc">Šī iestatījuma lietošanai jāizvēlas vismaz viens aplikācijas profils.</string>
<string name="turn_on_profile_desc">Šī iestatījuma lietošanai jāizvēlas vismaz viens lietotnes profils.</string>
<string name="gpx_join_gaps">Savienot pārrāvumus</string>
<string name="app_mode_camper">Treileris</string>
<string name="app_mode_campervan">Autofurgons</string>
@ -2987,7 +2971,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="tunnel_warning">Priekšā tunelis</string>
<string name="show_tunnels">Tuneļi</string>
<string name="shared_string_current">Pašreizējais</string>
<string name="last_intermediate_dest_description">Pievieno \"braukt caur\" apstāšanās vietu</string>
<string name="last_intermediate_dest_description">Pievieno starppunkta apstāšanās vietu</string>
<string name="first_intermediate_dest_description">Pievieno pirmo apstāšanās vietu</string>
<string name="subsequent_dest_description">Izveido apstāšanās vietu un pārvieto galamērķi uz augšu</string>
<string name="make_as_start_point">Izveidot šo par sākuma punktu</string>
@ -3012,7 +2996,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="distance_farthest">Distance: vispirms tālākais</string>
<string name="distance_nearest">Distance: vispirms tuvākais</string>
<string name="group_deleted">Grupa ir izdzēsta</string>
<string name="clear_all_intermediates">Dzēst visus \"braukt caur\" punktus</string>
<string name="clear_all_intermediates">Dzēst visus starppunktus</string>
<string name="select_waypoints_category_description">Pievienojiet visus treku ceļa punktus kopā vai izvēlieties atsevišķas kategorijas.</string>
<string name="shared_string_total">Kopā</string>
<string name="nothing_found_in_radius">Neko nevarēja atrast:</string>
@ -3102,7 +3086,7 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
<string name="touring_view_render_descr">Palielināts detaļu daudzums tūristu vajadzībām. Iekļauj visas noklusētā stila konfigurēšanas opcijas, papildus: rāda pēc iespējas vairāk detaļu, īpaši ceļus, takas un pārējās iespējas pārvietoties. Vizuāli izceļ atšķirīgus ceļu veidus, līdzinoties tūristu kartēm. Augsta kontrasta krāsu palete lietošanai dienas un nakts režīmā.</string>
<string name="shared_string_bookmark">Grāmatzīme</string>
<string name="off_road_render_descr">"Piemērots braukšanai bezceļa apstākļos, kā arī piemērots lietošanai kopā ar zaļās krāsas satelīta bildēm apakšklāja veidā. Īpašības: samazināts galveno ceļu biezums, palielināts taku, celiņu, veloceliņu u.c. maršrutu līniju biezums. Veidots \"Topo\" stilā."</string>
<string name="access_intermediate_arrival_time">\"Braukt caur\" ierašanās laiks</string>
<string name="access_intermediate_arrival_time">Starppunkta ierašanās laiks</string>
<string name="map_widget_intermediate_time">Ierašanās laiks</string>
<string name="unirs_render_descr">Uzlabots kontrasts kājāmgājēju un velosipēdu celiņiem. Izmanto vecākas Mapnik krāsas.</string>
<string name="shared_string_gpx_file">GPX fails</string>
@ -3136,4 +3120,29 @@ No Afganistānas līdz Zimbabvei, no Austrālijas līdz ASV, Argentīna, Brazīl
\nKopējais: %.1f sek, %d ceļi, %d flīzes)</string>
<string name="lang_oc">Oksitāņu</string>
<string name="app_mode_wagon">Wagon</string>
<string name="routing_attr_avoid_sett_name">Izvairīties no bruģa un bruģakmens</string>
<string name="routing_attr_avoid_sett_description">Izvairīties no bruģa un bruģakmens</string>
<string name="quick_action_need_to_add_item_to_list">Ir nepieciešams pievienot vismaz vienu vienību sarakstā \"Ātrās darbības\" iestatījumos</string>
<string name="routing_attr_piste_type_downhill_name">Kalnu/nogāžu trases</string>
<string name="routing_attr_piste_type_downhill_description">Slēpošanai paredzētās nobraucienu vietas un pacēlāji.</string>
<string name="routing_attr_piste_type_nordic_name">Distanču / nordic ski slēpošana</string>
<string name="routing_attr_piste_type_nordic_description">Distanču un nordic ski slēpošanas trases.</string>
<string name="routing_attr_piste_type_skitour_name">Slēpošanas tūrisms</string>
<string name="routing_attr_piste_type_skitour_description">Maršruti slēpošanas tūrismam.</string>
<string name="routing_attr_piste_type_sled_name">Kamanas</string>
<string name="routing_attr_piste_type_sled_description">Nogāzes kamaniņu nobraucieniem.</string>
<string name="routing_attr_allow_intermediate_name">Atļaut starppunktu maršrutus</string>
<string name="routing_attr_allow_intermediate_description">Sarežģītāki maršruti ar krasākām daļām. Kopumā daži traucējumi, no kuriem būtu jāizvairās.</string>
<string name="routing_attr_allow_advanced_name">Atļaut sarežģītākus maršrutus</string>
<string name="routing_attr_allow_advanced_description">Sarežģīti maršruti, ar bīstamiem objektiem un krasām maršruta daļām.</string>
<string name="routing_attr_allow_expert_name">Atļaut eksperta maršrutus</string>
<string name="routing_attr_allow_expert_description">Ekstrēmi sarežģīti maršruti, ar bīstamiem objektiem un apkārtni.</string>
<string name="routing_attr_allow_skating_only_name">Atļaut tikai slidošanas maršrutus</string>
<string name="routing_attr_allow_skating_only_description">Maršruti brīvajam stilam vai slidošanai tikai bez klasiskajiem celiņiem.</string>
<string name="routing_attr_allow_classic_only_name">Atļaut tikai klasiskos maršrutus</string>
<string name="routing_attr_allow_classic_only_description">Maršruti klasiskajam stilam bez slidošanas celiņa. Tas iekļauj maršrutus izbrauktus ar sniega motociklu un trases, ko veidojuši slēpotāji.</string>
<string name="routing_attr_difficulty_preference_name">Grūtības pakāpe</string>
<string name="routing_attr_difficulty_preference_description">Dot priekšroku izvēlētajai grūtības pakāpei, lai arī vieglāki un grūtāki maršruti joprojām ir iespējami, ja tie ir pietiekami īsi.</string>
<string name="routing_attr_freeride_policy_name">Beztrases</string>
<string name="routing_attr_freeride_policy_description">Brīvā stila un beztrases ir neoficiālie maršruti un pārejas. Parasti neiebraukti un oficiāli netiek neuzturēti. Brauciet tikai uz savu risku.</string>
</resources>

View file

@ -3120,7 +3120,7 @@
<string name="press_again_to_change_the_map_orientation">Trykk igjen for å endre kartorientering</string>
<string name="app_mode_offroad">Terreng</string>
<string name="edit_profile_setup_title">Sett opp profil</string>
<string name="routing_attr_max_num_changes_name">Antall endringer</string>
<string name="routing_attr_max_num_changes_name">Antall overganger</string>
<string name="app_mode_shuttle_bus">Pendlebuss</string>
<string name="app_mode_subway">Tunnelbane</string>
<string name="select_base_profile_dialog_message">Baser din egendefinerte profil på en av de forvalgte programprofilene, dette definerer grunnleggende oppsett, som forvalg synliget for miniprogrammer, enheter for hastighet og distanse. Dette er de forvalgte programprofilene, sammen med eksempler på egentilpassede profiler de kan utvides til:</string>
@ -3183,4 +3183,18 @@
<string name="sett_wunderlinq_ext_input">WunderLINQ</string>
<string name="shared_string_default">Forvalg</string>
<string name="shared_string_file_is_saved">% lagret</string>
<string name="day">Dag</string>
<string name="days_2_4">Dager</string>
<string name="days_5">Dager</string>
<string name="week">Uke</string>
<string name="weeks_2_4">Uker</string>
<string name="weeks_5">Uker</string>
<string name="month">Måned</string>
<string name="months_2_4">Måneder</string>
<string name="months_5">Måneder</string>
<string name="year">År</string>
<string name="years_2_4">År</string>
<string name="years_5">År</string>
<string name="months_3">Tre måneder</string>
<string name="price_free">Gratis</string>
</resources>

View file

@ -2886,7 +2886,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="shared_string_capacity">Pojemność</string>
<string name="shared_string_width">Szerokość</string>
<string name="shared_string_height">Wysokość</string>
<string name="swap_start_and_destination">Odwróć start i cel</string>
<string name="swap_start_and_destination">Odwróć początek i cel</string>
<string name="add_destination_point">Dodaj cel trasy</string>
<string name="add_intermediate_point">Dodaj punkt pośredni</string>
<string name="add_start_point">Dodaj punkt początkowy</string>
@ -2898,9 +2898,9 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="waiting_for_route_calculation">Wyznaczanie trasy…</string>
<string name="app_mode_public_transport">Transport publiczny</string>
<string name="avoid_roads_descr">Proszę wybrać na mapie lub z poniższej listy, drogę omijaną podczas nawigacji:</string>
<string name="show_along_the_route">Pokaż na trasie</string>
<string name="show_along_the_route">Wyświetlanie wzdłuż trasy</string>
<string name="simulate_navigation">Symulacja nawigacji</string>
<string name="choose_track_file_to_follow">Wybierz plik trasy do śledzenia</string>
<string name="choose_track_file_to_follow">Wybiera plik śladu do podążania</string>
<string name="voice_announcements">Komunikaty głosowe</string>
<string name="intermediate_destinations">Pośrednie cele podróży</string>
<string name="arrive_at_time">Dotarcie do celu o %1$s</string>
@ -3039,14 +3039,14 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="files_present">%1$d pliki (%2$s) są obecne w poprzednim położeniu „%3$s”.</string>
<string name="move_maps">Przenieś mapy</string>
<string name="dont_move_maps">Nie przenoś</string>
<string name="public_transport_ped_route_title">Trasa pieszo wynosi około %1$s i może być szybsza niż transportem publicznym</string>
<string name="public_transport_ped_route_title">Długość trasa pieszej wynosi około %1$s i może być ona szybsza niż transportem publicznym</string>
<string name="public_transport_no_route_title">Niestety OsmAnd nie mógł znaleźć trasy odpowiedniej dla wybranych ustawień.</string>
<string name="public_transport_try_ped">Wypróbuj nawigację pieszą.</string>
<string name="public_transport_try_change_settings">Spróbuj zmienić ustawienia.</string>
<string name="public_transport_calc_pedestrian">Oblicz trasę pieszą</string>
<string name="public_transport_type">Rodzaj transportu</string>
<string name="searching_gps">Wyszukiwanie GPS</string>
<string name="coordinates_widget">Widget współrzędne</string>
<string name="coordinates_widget">Widżet współrzędnych</string>
<string name="rate_dialog_descr">Daj nam 30 sekund, podziel się opinią i oceń naszą pracę w Google Play.</string>
<string name="button_rate">Oceń</string>
<string name="shared_string_privacy_policy">Polityka prywatności</string>
@ -3074,17 +3074,17 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="app_mode_subway">Metro</string>
<string name="app_mode_horse">Konie</string>
<string name="app_mode_helicopter">Śmigłowiec</string>
<string name="osmand_routing_promo">Możesz dodać własną zmodyfikowaną wersję pliku routing.xml do ..osmand/routing</string>
<string name="osmand_routing_promo">Można dodać własną, zmodyfikowaną wersję pliku routing.xml do ..osmand/routing</string>
<string name="app_mode_skiing">Jazda na nartach</string>
<string name="base_profile_descr_ski">Jazda na nartach</string>
<string name="show_compass_ruler">Pokaż linijkę kompasu</string>
<string name="hide_compass_ruler">Ukryć linijkę kompasu</string>
<string name="show_compass_ruler">Wyświetl linijkę kompasu</string>
<string name="hide_compass_ruler">Ukryj linijkę kompasu</string>
<string name="select_icon_profile_dialog_title">Wybierz ikonę</string>
<string name="settings_routing_mode_string">Tryb: %s</string>
<string name="settings_derived_routing_mode_string">Tryb użytkownika, pochodzący z: %s</string>
<string name="routing_profile_ski">Narty</string>
<string name="profile_type_descr_string">Typ: %s</string>
<string name="profile_type_base_string">Profil Baza</string>
<string name="profile_type_base_string">Profil bazowy</string>
<string name="profile_alert_need_routing_type_title">Wybierz typ nawigacji</string>
<string name="profile_alert_need_routing_type_msg">Proszę wybrać rodzaj nawigacji do nowego profilu aplikacji</string>
<string name="profile_alert_need_profile_name_title">Podaj nazwę profilu</string>
@ -3095,14 +3095,14 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="profile_alert_need_save_title">Zapisz zmiany</string>
<string name="profile_alert_need_save_msg">Przed kontynuowaniem należy zapisać zmiany w profilu</string>
<string name="profile_alert_delete_title">Usuń profil</string>
<string name="profile_alert_delete_msg">Czy na pewno chcesz usunąć profil %s\?</string>
<string name="select_base_profile_dialog_title">Wybierz profil bazowy</string>
<string name="select_base_profile_dialog_message">Oprzyj swój profil niestandardowy na jednym z domyślnych profili aplikacji, który określa podstawowe ustawienia, takie jak domyślna widoczność widgetów i jednostek prędkości i odległości. Są to domyślne profile aplikacji, wraz z przykładami profili niestandardowych, które można rozszerzyć na:</string>
<string name="profile_alert_delete_msg">Usunąć profil %s\?</string>
<string name="select_base_profile_dialog_title">Wybór profilu bazowego</string>
<string name="select_base_profile_dialog_message">Profil dostosowany można oprzeć na jednym z domyślnych profili aplikacji. Określają one podstawowe ustawienia, takie jak domyślna widoczność widżetów i jednostek prędkości i odległości. Są to domyślne profile aplikacji, wraz z przykładami profili dostosowanych, które można rozszerzyć na:</string>
<string name="select_nav_profile_dialog_title">Wybierz typ nawigacji</string>
<string name="base_profile_descr_car">Samochód, ciężarówka, motocykl</string>
<string name="base_profile_descr_bicycle">Rower górski, motorower, koń</string>
<string name="base_profile_descr_pedestrian">Spacer, wędrówka piesza, bieganie</string>
<string name="base_profile_descr_public_transport">Wszystkie typy PT</string>
<string name="base_profile_descr_public_transport">Wszystkie rodzaje transportu publicznego</string>
<string name="base_profile_descr_boat">Statek, wioślarstwo, żeglarstwo</string>
<string name="base_profile_descr_aircraft">Samolot, szybownictwo</string>
<string name="routing_profile_geocoding">Geokodowanie</string>
@ -3111,7 +3111,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="osmand_default_routing">OsmAnd trasa</string>
<string name="custom_routing">Niestandardowy profil routingu</string>
<string name="special_routing_type">Wyznaczanie tras specjalnych</string>
<string name="application_profiles_descr">Wybierz profile, które mają być widoczne w aplikacji.</string>
<string name="application_profiles_descr">Wybiera profile widoczne w aplikacji.</string>
<string name="application_profiles">Profile aplikacji</string>
<string name="zoom_by_wunderlinq_descr">Zmień powiększenie mapy, pokręć kółkiem w górę i w dół. Escape powraca do aplikacji WunderLINQ.</string>
<string name="zoom_by_wunderlinq">Użyj WunderLINQ do kontroli</string>
@ -3158,15 +3158,15 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="precision_hdop">Precyzja w poziomie: %s</string>
<string name="app_mode_offroad">off-road</string>
<string name="edit_profile_setup_subtitle">Profil zachowa własne ustawienia</string>
<string name="edit_profile_setup_map_subtitle">Wybierz domyślne opcje mapy dla profilu</string>
<string name="edit_profile_screen_options_subtitle">Wybierz domyślne opcje ekranu dla profilu</string>
<string name="edit_profile_nav_settings_subtitle">Wybierz domyślne ustawienia nawigacji dla profilu</string>
<string name="edit_profile_setup_map_subtitle">Wybiera domyślne opcje mapy dla profilu</string>
<string name="edit_profile_screen_options_subtitle">Wybiera domyślne opcje ekranu dla profilu</string>
<string name="edit_profile_nav_settings_subtitle">Wybiera domyślne ustawienia nawigacji dla profilu</string>
<string name="routing_attr_max_num_changes_description">Określ maksymalną liczbę zmian</string>
<string name="routing_attr_max_num_changes_name">Liczba zmian</string>
<string name="turn_screen_on_router">Przebudzaj przed zakrętem</string>
<string name="turn_screen_on_time_descr">Ustaw czas, przez który ekran zostanie włączony.</string>
<string name="turn_screen_on_sensor">Użyj czujnika bliskości</string>
<string name="turn_screen_on_sensor_descr">Pomachaj ręką nad górną częścią ekranu, aby włączyć ekran podczas nawigacji.</string>
<string name="turn_screen_on_sensor_descr">Umożliwia włączenie ekran podczas nawigacji machając nad nim ręką.</string>
<string name="external_input_device">Zewnętrzne urządzenia wejściowe</string>
<string name="external_input_device_descr">Wybierz urządzenie takie jak zwykła klawiatura lub WundeRLINQ do sterowania zewnętrznego.</string>
<string name="sett_no_ext_input">Brak</string>
@ -3185,7 +3185,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="routeInfo_tracktype_name">Trwałość powierzchni</string>
<string name="shared_string_file_is_saved">Zapisano %s</string>
<string name="shared_string_open_track">Otwórz ślad</string>
<string name="shared_string_track_is_saved">Ślad %s jest zapisany</string>
<string name="shared_string_track_is_saved">Zapisano ślad %s</string>
<string name="release_3_4">• Profile aplikacji: Stwórz własny profil dla własnych potrzeb, z niestandardową ikoną i kolorem
\n
\n• Teraz można dostosować domyślne ustawienia dowolnego profilu i prędkości min/max
@ -3215,9 +3215,9 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="rendering_attr_highway_class_track_grade5_name">Klasa 5</string>
<string name="app_mode_camper">Kamper</string>
<string name="app_mode_campervan">Samochód kempingowy</string>
<string name="rendering_attr_showLez_description">Pokaż strefy niskiej emisji na mapie. Nie ma to wpływu na przebieg trasy.</string>
<string name="rendering_attr_showLez_name">Pokaż strefy niskiej emisji</string>
<string name="temporary_conditional_routing">Rozważ tymczasowe ograniczenia</string>
<string name="rendering_attr_showLez_description">Wyświetl strefy niskiej emisji na mapie. Nie ma to wpływu na przebieg trasy.</string>
<string name="rendering_attr_showLez_name">Wyświetl strefy niskiej emisji</string>
<string name="temporary_conditional_routing">Rozpatrywanie tymczasowych ograniczeń</string>
<string name="third_party_routing_type">Wyznaczanie tras przez inne osoby</string>
<string name="app_mode_monowheel">Monocykl</string>
<string name="shared_string_default">Domyślnie</string>
@ -3230,7 +3230,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="days_5">Dni</string>
<string name="week">Tydzień</string>
<string name="weeks_2_4">Tygodnie</string>
<string name="weeks_5">Tygodnie</string>
<string name="weeks_5">Tygodni</string>
<string name="month">Miesiąc</string>
<string name="year">Rok</string>
<string name="months_3">Trzy miesiące</string>

View file

@ -2226,7 +2226,7 @@
<string name="poi_product_beer">Produto: cerveja</string>
<string name="poi_product_charcoal">Produto: carvão vegetal</string>
<string name="poi_product_meat">Produto: carne</string>
<string name="poi_wheelchair_description">Descrição para usuários cadeirantes</string>
<string name="poi_wheelchair_description">Descrição para utilizadores cadeirantes</string>
<string name="poi_blind_description">Descrição para cegos</string>
<string name="poi_deaf_description">Descrição para surdos</string>
<string name="poi_highway_steps">Escadas</string>

View file

@ -3236,4 +3236,5 @@
<string name="price_and_discount">%1$s - Poupe %2$s</string>
<string name="get_discount_first_part">%1$s para o primeiro %2$s</string>
<string name="get_discount_first_few_part">%1$s para o primeiro %2$s</string>
<string name="gpx_join_gaps">Mesclar espaços</string>
</resources>

View file

@ -702,7 +702,7 @@
<string name="where_am_i">Где я?</string>
<string name="network_provider">Сеть</string>
<string name="gps_provider">GPS</string>
<string name="int_seconds">секунд</string>
<string name="int_seconds">секунды</string>
<string name="int_min">мин.</string>
<string name="background_service_int_descr">Выберите интервал пробуждения для фоновой службы.</string>
<string name="background_service_int">Интервал пробуждения GPS</string>
@ -2671,7 +2671,7 @@
<string name="shared_string_marker">Маркер</string>
<string name="shared_string_without_name">Без имени</string>
<string name="lang_lo">Лаосский</string>
<string name="day_off_label">вых.</string>
<string name="day_off_label">выкл</string>
<string name="winter_and_ski_renderer">Зимний/лыжный</string>
<string name="touring_view_renderer">Туристический</string>
<string name="nautical_renderer">Морской</string>

View file

@ -993,7 +993,7 @@
<string name="poi_trees_mango">Манго</string>
<string name="poi_trees_rubber">Каучук</string>
<string name="poi_trees_date">Датула</string>
<string name="poi_trees_coffea">Кафа</string>
<string name="poi_trees_coffea">Дрво кафе</string>
<string name="poi_trees_pomegranate">Нар</string>
<string name="poi_urban">Урбано</string>
<string name="poi_rural">Рурално</string>
@ -1315,7 +1315,7 @@
<string name="poi_vending_bread">Хлеб</string>
<string name="poi_vending_chewing_gums">Жвакаће гуме</string>
<string name="poi_vending_parking_tickets_public_transport_tickets">Карте за паркирање; карте за јавни превоз</string>
<string name="poi_vending_coffee">Кафа</string>
<string name="poi_vending_coffee">Кафе апарат</string>
<string name="poi_vending_toll">Аутомат за путарину</string>
<string name="poi_vending_tickets">Аутомат за карте</string>
<string name="poi_vending_water">Аутомат за воду</string>
@ -2356,4 +2356,144 @@
<string name="poi_fitness_centre">Теретана</string>
<string name="poi_fitness">Фитнес</string>
<string name="poi_car_wash_yes">Да</string>
<string name="poi_cuisine">Тип кухиње</string>
<string name="poi_cuisine_pizza">Пице</string>
<string name="poi_cuisine_burger">Пљескавице</string>
<string name="poi_cuisine_coffee">Кафа</string>
<string name="poi_cuisine_sandwich">Сендвичи</string>
<string name="poi_cuisine_kebab">Кебаб</string>
<string name="poi_cuisine_doner">Донер кебаб (шавурма)</string>
<string name="poi_cuisine_chicken">Пилетина</string>
<string name="poi_cuisine_ice_cream">Сладолед</string>
<string name="poi_cuisine_sushi">Суши</string>
<string name="poi_cuisine_seafood">Плодови мора</string>
<string name="poi_cuisine_barbecue">Роштиљ</string>
<string name="poi_cuisine_noodle">Нудле</string>
<string name="poi_cuisine_donut">Крофне</string>
<string name="poi_cuisine_ramen">Рамен</string>
<string name="poi_cuisine_crepe">Палачинке</string>
<string name="poi_cuisine_breakfast">Доручак</string>
<string name="poi_cuisine_steak">Шницле</string>
<string name="poi_cuisine_tapas">Тапас</string>
<string name="poi_cuisine_curry">Кари</string>
<string name="poi_cuisine_grill">Грил</string>
<string name="poi_cuisine_diner">Вечера</string>
<string name="poi_cuisine_sausage">Кобасице</string>
<string name="poi_cuisine_cake">Торте</string>
<string name="poi_cuisine_pancake">Америчке палачинке</string>
<string name="poi_cuisine_pasta">Тестенине</string>
<string name="poi_cuisine_fast_food">Брза храна</string>
<string name="poi_cuisine_juice">Сокови</string>
<string name="poi_cuisine_tea">Чај</string>
<string name="poi_cuisine_tea_shop">Продавница чаја</string>
<string name="poi_cuisine_soup">Супе</string>
<string name="poi_cuisine_pie">Пите</string>
<string name="poi_cuisine_hotdog">Хотдог</string>
<string name="poi_cuisine_salad">Салате</string>
<string name="poi_cuisine_fried_food">Пржена храна</string>
<string name="poi_cuisine_bistro">Бистро</string>
<string name="poi_cuisine_bakery">Пекара</string>
<string name="poi_cuisine_couscous">Кускус</string>
<string name="poi_cuisine_fried_chicken">Пржена пилетина</string>
<string name="poi_cuisine_dessert">Дезерти</string>
<string name="poi_cuisine_tacos">Такоси</string>
<string name="poi_cuisine_falafel">Фалафел</string>
<string name="poi_cuisine_smoothie">Смути</string>
<string name="poi_cuisine_souvlaki">Сувлаки</string>
<string name="poi_cuisine_yogurt">Јогурт</string>
<string name="poi_cuisine_gyros">Гирос</string>
<string name="poi_cuisine_crepes">Палачинке</string>
<string name="poi_cuisine_yakiniku">Јакинику</string>
<string name="poi_cuisine_suki">Суки</string>
<string name="poi_cuisine_udon">Удон</string>
<string name="poi_cuisine_yakitori">Јакотори</string>
<string name="poi_cuisine_meat">Месо</string>
<string name="poi_cuisine_wings">Крилца</string>
<string name="poi_cuisine_waffle">Вафле</string>
<string name="poi_cuisine_chocolate">Чоколада</string>
<string name="poi_cuisine_wine">Вино</string>
<string name="poi_cuisine_potato">Кромпир</string>
<string name="poi_cuisine_brunch">Бранч</string>
<string name="poi_cuisine_pita">Пита</string>
<string name="poi_cuisine_fondue">Фанду</string>
<string name="poi_cuisine_baguette">Багети</string>
<string name="poi_cuisine_burrito">Буритоси</string>
<string name="poi_cuisine_teriyaki">Теријаки</string>
<string name="poi_cuisine_shawarma">Шавурма</string>
<string name="poi_cuisine_regional">Регионална</string>
<string name="poi_cuisine_italian">Италијанска</string>
<string name="poi_cuisine_chinese">Кинеска</string>
<string name="poi_cuisine_mexican">Мексичка</string>
<string name="poi_cuisine_japanese">Јапанска</string>
<string name="poi_cuisine_german">Немачка</string>
<string name="poi_cuisine_indian">Индијска</string>
<string name="poi_cuisine_american">Америчка</string>
<string name="poi_cuisine_asian">Азијска</string>
<string name="poi_cuisine_french">Француска</string>
<string name="poi_cuisine_greek">Грчка</string>
<string name="poi_cuisine_thai">Тајландска</string>
<string name="poi_cuisine_international">Интернационална</string>
<string name="poi_cuisine_turkish">Турска</string>
<string name="poi_cuisine_spanish">Шпанска</string>
<string name="poi_cuisine_vietnamese">Вијетнамска</string>
<string name="poi_cuisine_korean">Корејска</string>
<string name="poi_cuisine_mediterranean">Медитеранска</string>
<string name="poi_cuisine_bavarian">Баварска</string>
<string name="poi_cuisine_lebanese">Либанска</string>
<string name="poi_cuisine_russian">Руска</string>
<string name="poi_cuisine_filipino">Филипинска</string>
<string name="poi_cuisine_portuguese">Португалска</string>
<string name="poi_cuisine_georgian">Грузијска</string>
<string name="poi_cuisine_polish">Пољска</string>
<string name="poi_cuisine_brazilian">Бразилска</string>
<string name="poi_cuisine_arab">Арапска</string>
<string name="poi_cuisine_danish">Данска</string>
<string name="poi_cuisine_indonesian">Индонежанска</string>
<string name="poi_cuisine_african">Афричка</string>
<string name="poi_cuisine_caribbean">Карипска</string>
<string name="poi_cuisine_argentinian">Аргентинска</string>
<string name="poi_cuisine_balkan">Балканска</string>
<string name="poi_cuisine_peruvian">Перуанска</string>
<string name="poi_cuisine_croatian">Хрватска</string>
<string name="poi_cuisine_bolivian">Боливијска</string>
<string name="poi_cuisine_malagasy">Малагашка</string>
<string name="poi_cuisine_persian">Персијска</string>
<string name="poi_cuisine_moroccan">Мароканска</string>
<string name="poi_cuisine_austrian">Аустријска</string>
<string name="poi_cuisine_malaysian">Малезијска</string>
<string name="poi_cuisine_irish">Ирска</string>
<string name="poi_cuisine_ethiopian">Етиопијска</string>
<string name="poi_cuisine_hungarian">Мађарска</string>
<string name="poi_cuisine_lao">Лаоска</string>
<string name="poi_cuisine_european">Европска</string>
<string name="poi_cuisine_uzbek">Узбекистанска</string>
<string name="poi_cuisine_czech">Чешка</string>
<string name="poi_cuisine_cuban">Кубанска</string>
<string name="poi_cuisine_british">Британска</string>
<string name="poi_cuisine_latin_american">Латиноамеричка</string>
<string name="poi_cuisine_nepalese">Непалска</string>
<string name="poi_cuisine_mongolian">Монголска</string>
<string name="poi_cuisine_middle_eastern">Блискоисточна</string>
<string name="poi_cuisine_ukrainian">Украјинска</string>
<string name="poi_cuisine_afghan">Авганистанска</string>
<string name="poi_cuisine_belgian">Белгијска</string>
<string name="poi_cuisine_basque">Баскијска</string>
<string name="poi_cuisine_swiss">Швајцарска</string>
<string name="poi_cuisine_swedish">Шведска</string>
<string name="poi_cuisine_jamaican">Јамајчанска</string>
<string name="poi_cuisine_armenian">Јерменска</string>
<string name="poi_cuisine_hawaiian">Хавајска</string>
<string name="poi_cuisine_english">Енглеска</string>
<string name="poi_cuisine_pakistani">Пакистанска</string>
<string name="poi_cuisine_taiwanese">Тајванска</string>
<string name="poi_cuisine_tex_mex">Текс-мекс</string>
<string name="poi_cuisine_dutch">Холандска</string>
<string name="poi_cuisine_syrian">Сиријска</string>
<string name="poi_cuisine_australian">Аустралијанска</string>
<string name="poi_cuisine_cajun">Каџун</string>
<string name="poi_cuisine_egyptian">Египатска</string>
<string name="poi_cuisine_senegalese">Сенегалска</string>
<string name="poi_cuisine_jewish">Јеврејска</string>
<string name="poi_cuisine_bulgarian">Бугарска</string>
<string name="poi_cuisine_tibetan">Тибетанска</string>
</resources>

View file

@ -423,6 +423,8 @@
<color name="text_field_box_dark">#3F474B</color>
<color name="text_field_box_light">#eeeeee</color>
<color name="preference_category_title">#7E33FF</color>
<!-- Basic colors -->
<color name="app_bar_main_dark">#101112</color>
<color name="app_bar_main_light">#ff8800</color>

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="application_profile_changed">Application profile changed to \"%s\"</string>
<string name="switch_profile">Switch profile</string>
<string name="configure_profile">Configure profile</string>

View file

@ -264,6 +264,7 @@
<item name="buttonBarNeutralButtonStyle">@style/DialogButtonStyleLight</item>
<item name="colorBackgroundFloating">@color/list_background_color_light</item>
<item name="android:colorBackgroundFloating">@color/list_background_color_light</item>
<item name="preferenceTheme">@style/OsmandPreferenceTheme</item>
</style>
<style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow">
@ -526,6 +527,7 @@
<item name="buttonBarNeutralButtonStyle">@style/DialogButtonStyleDark</item>
<item name="colorBackgroundFloating">@color/list_background_color_dark</item>
<item name="android:colorBackgroundFloating">@color/list_background_color_dark</item>
<item name="preferenceTheme">@style/OsmandPreferenceTheme</item>
</style>
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
@ -548,6 +550,10 @@
<item name="android:textColor">@color/active_color_primary_dark</item>
</style>
<style name="OsmandPreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">
<item name="android:layout">@layout/pref_screen</item>
</style>
<!-- Standard action bar override -->
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@color/app_bar_color_dark</item>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<Preference
android:key="configure_profile_info"
android:layout="@layout/preference_info_descr"
android:persistent="false"
android:selectable="false"
android:title="@string/configure_profile_info" />
<Preference
android:key="general_settings"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:summary="@string/general_settings_profile_descr"
android:title="@string/general_settings_2"
app:fragment="net.osmand.plus.settings.GeneralProfileSettingsFragment"
tools:icon="@drawable/ic_action_settings" />
<Preference
android:key="navigation_settings"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:summary="@string/configure_navigation"
android:title="@string/routing_settings_2"
app:fragment="net.osmand.plus.settings.NavigationFragment"
tools:icon="@drawable/ic_action_gdirections_dark" />
<Preference
android:key="configure_map"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:summary="@string/map_look_descr"
android:title="@string/configure_map"
tools:icon="@drawable/ic_action_layers_dark" />
<PreferenceCategory
android:key="plugin_settings"
android:layout="@layout/preference_category_with_descr"
android:summary="@string/list_of_installed_plugins"
android:title="@string/plugin_settings" />
</PreferenceScreen>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<Preference
android:key="coordinates_format_info"
android:layout="@layout/preference_info"
android:order="0"
android:persistent="false"
android:selectable="false"
android:title="@string/coordinates_format_info"
tools:icon="@drawable/ic_action_info_dark" />
<CheckBoxPreference
android:key="format_degrees"
android:layout="@layout/preference_radio_button"
android:order="1"
android:persistent="false"
android:title="@string/navigate_point_format_D" />
<CheckBoxPreference
android:key="format_minutes"
android:layout="@layout/preference_radio_button"
android:order="2"
android:persistent="false"
android:title="@string/navigate_point_format_DM" />
<CheckBoxPreference
android:key="format_seconds"
android:layout="@layout/preference_radio_button"
android:order="3"
android:persistent="false"
android:title="@string/navigate_point_format_DMS" />
<!-- This pref added in code -->
<!-- <CheckBoxPreference-->
<!-- android:key="utm_format"-->
<!-- android:layout="@layout/preference_radio_button"-->
<!-- android:persistent="false"-->
<!-- android:title="@string/navigate_point_format_utm" />-->
<CheckBoxPreference
android:key="olc_format"
android:layout="@layout/preference_radio_button"
android:order="5"
android:persistent="false"
android:title="@string/navigate_point_format_olc" />
</PreferenceScreen>

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="appearance_category"
android:layout="@layout/preference_category_with_descr"
android:title="@string/appearance" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="osmand_theme"
android:layout="@layout/preference_with_descr"
android:title="@string/choose_osmand_theme" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="rotate_map"
android:layout="@layout/preference_with_descr"
android:title="@string/rotate_map_to_bearing" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="map_screen_orientation"
android:layout="@layout/preference_with_descr"
android:title="@string/map_screen_orientation" />
<PreferenceCategory
android:key="units_and_formats"
android:layout="@layout/preference_category_with_descr"
android:title="@string/units_and_formats" />
<Preference
android:key="default_driving_region"
android:layout="@layout/preference_with_descr"
android:title="@string/driving_region" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="default_metric_system"
android:layout="@layout/preference_with_descr"
android:title="@string/unit_of_length" />
<Preference
android:key="coordinates_format"
android:layout="@layout/preference_with_descr"
android:title="@string/coords_format"
app:fragment="net.osmand.plus.settings.CoordinatesFormatFragment" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="angular_measurement"
android:layout="@layout/preference_with_descr"
android:title="@string/angular_measeurement" />
<PreferenceCategory
android:key="other"
android:layout="@layout/preference_category_with_descr"
android:title="@string/shared_string_other" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="use_kalman_filter_compass"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/use_kalman_filter_compass" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="use_magnetic_field_sensor_compass"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/use_magnetic_sensor" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="map_empty_state_allowed"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/tap_on_map_to_hide_interface" />
<SwitchPreference
android:key="do_not_use_animations"
android:layout="@layout/preference_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/do_not_use_animations" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="external_input_device"
android:layout="@layout/preference_dialog_and_switch"
android:title="@string/external_input_device" />
</PreferenceScreen>

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:icon="@drawable/ic_world_globe_dark"
android:key="default_application_mode_string"
android:layout="@layout/preference_with_descr"
android:title="@string/settings_preset" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:icon="@drawable/ic_action_map_language"
android:key="preferred_locale"
android:layout="@layout/preference_with_descr"
android:title="@string/preferred_locale" />
<!-- <Preference-->
<!-- android:icon="@drawable/ic_action_folder"-->
<!-- android:key="external_storage_dir"-->
<!-- android:layout="@layout/preference_with_descr"-->
<!-- android:persistent="false"-->
<!-- android:title="@string/application_dir" />-->
<PreferenceCategory
android:key="privacy_and_security"
android:layout="@layout/preference_category_with_descr"
android:title="@string/application_profiles" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:icon="@drawable/ic_action_privacy_and_security"
android:key="send_anonymous_data"
android:layout="@layout/preference_dialog_and_switch"
android:persistent="false"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/analytics_pref_title" />
<SwitchPreference
android:icon="@drawable/ic_action_notification"
android:key="do_not_show_startup_messages"
android:layout="@layout/preference_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/start_up_message_pref" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="enable_proxy"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/proxy_pref_title"
app:fragment="net.osmand.plus.settings.ProxySettingsFragment"
tools:icon="@drawable/ic_action_proxy" />
</PreferenceScreen>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:key="map_during_navigation_info"
android:layout="@layout/preference_info"
android:selectable="false"
android:title="@string/map_during_navigation_info" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="auto_follow_route"
android:layout="@layout/preference_with_descr"
android:title="@string/choose_auto_follow_route" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="auto_zoom_map_on_off"
android:layout="@layout/preference_with_descr"
android:title="@string/auto_zoom_map" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="snap_to_road"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/snap_to_road" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="speed_for_map_to_direction_of_movement"
android:layout="@layout/preference_with_descr"
android:title="@string/map_orientation_change_in_accordance_with_speed" />
</PreferenceScreen>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<Preference
android:key="route_parameters"
android:layout="@layout/preference_with_descr"
android:summary="@string/route_parameters_descr"
android:title="@string/route_parameters"
app:fragment="net.osmand.plus.settings.RouteParametersFragment"
tools:icon="@drawable/ic_action_route_distance" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="show_routing_alarms"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/screen_alerts"
app:fragment="net.osmand.plus.settings.ScreenAlertsFragment"
tools:icon="@drawable/ic_action_alert" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="speak_routing_alarms"
android:layout="@layout/preference_dialog_and_switch"
android:summary="@string/voice_announces_descr"
android:title="@string/voice_announces"
app:fragment="net.osmand.plus.settings.VoiceAnnouncesFragment"
tools:icon="@drawable/ic_action_volume_up" />
<Preference
android:key="vehicle_parameters"
android:layout="@layout/preference_with_descr"
android:summary="@string/vehicle_parameters_descr"
android:title="@string/vehicle_parameters"
app:fragment="net.osmand.plus.settings.VehicleParametersFragment"
tools:icon="@drawable/ic_action_car_dark" />
<PreferenceCategory
android:key="other"
android:layout="@layout/preference_category_with_descr"
android:title="@string/shared_string_other" />
<Preference
android:key="map_during_navigation"
android:layout="@layout/preference_with_descr"
android:title="@string/map_during_navigation"
app:fragment="net.osmand.plus.settings.MapDuringNavigationFragment" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="turn_screen_on_enabled"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/turn_screen_on"
app:fragment="net.osmand.plus.settings.TurnScreenOnFragment"
tools:icon="@drawable/ic_action_turn_screen_on" />
</PreferenceScreen>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:description="@string/proxy_pref_descr"
android:key="proxy"
android:title="@string/proxy_pref_title">
<SwitchPreference
android:key="enable_proxy"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" />
<Preference
android:key="proxy_preferences_info"
android:layout="@layout/preference_info"
android:persistent="false"
android:selectable="false"
android:title="@string/enable_proxy_descr"
tools:icon="@drawable/ic_action_info_dark" />
<net.osmand.plus.settings.preferences.EditTextPreferenceEx
android:dependency="enable_proxy"
android:key="proxy_host"
android:summary="@string/proxy_host_descr"
android:title="@string/proxy_host_title" />
<net.osmand.plus.settings.preferences.EditTextPreferenceEx
android:dependency="enable_proxy"
android:key="proxy_port"
android:summary="@string/proxy_port_descr"
android:title="@string/proxy_port_title" />
</PreferenceScreen>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<Preference
android:key="route_parameters_info"
android:layout="@layout/preference_info"
android:persistent="false"
android:selectable="false"
tools:title="@string/route_parameters_info" />
</PreferenceScreen>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<SwitchPreference
android:key="show_routing_alarms"
android:layout="@layout/preference_top_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" />
<Preference
android:key="show_routing_alarms_info"
android:layout="@layout/preference_info"
android:selectable="false"
android:title="@string/screen_alerts_descr"
tools:icon="@drawable/ic_action_info_dark" />
<SwitchPreference
android:dependency="show_routing_alarms"
android:key="show_traffic_warnings"
android:layout="@layout/preference_switch"
android:title="@string/show_traffic_warnings" />
<SwitchPreference
android:dependency="show_routing_alarms"
android:key="show_pedestrian"
android:layout="@layout/preference_switch"
android:title="@string/show_pedestrian_warnings" />
<SwitchPreference
android:dependency="show_routing_alarms"
android:key="show_cameras"
android:layout="@layout/preference_switch"
android:title="@string/show_cameras" />
<SwitchPreference
android:dependency="show_routing_alarms"
android:key="show_tunnels"
android:layout="@layout/preference_switch"
android:title="@string/show_tunnels" />
</PreferenceScreen>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<Preference
android:key="global_settings"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:summary="@string/osmand_settings_descr"
android:title="@string/osmand_settings"
app:fragment="net.osmand.plus.settings.GlobalSettingsFragment"
tools:icon="@drawable/ic_action_settings" />
<PreferenceCategory
android:key="application_profiles"
android:layout="@layout/preference_category_with_descr"
android:title="@string/application_profiles" />
<Preference
android:key="configure_profile"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:title="@string/configure_profile"
app:fragment="net.osmand.plus.settings.ConfigureProfileFragment"
tools:icon="@drawable/ic_action_car_dark" />
<Preference
android:key="manage_profiles"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:summary="@string/manage_profiles_descr"
android:title="@string/manage_profiles"
tools:icon="@drawable/ic_action_manage_profiles" />
</PreferenceScreen>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:key="turn_screen_on_enabled"
android:layout="@layout/preference_top_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" />
<Preference
android:key="turn_screen_on_info"
android:layout="@layout/preference_info"
android:persistent="false"
android:selectable="false"
android:title="@string/turn_screen_on_info" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:dependency="turn_screen_on_enabled"
android:key="turn_screen_on_time_int"
android:title="@string/wake_time" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:dependency="turn_screen_on_enabled"
android:key="turn_screen_on_sensor"
android:layout="@layout/preference_dialog_and_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/turn_screen_on_sensor" />
</PreferenceScreen>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<Preference
android:key="vehicle_parameters_info"
android:layout="@layout/preference_info"
android:persistent="false"
android:selectable="false"
tools:icon="@drawable/ic_action_info_dark"
tools:title="@string/route_parameters_info" />
</PreferenceScreen>

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<SwitchPreference
android:key="speak_routing_alarms"
android:layout="@layout/preference_top_switch"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" />
<Preference
android:key="voice_announces_info"
android:layout="@layout/preference_info"
android:persistent="false"
android:selectable="false"
android:title="@string/voice_announces_info"
tools:icon="@drawable/ic_action_info_dark" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="speak_street_names"
android:layout="@layout/preference_switch"
android:title="@string/speak_street_names" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="speak_traffic_warnings"
android:layout="@layout/preference_switch"
android:title="@string/speak_traffic_warnings" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="speak_pedestrian"
android:layout="@layout/preference_switch"
android:title="@string/speak_pedestrian" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="speak_speed_limit"
android:layout="@layout/preference_switch"
android:title="@string/speak_speed_limit" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:dependency="speak_routing_alarms"
android:key="speed_limit_exceed"
android:layout="@layout/preference_with_descr"
android:title="@string/speed_limit_exceed" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="speak_cameras"
android:layout="@layout/preference_switch"
android:title="@string/speak_cameras" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="speak_tunnels"
android:layout="@layout/preference_switch"
android:title="@string/show_tunnels" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="announce_wpt"
android:layout="@layout/preference_switch"
android:title="@string/shared_string_gpx_waypoints" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="announce_nearby_favorites"
android:layout="@layout/preference_switch"
android:title="@string/speak_favorites" />
<SwitchPreference
android:dependency="speak_routing_alarms"
android:key="announce_nearby_poi"
android:layout="@layout/preference_switch"
android:title="@string/speak_poi" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:dependency="speak_routing_alarms"
android:key="keep_informing"
android:layout="@layout/preference_with_descr"
android:title="@string/keep_informing" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:dependency="speak_routing_alarms"
android:key="arrival_distance_factor"
android:layout="@layout/preference_with_descr"
android:title="@string/arrival_distance" />
<PreferenceCategory
android:key="language_and_output"
android:layout="@layout/preference_category_with_descr"
android:title="@string/language_and_output" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:dependency="speak_routing_alarms"
android:key="voice_provider"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:title="@string/voice_provider"
tools:icon="@drawable/ic_action_volume_up" />
</PreferenceScreen>

View file

@ -32,7 +32,6 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.support.v4.text.TextUtilsCompat;
import android.support.v4.view.ViewCompat;
import android.text.ParcelableSpan;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@ -594,7 +593,7 @@ public class AndroidUtils {
}
if(replaceStyle != null) {
ssb.setSpan(replaceStyle, indexOfPlaceholder,
stringToInsertAndStyle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
indexOfPlaceholder + stringToInsertAndStyle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return ssb;
} else {

View file

@ -1792,6 +1792,16 @@ public class OsmandAidlApi {
app.getAppCustomization().registerNavDrawerItems(activity, adapter);
}
public ConnectedApp getConnectedApp(@NonNull String pack) {
List<ConnectedApp> connectedApps = getConnectedApps();
for (ConnectedApp app : connectedApps) {
if (app.pack.equals(pack)) {
return app;
}
}
return null;
}
public List<ConnectedApp> getConnectedApps() {
List<ConnectedApp> res = new ArrayList<>(connectedApps.size());
PackageManager pm = app.getPackageManager();
@ -1809,9 +1819,9 @@ public class OsmandAidlApi {
return res;
}
public void switchEnabled(@NonNull ConnectedApp app) {
public boolean switchEnabled(@NonNull ConnectedApp app) {
app.enabled = !app.enabled;
saveConnectedApps();
return saveConnectedApps();
}
boolean isAppEnabled(@NonNull String pack) {
@ -1824,7 +1834,7 @@ public class OsmandAidlApi {
return app.enabled;
}
private void saveConnectedApps() {
private boolean saveConnectedApps() {
try {
JSONArray array = new JSONArray();
for (ConnectedApp app : connectedApps.values()) {
@ -1833,13 +1843,14 @@ public class OsmandAidlApi {
obj.put(ConnectedApp.PACK_KEY, app.pack);
array.put(obj);
}
app.getSettings().API_CONNECTED_APPS_JSON.set(array.toString());
return app.getSettings().API_CONNECTED_APPS_JSON.set(array.toString());
} catch (JSONException e) {
e.printStackTrace();
}
return false;
}
private void loadConnectedApps() {
public void loadConnectedApps() {
try {
JSONArray array = new JSONArray(app.getSettings().API_CONNECTED_APPS_JSON.get());
for (int i = 0; i < array.length(); i++) {
@ -2281,6 +2292,10 @@ public class OsmandAidlApi {
return name;
}
public String getPack() {
return pack;
}
public Drawable getIcon() {
return icon;
}

View file

@ -16,15 +16,18 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.util.Pair;
import android.support.v7.preference.PreferenceDataStore;
import net.osmand.IndexConstants;
import net.osmand.StateChangedListener;
import net.osmand.ValueHolder;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.access.AccessibilityMode;
import net.osmand.plus.access.RelativeDirectionStyle;
import net.osmand.plus.api.SettingsAPI;
@ -35,6 +38,7 @@ import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.mapillary.MapillaryPlugin;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.voice.CommandPlayer;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms;
@ -128,6 +132,7 @@ public class OsmandSettings {
/// Settings variables
private final OsmandApplication ctx;
private PreferencesDataStore dataStore;
private SettingsAPI settingsAPI;
private Object globalPreferences;
private Object defaultProfilePreferences;
@ -144,6 +149,7 @@ public class OsmandSettings {
protected OsmandSettings(OsmandApplication clientContext, SettingsAPI settinsAPI) {
ctx = clientContext;
this.settingsAPI = settinsAPI;
dataStore = new PreferencesDataStore();
initPrefs();
}
@ -151,6 +157,7 @@ public class OsmandSettings {
ctx = clientContext;
this.settingsAPI = settinsAPI;
CUSTOM_SHARED_PREFERENCES_NAME = CUSTOM_SHARED_PREFERENCES_PREFIX + sharedPreferencesName;
dataStore = new PreferencesDataStore();
initPrefs();
setCustomized();
}
@ -182,6 +189,10 @@ public class OsmandSettings {
return settingsAPI;
}
public PreferencesDataStore getDataStore() {
return dataStore;
}
public static String getSharedPreferencesName(ApplicationMode mode) {
String sharedPreferencesName = !Algorithms.isEmpty(CUSTOM_SHARED_PREFERENCES_NAME) ? CUSTOM_SHARED_PREFERENCES_NAME : SHARED_PREFERENCES_NAME;
if (mode == null) {
@ -203,7 +214,16 @@ public class OsmandSettings {
return settingsAPI.getPreferenceObject(getSharedPreferencesName(mode));
}
public OsmandPreference getPreference(String key) {
return registeredPreferences.get(key);
}
public boolean setPreference(String key, Object value) {
return setPreference(key, value, APPLICATION_MODE.get());
}
@SuppressWarnings("unchecked")
public boolean setPreference(String key, Object value, ApplicationMode mode) {
OsmandPreference<?> preference = registeredPreferences.get(key);
if (preference != null) {
if (preference == APPLICATION_MODE) {
@ -225,54 +245,78 @@ public class OsmandSettings {
}
}
} else if (preference == METRIC_SYSTEM) {
MetricsConstants metricSystem = null;
if (value instanceof String) {
String metricSystemName = (String) value;
MetricsConstants metricSystem;
try {
metricSystem = MetricsConstants.valueOf(metricSystemName);
} catch (IllegalArgumentException e) {
return false;
}
} else if (value instanceof Integer) {
int index = (Integer) value;
if (index >= 0 && index < MetricsConstants.values().length) {
metricSystem = MetricsConstants.values()[index];
}
}
if (metricSystem != null) {
METRIC_SYSTEM.set(metricSystem);
return true;
}
} else if (preference == SPEED_SYSTEM) {
SpeedConstants speedSystem = null;
if (value instanceof String) {
String speedSystemName = (String) value;
SpeedConstants speedSystem;
try {
speedSystem = SpeedConstants.valueOf(speedSystemName);
} catch (IllegalArgumentException e) {
return false;
}
} else if (value instanceof Integer) {
int index = (Integer) value;
if (index >= 0 && index < SpeedConstants.values().length) {
speedSystem = SpeedConstants.values()[index];
}
}
if (speedSystem != null) {
SPEED_SYSTEM.set(speedSystem);
return true;
}
} else if (preference instanceof BooleanPreference) {
if (value instanceof Boolean) {
((BooleanPreference) preference).set((Boolean) value);
((BooleanPreference) preference).setModeValue(mode, (Boolean) value);
return true;
}
} else if (preference instanceof StringPreference) {
if (value instanceof String) {
((StringPreference) preference).set((String) value);
((StringPreference) preference).setModeValue(mode, (String) value);
return true;
}
} else if (preference instanceof FloatPreference) {
if (value instanceof Float) {
((FloatPreference) preference).set((Float) value);
((FloatPreference) preference).setModeValue(mode, (Float) value);
return true;
}
} else if (preference instanceof IntPreference) {
if (value instanceof Integer) {
((IntPreference) preference).set((Integer) value);
((IntPreference) preference).setModeValue(mode, (Integer) value);
return true;
}
} else if (preference instanceof LongPreference) {
if (value instanceof Long) {
((LongPreference) preference).set((Long) value);
((LongPreference) preference).setModeValue(mode, (Long) value);
return true;
}
} else if (preference instanceof EnumIntPreference) {
EnumIntPreference enumPref = (EnumIntPreference) preference;
if (value instanceof Integer) {
int newVal = (Integer) value;
if (enumPref.values.length > newVal) {
Enum enumValue = enumPref.values[newVal];
return enumPref.setModeValue(mode, enumValue);
}
return false;
}
}
}
return false;
@ -316,13 +360,20 @@ public class OsmandSettings {
@Override
public boolean set(ApplicationMode val) {
ApplicationMode oldMode = currentMode;
boolean changed = settingsAPI.edit(globalPreferences).putString(getId(), val.getStringKey()).commit();
if (changed) {
boolean valueSaved = settingsAPI.edit(globalPreferences).putString(getId(), val.getStringKey()).commit();
if (valueSaved) {
currentMode = val;
profilePreferences = getProfilePreferences(currentMode);
OsmandAidlApi aidlApi = ctx.getAidlApi();
if (aidlApi != null) {
aidlApi.loadConnectedApps();
OsmandPlugin.initPlugins(ctx);
}
fireEvent(oldMode);
}
return changed;
return valueSaved;
}
@Override
@ -442,9 +493,15 @@ public class OsmandSettings {
if (global) {
return set(obj);
}
boolean ch = setValue(getProfilePreferences(mode), obj);
Object profilePrefs = getProfilePreferences(mode);
boolean valueSaved = setValue(profilePrefs, obj);
if (valueSaved && cache && cachedPreference == profilePrefs) {
cachedValue = obj;
}
fireEvent(obj);
return ch;
return valueSaved;
}
public T getProfileDefaultValue(ApplicationMode mode) {
@ -527,7 +584,7 @@ public class OsmandSettings {
}
private class BooleanPreference extends CommonPreference<Boolean> {
public class BooleanPreference extends CommonPreference<Boolean> {
private BooleanPreference(String id, boolean defaultValue) {
@ -623,7 +680,7 @@ public class OsmandSettings {
}
private class StringPreference extends CommonPreference<String> {
public class StringPreference extends CommonPreference<String> {
private StringPreference(String id, String defaultValue) {
super(id, defaultValue);
@ -694,7 +751,7 @@ public class OsmandSettings {
}
private class EnumIntPreference<E extends Enum<E>> extends CommonPreference<E> {
public class EnumIntPreference<E extends Enum<E>> extends CommonPreference<E> {
private final E[] values;
@ -728,7 +785,7 @@ public class OsmandSettings {
public static final String NUMBER_OF_FREE_DOWNLOADS_ID = "free_downloads_v3";
// this value string is synchronized with settings_pref.xml preference name
private final OsmandPreference<String> PLUGINS = new StringPreference("enabled_plugins", MapillaryPlugin.ID).makeGlobal();
private final OsmandPreference<String> PLUGINS = new StringPreference("enabled_plugins", MapillaryPlugin.ID).makeProfile();
public Set<String> getEnabledPlugins() {
String plugs = PLUGINS.get();
@ -860,7 +917,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SHOW_OSMAND_WELCOME_SCREEN = new BooleanPreference("show_osmand_welcome_screen", true).makeGlobal();
public final CommonPreference<String> API_NAV_DRAWER_ITEMS_JSON = new StringPreference("api_nav_drawer_items_json", "{}").makeGlobal();
public final CommonPreference<String> API_CONNECTED_APPS_JSON = new StringPreference("api_connected_apps_json", "[]").makeGlobal();
public final CommonPreference<String> API_CONNECTED_APPS_JSON = new StringPreference("api_connected_apps_json", "[]").makeProfile();
public final CommonPreference<Integer> NUMBER_OF_STARTS_FIRST_XMAS_SHOWN = new IntPreference("number_of_starts_first_xmas_shown", 0).makeGlobal();
@ -885,7 +942,12 @@ public class OsmandSettings {
@Override
protected boolean setValue(Object prefs, ApplicationMode val) {
return settingsAPI.edit(prefs).putString(getId(), val.getStringKey()).commit();
boolean valueSaved = settingsAPI.edit(prefs).putString(getId(), val.getStringKey()).commit();
if (valueSaved) {
APPLICATION_MODE.set(val);
}
return valueSaved;
}
};
@ -909,7 +971,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> FIRST_MAP_IS_DOWNLOADED = new BooleanPreference(
"first_map_is_downloaded", false);
public final CommonPreference<Boolean> DRIVING_REGION_AUTOMATIC = new BooleanPreference("driving_region_automatic", true).makeGlobal().cache();
public final CommonPreference<Boolean> DRIVING_REGION_AUTOMATIC = new BooleanPreference("driving_region_automatic", true).makeProfile().cache();
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumIntPreference<DrivingRegion>(
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
protected boolean setValue(Object prefs, DrivingRegion val) {
@ -941,8 +1003,7 @@ public class OsmandSettings {
return DrivingRegion.EUROPE_ASIA;
}
;
}.makeGlobal().cache();
}.makeProfile().cache();
public final CommonPreference<Boolean> METRIC_SYSTEM_CHANGED_MANUALLY = new BooleanPreference("metric_system_changed_manually", false).makeGlobal();
@ -954,8 +1015,7 @@ public class OsmandSettings {
return DRIVING_REGION.get().defMetrics;
}
;
}.makeGlobal();
}.makeProfile();
//public final OsmandPreference<Integer> COORDINATES_FORMAT = new IntPreference("coordinates_format", PointDescription.FORMAT_DEGREES).makeGlobal();
@ -965,8 +1025,7 @@ public class OsmandSettings {
protected AngularConstants getValue(Object prefs, AngularConstants defaultValue) {
return super.getValue(prefs, defaultValue);
}
}.makeGlobal();
}.makeProfile();
public final OsmandPreference<SpeedConstants> SPEED_SYSTEM = new EnumIntPreference<SpeedConstants>(
@ -1060,18 +1119,19 @@ public class OsmandSettings {
new BooleanAccessibilityPreference("direction_haptic_feedback", false).makeGlobal();
// magnetic field doesn'torkmost of the time on some phones
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeGlobal().cache();
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeGlobal().cache();
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeProfile().cache();
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeProfile().cache();
public final OsmandPreference<Boolean> DO_NOT_SHOW_STARTUP_MESSAGES = new BooleanPreference("do_not_show_startup_messages", false).makeGlobal().cache();
public final OsmandPreference<Boolean> DO_NOT_USE_ANIMATIONS = new BooleanPreference("do_not_use_animations", false).makeGlobal().cache();
public final OsmandPreference<Boolean> DO_NOT_USE_ANIMATIONS = new BooleanPreference("do_not_use_animations", false).makeProfile().cache();
public final OsmandPreference<Boolean> SEND_ANONYMOUS_MAP_DOWNLOADS_DATA = new BooleanPreference("send_anonymous_map_downloads_data", false).makeGlobal().cache();
public final OsmandPreference<Boolean> SEND_ANONYMOUS_APP_USAGE_DATA = new BooleanPreference("send_anonymous_app_usage_data", false).makeGlobal().cache();
public final OsmandPreference<Boolean> SEND_ANONYMOUS_DATA_REQUEST_PROCESSED = new BooleanPreference("send_anonymous_data_request_processed", false).makeGlobal().cache();
public final OsmandPreference<Integer> SEND_ANONYMOUS_DATA_REQUESTS_COUNT = new IntPreference("send_anonymous_data_requests_count", 0).makeGlobal().cache();
public final OsmandPreference<Integer> SEND_ANONYMOUS_DATA_LAST_REQUEST_NS = new IntPreference("send_anonymous_data_last_request_ns", -1).makeGlobal().cache();
public final OsmandPreference<Boolean> MAP_EMPTY_STATE_ALLOWED = new BooleanPreference("map_empty_state_allowed", true).makeGlobal().cache();
public final OsmandPreference<Boolean> MAP_EMPTY_STATE_ALLOWED = new BooleanPreference("map_empty_state_allowed", true).makeProfile().cache();
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache();
@ -1196,7 +1256,17 @@ public class OsmandSettings {
public final CommonPreference<Boolean> INTERRUPT_MUSIC = new BooleanPreference("interrupt_music", false).makeProfile();
public final CommonPreference<Boolean> ENABLE_PROXY = new BooleanPreference("enable_proxy", false).makeGlobal();
public final CommonPreference<Boolean> ENABLE_PROXY = new BooleanPreference("enable_proxy", false) {
@Override
protected boolean setValue(Object prefs, Boolean val) {
boolean valueSaved = super.setValue(prefs, val);
if (valueSaved) {
NetworkUtils.setProxy(val ? PROXY_HOST.get() : null, val ? PROXY_PORT.get() : 0);
}
return valueSaved;
}
}.makeGlobal();
public final CommonPreference<String> PROXY_HOST = new StringPreference("proxy_host", "127.0.0.1").makeGlobal();
public final CommonPreference<Integer> PROXY_PORT = new IntPreference("proxy_port", 8118).makeGlobal();
public final CommonPreference<String> USER_ANDROID_ID = new StringPreference("user_android_id", "").makeGlobal();
@ -1224,7 +1294,9 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile();
// dev version
public final CommonPreference<Boolean> DISABLE_COMPLEX_ROUTING = new BooleanPreference("disable_complex_routing", false).makeGlobal();
public final CommonPreference<Boolean> ENABLE_TIME_CONDITIONAL_ROUTING = new BooleanPreference("enable_time_conditional_routing", true).makeGlobal();
public final CommonPreference<Boolean> ENABLE_TIME_CONDITIONAL_ROUTING = new BooleanPreference("enable_time_conditional_routing", true).makeProfile();
public final CommonPreference<Boolean> SHOW_ROUTING_ALARMS = new BooleanPreference("show_routing_alarms", true).makeProfile().cache();
public final CommonPreference<Boolean> SHOW_TRAFFIC_WARNINGS = new BooleanPreference("show_traffic_warnings", false).makeProfile().cache();
@ -1256,6 +1328,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> SHOW_NEARBY_FAVORITES = new BooleanPreference("show_nearby_favorites", false).makeProfile().cache();
public final OsmandPreference<Boolean> SHOW_NEARBY_POI = new BooleanPreference("show_nearby_poi", false).makeProfile().cache();
public final OsmandPreference<Boolean> SPEAK_ROUTING_ALARMS = new BooleanPreference("speak_routing_alarms", true).makeProfile().cache();
public final OsmandPreference<Boolean> SPEAK_STREET_NAMES = new BooleanPreference("speak_street_names", true).makeProfile().cache();
public final CommonPreference<Boolean> SPEAK_TRAFFIC_WARNINGS = new BooleanPreference("speak_traffic_warnings", true).makeProfile().cache();
{
@ -1268,9 +1341,42 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> SPEAK_SPEED_LIMIT = new BooleanPreference("speak_speed_limit", false).makeProfile().cache();
public final OsmandPreference<Boolean> SPEAK_SPEED_CAMERA = new BooleanPreference("speak_cameras", false).makeProfile().cache();
public final OsmandPreference<Boolean> SPEAK_TUNNELS = new BooleanPreference("speak_tunnels", false).makeProfile().cache();
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true).makeGlobal().cache();
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_FAVORITES = new BooleanPreference("announce_nearby_favorites", false).makeProfile().cache();
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_POI = new BooleanPreference("announce_nearby_poi", false).makeProfile().cache();
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true) {
@Override
protected boolean setValue(Object prefs, Boolean val) {
boolean valueSaved = super.setValue(prefs, val);
if (valueSaved) {
SHOW_WPT.set(val);
}
return valueSaved;
}
}.makeProfile().cache();
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_FAVORITES = new BooleanPreference("announce_nearby_favorites", false) {
@Override
protected boolean setValue(Object prefs, Boolean val) {
boolean valueSaved = super.setValue(prefs, val);
if (valueSaved) {
SHOW_NEARBY_FAVORITES.set(val);
}
return valueSaved;
}
}.makeProfile().cache();
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_POI = new BooleanPreference("announce_nearby_poi", false) {
@Override
protected boolean setValue(Object prefs, Boolean val) {
boolean valueSaved = super.setValue(prefs, val);
if (valueSaved) {
SHOW_NEARBY_POI.set(val);
}
return valueSaved;
}
}.makeProfile().cache();
public final OsmandPreference<Boolean> GPX_ROUTE_CALC_OSMAND_PARTS = new BooleanPreference("gpx_routing_calculate_osmand_route", true).makeGlobal().cache();
public final OsmandPreference<Boolean> GPX_CALCULATE_RTEPT = new BooleanPreference("gpx_routing_calculate_rtept", true).makeGlobal().cache();
@ -1366,7 +1472,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Integer> MAP_SCREEN_ORIENTATION =
new IntPreference("map_screen_orientation", -1/*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/).makeGlobal();
new IntPreference("map_screen_orientation", -1/*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/).makeProfile();
// this value string is synchronized with settings_pref.xml preference name
// public final CommonPreference<Boolean> SHOW_VIEW_ANGLE = new BooleanPreference("show_view_angle", false).makeProfile().cache();
@ -1395,7 +1501,9 @@ public class OsmandSettings {
KEEP_INFORMING.setModeDefaultValue(ApplicationMode.BICYCLE, 0);
KEEP_INFORMING.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0);
}
public final CommonPreference<Boolean> TURN_SCREEN_ON_ENABLED = new BooleanPreference("turn_screen_on_enabled", false).makeProfile();
public final CommonPreference<Integer> TURN_SCREEN_ON_TIME_INT = new IntPreference("turn_screen_on_time_int", 0).makeProfile();
{
@ -1444,8 +1552,31 @@ public class OsmandSettings {
public final OsmandPreference<Integer> LEVEL_TO_SWITCH_VECTOR_RASTER = new IntPreference("level_to_switch_vector_raster", 1).makeGlobal().cache();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Integer> AUDIO_STREAM_GUIDANCE = new IntPreference("audio_stream",
3/*AudioManager.STREAM_MUSIC*/).makeProfile();
public final OsmandPreference<Integer> AUDIO_STREAM_GUIDANCE = new IntPreference("audio_stream", 3/*AudioManager.STREAM_MUSIC*/) {
@Override
protected boolean setValue(Object prefs, Integer stream) {
boolean valueSaved = super.setValue(prefs, stream);
if (valueSaved) {
CommandPlayer player = ctx.getPlayer();
if (player != null) {
player.updateAudioStream(get());
}
// Sync corresponding AUDIO_USAGE value
ApplicationMode mode = APPLICATION_MODE.get();
if (stream == 3 /*AudioManager.STREAM_MUSIC*/) {
AUDIO_USAGE.setModeValue(mode, 12 /*AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE*/);
} else if (stream == 5 /*AudioManager.STREAM_NOTIFICATION*/) {
AUDIO_USAGE.setModeValue(mode, 5 /*AudioAttributes.USAGE_NOTIFICATION*/);
} else if (stream == 0 /*AudioManager.STREAM_VOICE_CALL*/) {
AUDIO_USAGE.setModeValue(mode, 2 /*AudioAttributes.USAGE_VOICE_COMMUNICATION*/);
}
}
return valueSaved;
}
}.makeProfile();
// Corresponding USAGE value for AudioAttributes
public final OsmandPreference<Integer> AUDIO_USAGE = new IntPreference("audio_usage",
12/*AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE*/).makeProfile();
@ -1504,14 +1635,13 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> SHOW_MAP_MARKERS = new BooleanPreference("show_map_markers", true).makeGlobal();
public final OsmandPreference<Boolean> SHOW_COORDINATES_WIDGET = new BooleanPreference("show_coordinates_widget", false).makeGlobal();
public final OsmandPreference<Boolean> SHOW_COORDINATES_WIDGET = new BooleanPreference("show_coordinates_widget", false).makeProfile().cache();
public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumIntPreference<>("notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values());
public final OsmandPreference<Boolean> ANIMATE_MY_LOCATION = new BooleanPreference("animate_my_location", true).makeGlobal().cache();
public final OsmandPreference<Integer> EXTERNAL_INPUT_DEVICE =
new IntPreference("external_input_device", 0).makeGlobal();
public final OsmandPreference<Integer> EXTERNAL_INPUT_DEVICE = new IntPreference("external_input_device", 0).makeProfile();
public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_START_MY_LOC = new BooleanPreference("route_map_markers_start_my_loc", false).makeGlobal().cache();
public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_ROUND_TRIP = new BooleanPreference("route_map_markers_round_trip", false).makeGlobal().cache();
@ -2603,9 +2733,7 @@ public class OsmandSettings {
}
return "en-tts";
}
;
}.makeGlobal();
}.makeProfile();
// this value string is synchronized with settings_pref.xml preference name
@ -2703,8 +2831,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<String> CONTRIBUTION_INSTALL_APP_DATE = new StringPreference("CONTRIBUTION_INSTALL_APP_DATE", null).makeGlobal();
public final OsmandPreference<Integer> COORDINATES_FORMAT = new IntPreference("coordinates_format", PointDescription.FORMAT_DEGREES).makeGlobal();
public final OsmandPreference<Integer> COORDINATES_FORMAT = new IntPreference("coordinates_format", PointDescription.FORMAT_DEGREES).makeProfile();
public final OsmandPreference<Boolean> FOLLOW_THE_ROUTE = new BooleanPreference("follow_to_route", false).makeGlobal();
public final OsmandPreference<String> FOLLOW_THE_GPX_ROUTE = new StringPreference("follow_gpx", null).makeGlobal();
@ -2770,7 +2897,7 @@ public class OsmandSettings {
new IntPreference("FAVORITES_TAB", 0).makeGlobal().cache();
public final CommonPreference<Integer> OSMAND_THEME =
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME).makeGlobal().cache();
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME).makeProfile().cache();
public boolean isLightActionBar() {
return isLightContent();
@ -3065,4 +3192,106 @@ public class OsmandSettings {
}
}
public class PreferencesDataStore extends PreferenceDataStore {
@Override
public void putString(String key, @Nullable String value) {
setPreference(key, value);
}
@Override
public void putStringSet(String key, @Nullable Set<String> values) {
setPreference(key, values);
}
@Override
public void putInt(String key, int value) {
setPreference(key, value);
}
@Override
public void putLong(String key, long value) {
setPreference(key, value);
}
@Override
public void putFloat(String key, float value) {
setPreference(key, value);
}
@Override
public void putBoolean(String key, boolean value) {
setPreference(key, value);
}
public void putValue(String key, Object value) {
setPreference(key, value);
}
@Nullable
@Override
public String getString(String key, @Nullable String defValue) {
OsmandPreference preference = getPreference(key);
if (preference instanceof StringPreference) {
return ((StringPreference) preference).get();
} else {
Object value = preference.get();
if (value != null) {
return value.toString();
}
}
return defValue;
}
@Nullable
@Override
public Set<String> getStringSet(String key, @Nullable Set<String> defValues) {
return super.getStringSet(key, defValues);
}
@Override
public int getInt(String key, int defValue) {
OsmandPreference preference = getPreference(key);
if (preference instanceof IntPreference) {
return ((IntPreference) preference).get();
}
return defValue;
}
@Override
public long getLong(String key, long defValue) {
OsmandPreference preference = getPreference(key);
if (preference instanceof LongPreference) {
return ((LongPreference) preference).get();
}
return defValue;
}
@Override
public float getFloat(String key, float defValue) {
OsmandPreference preference = getPreference(key);
if (preference instanceof FloatPreference) {
return ((FloatPreference) preference).get();
}
return defValue;
}
@Override
public boolean getBoolean(String key, boolean defValue) {
OsmandPreference preference = getPreference(key);
if (preference instanceof BooleanPreference) {
return ((BooleanPreference) preference).get();
}
return defValue;
}
@Nullable
public Object getValue(String key, Object defValue) {
OsmandPreference preference = getPreference(key);
if (preference != null) {
return preference.get();
}
return defValue;
}
}
}

View file

@ -29,6 +29,8 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
@ -124,6 +126,8 @@ import net.osmand.plus.routing.TransportRoutingHelper.TransportRouteCalculationP
import net.osmand.plus.search.QuickSearchDialogFragment;
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
import net.osmand.plus.settings.BaseSettingsFragment;
import net.osmand.plus.settings.MainSettingsFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.MapControlsLayer;
@ -158,7 +162,9 @@ import java.util.regex.Pattern;
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
OnRequestPermissionsResultCallback, IRouteInformationListener, AMapPointUpdateListener,
MapMarkerChangedListener, OnDismissDialogFragmentListener, OnDrawMapListener, OsmAndAppCustomizationListener, LockHelper.LockUIAdapter {
MapMarkerChangedListener, OnDismissDialogFragmentListener, OnDrawMapListener,
OsmAndAppCustomizationListener, LockHelper.LockUIAdapter, PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
public static final String INTENT_KEY_PARENT_MAP_ACTIVITY = "intent_parent_map_activity_key";
public static final String INTENT_PARAMS = "intent_prarams";
@ -870,7 +876,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
} else if (!isFirstScreenShowing() && OsmLiveCancelledDialog.shouldShowDialog(app)) {
OsmLiveCancelledDialog.showInstance(getSupportFragmentManager());
} else if (SendAnalyticsBottomSheetDialogFragment.shouldShowDialog(app)) {
SendAnalyticsBottomSheetDialogFragment.showInstance(app, getSupportFragmentManager());
SendAnalyticsBottomSheetDialogFragment.showInstance(app, getSupportFragmentManager(), null);
}
FirstUsageWelcomeFragment.SHOW = false;
if (isFirstScreenShowing() && (!settings.SHOW_OSMAND_WELCOME_SCREEN.get() || !showOsmAndWelcomeScreen)) {
@ -1927,6 +1933,27 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
changeKeyguardFlags(true, false);
}
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
if (caller instanceof BaseSettingsFragment) {
BaseSettingsFragment baseFragment = (BaseSettingsFragment) caller;
ApplicationMode mode = baseFragment.getSelectedAppMode();
if (mode != null) {
String fragmentName = pref.getFragment();
Fragment fragment = Fragment.instantiate(this, fragmentName);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, fragment, fragmentName)
.addToBackStack(fragmentName)
.commitAllowingStateLoss();
return true;
}
}
return false;
}
private class ScreenOffReceiver extends BroadcastReceiver {
@Override
@ -2144,6 +2171,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
}
}
public void showSettings() {
MainSettingsFragment.showInstance(getSupportFragmentManager());
}
private void hideContextMenu() {
if (mapContextMenu.isVisible()) {
mapContextMenu.hide();

View file

@ -23,6 +23,9 @@ import android.widget.ListView;
import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.PlatformUtil;
@ -36,9 +39,6 @@ import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.ContextMenuItem.ItemBuilder;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication;
@ -83,8 +83,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
@ -100,6 +98,8 @@ import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_PLUGINS_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SEARCH_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
import static net.osmand.plus.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
@ -113,7 +113,7 @@ public class MapActivityActions implements DialogProvider {
public static final String KEY_NAME = "name";
public static final String KEY_ZOOM = "zoom";
public static final int REQUEST_LOCATION_FOR_DIRECTIONS_NAVIGATION_PERMISSION = 203;
// Constants for determining the order of items in the additional actions context menu
@ -148,7 +148,7 @@ public class MapActivityActions implements DialogProvider {
routingHelper = mapActivity.getMyApplication().getRoutingHelper();
drawerLogoHeader = new ImageView(mapActivity);
drawerLogoHeader.setPadding(-AndroidUtils.dpToPx(mapActivity, 8f), AndroidUtils.dpToPx(mapActivity, 16f), 0,
0);
0);
drawerOsmAndFooter = mapActivity.getLayoutInflater().inflate(R.layout.powered_by_osmand_item, null);
}
@ -884,6 +884,18 @@ public class MapActivityActions implements DialogProvider {
}
}).createItem());
optionsMenuHelper.addItem(new ItemBuilder().setTitle(getString(R.string.shared_string_settings) + " (Alpha)")
.setId(DRAWER_SETTINGS_ID + ".new")
.setIcon(R.drawable.ic_action_settings)
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent("drawer_settings_new_open");
mapActivity.showSettings();
return true;
}
}).createItem());
/*
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
.setIcon(R.drawable.ic_action_layers_dark)

View file

@ -590,7 +590,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
return (OsmandApplication) getApplication();
}
protected void showWarnings(List<String> warnings) {
public static void showWarnings(final OsmandApplication app, List<String> warnings) {
if (!warnings.isEmpty()) {
final StringBuilder b = new StringBuilder();
boolean f = true;
@ -602,11 +602,10 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
}
b.append(w);
}
runOnUiThread(new Runnable() {
app.runInUIThread(new Runnable() {
@Override
public void run() {
Toast.makeText(SettingsBaseActivity.this, b.toString(), Toast.LENGTH_LONG).show();
Toast.makeText(app, b.toString(), Toast.LENGTH_LONG).show();
}
});
}

View file

@ -1,7 +1,9 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.pm.ActivityInfo;
@ -22,6 +24,7 @@ import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.AppCompatCheckedTextView;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -60,7 +63,7 @@ import java.util.List;
public class SettingsGeneralActivity extends SettingsBaseActivity implements OnRequestPermissionsResultCallback {
private static final String IP_ADDRESS_PATTERN =
public static final String IP_ADDRESS_PATTERN =
"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
@ -139,29 +142,29 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
final int selected = sel;
final ArrayAdapter<DrivingRegion> singleChoiceAdapter =
new ArrayAdapter<DrivingRegion>(SettingsGeneralActivity.this, R.layout.single_choice_description_item, R.id.text1, drs) {
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = SettingsGeneralActivity.this.getLayoutInflater();
v = inflater.inflate(R.layout.single_choice_description_item, parent, false);
}
DrivingRegion item = getItem(position);
AppCompatCheckedTextView title = (AppCompatCheckedTextView) v.findViewById(R.id.text1);
TextView desc = (TextView) v.findViewById(R.id.description);
if (item != null) {
title.setText(getString(item.name));
desc.setVisibility(View.VISIBLE);
desc.setText(item.getDescription(v.getContext()));
} else {
title.setText(getString(R.string.driving_region_automatic));
desc.setVisibility(View.GONE);
}
title.setChecked(position == selected);
return v;
}
};
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = SettingsGeneralActivity.this.getLayoutInflater();
v = inflater.inflate(R.layout.single_choice_description_item, parent, false);
}
DrivingRegion item = getItem(position);
AppCompatCheckedTextView title = (AppCompatCheckedTextView) v.findViewById(R.id.text1);
TextView desc = (TextView) v.findViewById(R.id.description);
if (item != null) {
title.setText(getString(item.name));
desc.setVisibility(View.VISIBLE);
desc.setText(item.getDescription(v.getContext()));
} else {
title.setText(getString(R.string.driving_region_automatic));
desc.setVisibility(View.GONE);
}
title.setChecked(position == selected);
return v;
}
};
b.setAdapter(singleChoiceAdapter, new OnClickListener() {
@Override
@ -223,17 +226,35 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
}
registerListPreference(settings.ANGULAR_UNITS, screen, entries, ac);
Pair<String[], String[]> preferredLocaleInfo = getPreferredLocaleIdsAndValues(this);
if (preferredLocaleInfo != null) {
registerListPreference(settings.PREFERRED_LOCALE, screen, preferredLocaleInfo.first, preferredLocaleInfo.second);
}
// Add " (Display language)" to menu title in Latin letters for all non-en languages
if (!getResources().getString(R.string.preferred_locale).equals(getResources().getString(R.string.preferred_locale_no_translate))) {
((ListPreference) screen.findPreference(settings.PREFERRED_LOCALE.getId())).setTitle(getString(R.string.preferred_locale) + " (" + getString(R.string.preferred_locale_no_translate) + ")");
}
// This setting now only in "Confgure map" menu
//String[] values = ConfigureMapMenu.getMapNamesValues(this, ConfigureMapMenu.mapNamesIds);
//String[] ids = ConfigureMapMenu.getSortedMapNamesIds(this, ConfigureMapMenu.mapNamesIds, values);
//registerListPreference(settings.MAP_PREFERRED_LOCALE, screen, ConfigureMapMenu.getMapNamesValues(this, ids), ids);
}
public static Pair<String[], String[]> getPreferredLocaleIdsAndValues(Context ctx) {
// See language list and statistics at: https://hosted.weblate.org/projects/osmand/main/
// Hardy maintenance 2016-05-29:
// - Include languages if their translation is >= ~10% (but any language will be visible if it is the device's system locale)
// - Mark as "incomplete" if < ~80%
String incompleteSuffix = " (" + getString(R.string.incomplete_locale) + ")";
String incompleteSuffix = " (" + ctx.getString(R.string.incomplete_locale) + ")";
// Add " (Device language)" to system default entry in Latin letters, so it can be more easily identified if a foreign language has been selected by mistake
String latinSystemDefaultSuffix = " (" + getString(R.string.system_locale_no_translate) + ")";
String latinSystemDefaultSuffix = " (" + ctx.getString(R.string.system_locale_no_translate) + ")";
//getResources().getAssets().getLocales();
entrieValues = new String[]{"",
String[] entryValues = new String[] {
"",
"en",
"af",
"ar",
@ -294,83 +315,76 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
"vi",
"zh_CN",
"zh_TW"};
entries = new String[]{getString(R.string.system_locale) + latinSystemDefaultSuffix,
getString(R.string.lang_en),
getString(R.string.lang_af) + incompleteSuffix,
getString(R.string.lang_ar),
getString(R.string.lang_ast) + incompleteSuffix,
getString(R.string.lang_az),
getString(R.string.lang_be),
String[] entries = new String[] {
ctx.getString(R.string.system_locale) + latinSystemDefaultSuffix,
ctx.getString(R.string.lang_en),
ctx.getString(R.string.lang_af) + incompleteSuffix,
ctx.getString(R.string.lang_ar),
ctx.getString(R.string.lang_ast) + incompleteSuffix,
ctx.getString(R.string.lang_az),
ctx.getString(R.string.lang_be),
// getString(R.string.lang_be_by),
getString(R.string.lang_bg),
getString(R.string.lang_ca),
getString(R.string.lang_cs),
getString(R.string.lang_cy) + incompleteSuffix,
getString(R.string.lang_da),
getString(R.string.lang_de),
getString(R.string.lang_el) + incompleteSuffix,
getString(R.string.lang_en_gb),
getString(R.string.lang_eo),
getString(R.string.lang_es),
getString(R.string.lang_es_ar),
getString(R.string.lang_es_us),
getString(R.string.lang_eu),
getString(R.string.lang_fa),
getString(R.string.lang_fi) + incompleteSuffix,
getString(R.string.lang_fr),
getString(R.string.lang_gl),
getString(R.string.lang_he) + incompleteSuffix,
getString(R.string.lang_hr) + incompleteSuffix,
getString(R.string.lang_hsb) + incompleteSuffix,
getString(R.string.lang_hu),
getString(R.string.lang_hy),
getString(R.string.lang_is),
getString(R.string.lang_it),
getString(R.string.lang_ja),
getString(R.string.lang_ka) + incompleteSuffix,
getString(R.string.lang_kab) + incompleteSuffix,
getString(R.string.lang_kn) + incompleteSuffix,
getString(R.string.lang_ko),
getString(R.string.lang_lt),
getString(R.string.lang_lv),
getString(R.string.lang_ml) + incompleteSuffix,
getString(R.string.lang_mr) + incompleteSuffix,
getString(R.string.lang_nb),
getString(R.string.lang_nl),
getString(R.string.lang_nn) + incompleteSuffix,
getString(R.string.lang_oc) + incompleteSuffix,
getString(R.string.lang_pl),
getString(R.string.lang_pt),
getString(R.string.lang_pt_br),
getString(R.string.lang_ro) + incompleteSuffix,
getString(R.string.lang_ru),
getString(R.string.lang_sc),
getString(R.string.lang_sk),
getString(R.string.lang_sl),
getString(R.string.lang_sr) + incompleteSuffix,
getString(R.string.lang_sr_latn) + incompleteSuffix,
getString(R.string.lang_sv),
getString(R.string.lang_tr),
getString(R.string.lang_uk),
getString(R.string.lang_vi) + incompleteSuffix,
getString(R.string.lang_zh_cn) + incompleteSuffix,
getString(R.string.lang_zh_tw)};
String[] valuesPl = ConfigureMapMenu.getSortedMapNamesIds(this, entries, entries);
String[] idsPl = ConfigureMapMenu.getSortedMapNamesIds(this, entrieValues, entries);
registerListPreference(settings.PREFERRED_LOCALE, screen, valuesPl, idsPl);
ctx.getString(R.string.lang_bg),
ctx.getString(R.string.lang_ca),
ctx.getString(R.string.lang_cs),
ctx.getString(R.string.lang_cy) + incompleteSuffix,
ctx.getString(R.string.lang_da),
ctx.getString(R.string.lang_de),
ctx.getString(R.string.lang_el) + incompleteSuffix,
ctx.getString(R.string.lang_en_gb),
ctx.getString(R.string.lang_eo),
ctx.getString(R.string.lang_es),
ctx.getString(R.string.lang_es_ar),
ctx.getString(R.string.lang_es_us),
ctx.getString(R.string.lang_eu),
ctx.getString(R.string.lang_fa),
ctx.getString(R.string.lang_fi) + incompleteSuffix,
ctx.getString(R.string.lang_fr),
ctx.getString(R.string.lang_gl),
ctx.getString(R.string.lang_he) + incompleteSuffix,
ctx.getString(R.string.lang_hr) + incompleteSuffix,
ctx.getString(R.string.lang_hsb) + incompleteSuffix,
ctx.getString(R.string.lang_hu),
ctx.getString(R.string.lang_hy),
ctx.getString(R.string.lang_is),
ctx.getString(R.string.lang_it),
ctx.getString(R.string.lang_ja),
ctx.getString(R.string.lang_ka) + incompleteSuffix,
ctx.getString(R.string.lang_kab) + incompleteSuffix,
ctx.getString(R.string.lang_kn) + incompleteSuffix,
ctx.getString(R.string.lang_ko),
ctx.getString(R.string.lang_lt),
ctx.getString(R.string.lang_lv),
ctx.getString(R.string.lang_ml) + incompleteSuffix,
ctx.getString(R.string.lang_mr) + incompleteSuffix,
ctx.getString(R.string.lang_nb),
ctx.getString(R.string.lang_nl),
ctx.getString(R.string.lang_nn) + incompleteSuffix,
ctx.getString(R.string.lang_oc) + incompleteSuffix,
ctx.getString(R.string.lang_pl),
ctx.getString(R.string.lang_pt),
ctx.getString(R.string.lang_pt_br),
ctx.getString(R.string.lang_ro) + incompleteSuffix,
ctx.getString(R.string.lang_ru),
ctx.getString(R.string.lang_sc),
ctx.getString(R.string.lang_sk),
ctx.getString(R.string.lang_sl),
ctx.getString(R.string.lang_sr) + incompleteSuffix,
ctx.getString(R.string.lang_sr_latn) + incompleteSuffix,
ctx.getString(R.string.lang_sv),
ctx.getString(R.string.lang_tr),
ctx.getString(R.string.lang_uk),
ctx.getString(R.string.lang_vi) + incompleteSuffix,
ctx.getString(R.string.lang_zh_cn) + incompleteSuffix,
ctx.getString(R.string.lang_zh_tw)};
// Add " (Display language)" to menu title in Latin letters for all non-en languages
if (!getResources().getString(R.string.preferred_locale).equals(getResources().getString(R.string.preferred_locale_no_translate))) {
((ListPreference) screen.findPreference(settings.PREFERRED_LOCALE.getId())).setTitle(getString(R.string.preferred_locale) + " (" + getString(R.string.preferred_locale_no_translate) + ")");
}
String[] valuesPl = ConfigureMapMenu.getSortedMapNamesIds(ctx, entries, entries);
String[] idsPl = ConfigureMapMenu.getSortedMapNamesIds(ctx, entryValues, entries);
// This setting now only in "Confgure map" menu
//String[] values = ConfigureMapMenu.getMapNamesValues(this, ConfigureMapMenu.mapNamesIds);
//String[] ids = ConfigureMapMenu.getSortedMapNamesIds(this, ConfigureMapMenu.mapNamesIds, values);
//registerListPreference(settings.MAP_PREFERRED_LOCALE, screen, ConfigureMapMenu.getMapNamesValues(this, ids), ids);
return Pair.create(valuesPl, idsPl);
}
protected void enableProxy(boolean enable) {
settings.ENABLE_PROXY.set(enable);
if (enable) {
@ -473,7 +487,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
if (!Version.isBlackberry(getMyApplication())) {
applicationDir = new Preference(this);
applicationDir.setTitle(R.string.application_dir);
applicationDir.setKey("external_storage_dir");
applicationDir.setKey(OsmandSettings.EXTERNAL_STORAGE_DIR);
applicationDir.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
@ -566,7 +580,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
}
private void warnAboutChangingStorage(final String newValue) {
@ -701,7 +715,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
String permissions[], int[] grantResults) {
permissionRequested = requestCode == DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE;
if (permissionRequested
&& grantResults.length > 0
@ -714,4 +728,4 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
Toast.LENGTH_LONG).show();
}
}
}
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
@ -387,12 +388,12 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
}
}
public String getRoutinParameterTitle(Context context, RoutingParameter routingParameter) {
public static String getRoutinParameterTitle(Context context, RoutingParameter routingParameter) {
return SettingsBaseActivity.getRoutingStringPropertyName(context, routingParameter.getId(),
routingParameter.getName());
}
public boolean isRoutingParameterSelected(OsmandSettings settings, ApplicationMode am, RoutingParameter routingParameter) {
public static boolean isRoutingParameterSelected(OsmandSettings settings, ApplicationMode am, RoutingParameter routingParameter) {
final OsmandSettings.CommonPreference<Boolean> property =
settings.getCustomRoutingBooleanProperty(routingParameter.getId(), routingParameter.getDefaultBoolean());
if(am != null) {
@ -402,10 +403,9 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
}
}
public void setRoutingParameterSelected(OsmandSettings settings, ApplicationMode am, RoutingParameter routingParameter, boolean isChecked) {
final OsmandSettings.CommonPreference<Boolean> property =
settings.getCustomRoutingBooleanProperty(routingParameter.getId(), routingParameter.getDefaultBoolean());
if(am != null) {
public static void setRoutingParameterSelected(OsmandSettings settings, ApplicationMode am, String routingParameterId, boolean defaultBoolean, boolean isChecked) {
final OsmandSettings.CommonPreference<Boolean> property = settings.getCustomRoutingBooleanProperty(routingParameterId, defaultBoolean);
if (am != null) {
property.setModeValue(am, isChecked);
} else {
property.set(isChecked);
@ -468,7 +468,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
vals[i] = SettingsBaseActivity.getRoutingStringPropertyName(this, p.getId(), p.getName());
bls[i] = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
}
showBooleanSettings(vals, bls, preference.getTitle());
showBooleanSettings(this, vals, bls, preference.getTitle());
return true;
} else if (preference == autoZoom) {
final ApplicationMode am = settings.getApplicationMode();
@ -597,7 +597,8 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
int position = selectedPosition[0];
if (position >= 0 && position < reliefFactorParameters.size()) {
for (int i = 0; i < reliefFactorParameters.size(); i++) {
setRoutingParameterSelected(settings, am, reliefFactorParameters.get(i), i == position);
RoutingParameter parameter = reliefFactorParameters.get(i);
setRoutingParameterSelected(settings, am, parameter.getId(), parameter.getDefaultBoolean(), i == position);
}
//mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
//updateParameters();
@ -609,12 +610,12 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
builder.create().show();
return true;
} else if (preference == showAlarms) {
showBooleanSettings(new String[] { getString(R.string.show_traffic_warnings), getString(R.string.show_pedestrian_warnings),
showBooleanSettings(this, new String[] { getString(R.string.show_traffic_warnings), getString(R.string.show_pedestrian_warnings),
getString(R.string.show_cameras), getString(R.string.show_lanes), getString(R.string.show_tunnels) }, new OsmandPreference[] { settings.SHOW_TRAFFIC_WARNINGS,
settings.SHOW_PEDESTRIAN, settings.SHOW_CAMERAS, settings.SHOW_LANES, settings.SHOW_TUNNELS }, preference.getTitle());
return true;
} else if (preference == speakAlarms) {
AlertDialog dlg = showBooleanSettings(new String[] { getString(R.string.speak_street_names),
AlertDialog dlg = showBooleanSettings(this, new String[] { getString(R.string.speak_street_names),
getString(R.string.speak_traffic_warnings), getString(R.string.speak_pedestrian),
getString(R.string.speak_speed_limit), getString(R.string.speak_cameras), getString(R.string.show_tunnels),
getString(R.string.shared_string_gpx_waypoints), getString(R.string.speak_favorites),
@ -653,7 +654,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
});
return true;
} else if (preference == defaultSpeed) {
showSeekbarSettingsDialog();
showSeekbarSettingsDialog(this);
}
return false;
}
@ -672,8 +673,8 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
bld.show();
}
public AlertDialog showBooleanSettings(String[] vals, final OsmandPreference<Boolean>[] prefs, final CharSequence title) {
AlertDialog.Builder bld = new AlertDialog.Builder(this);
public static AlertDialog showBooleanSettings(Context ctx, String[] vals, final OsmandPreference<Boolean>[] prefs, final CharSequence title) {
AlertDialog.Builder bld = new AlertDialog.Builder(ctx);
boolean[] checkedItems = new boolean[prefs.length];
for (int i = 0; i < prefs.length; i++) {
checkedItems[i] = prefs[i].get();
@ -707,11 +708,17 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
return bld.show();
}
private void showSeekbarSettingsDialog() {
public static void showSeekbarSettingsDialog(Activity activity) {
if (activity == null) {
return;
}
final OsmandApplication app = (OsmandApplication) activity.getApplication();
final OsmandSettings settings = app.getSettings();
final ApplicationMode mode = settings.getApplicationMode();
GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), mode);
GeneralRouter router = getRouter(app.getRoutingConfig(), mode);
SpeedConstants units = settings.SPEED_SYSTEM.get();
String speedUnits = units.toShortString(this);
String speedUnits = units.toShortString(activity);
final float[] ratio = new float[1];
switch (units) {
case MILES_PER_HOUR:
@ -722,7 +729,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
break;
case MINUTES_PER_KILOMETER:
ratio[0] = 3600 / OsmAndFormatter.METERS_IN_KILOMETER;
speedUnits = getString(R.string.km_h);
speedUnits = activity.getString(R.string.km_h);
break;
case NAUTICALMILES_PER_HOUR:
ratio[0] = 3600 / OsmAndFormatter.METERS_IN_ONE_NAUTICALMILE;
@ -732,22 +739,22 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
float settingsMinSpeed = settings.MIN_SPEED.get();
float settingsMaxSpeed = settings.MAX_SPEED.get();
final int[] defaultValue = { Math.round(mode.getDefaultSpeed() * ratio[0]) };
final int[] minValue = { Math.round((settingsMinSpeed > 0 ? settingsMinSpeed : router.getMinSpeed()) * ratio[0]) };
final int[] maxValue = { Math.round((settingsMaxSpeed > 0 ? settingsMaxSpeed : router.getMaxSpeed()) * ratio[0]) };
final int[] defaultValue = {Math.round(mode.getDefaultSpeed() * ratio[0])};
final int[] minValue = {Math.round((settingsMinSpeed > 0 ? settingsMinSpeed : router.getMinSpeed()) * ratio[0])};
final int[] maxValue = {Math.round((settingsMaxSpeed > 0 ? settingsMaxSpeed : router.getMaxSpeed()) * ratio[0])};
final int min = Math.round(router.getMinSpeed() * ratio[0] / 2f);
final int max = Math.round(router.getMaxSpeed() * ratio[0] * 1.5f);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
boolean lightMode = getMyApplication().getSettings().isLightContent();
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
boolean lightMode = app.getSettings().isLightContent();
int themeRes = lightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
View seekbarView = LayoutInflater.from(new ContextThemeWrapper(this, themeRes))
View seekbarView = LayoutInflater.from(new ContextThemeWrapper(activity, themeRes))
.inflate(R.layout.default_speed_dialog, null, false);
builder.setView(seekbarView);
builder.setPositiveButton(R.string.shared_string_ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mode.setDefaultSpeed(getMyApplication(), defaultValue[0] / ratio[0]);
mode.setDefaultSpeed(app, defaultValue[0] / ratio[0]);
settings.MIN_SPEED.set(minValue[0] / ratio[0]);
settings.MAX_SPEED.set(maxValue[0] / ratio[0]);
}
@ -756,7 +763,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
builder.setNeutralButton("Revert", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mode.resetDefaultSpeed(getMyApplication());
mode.resetDefaultSpeed(app);
settings.MIN_SPEED.set(0f);
settings.MAX_SPEED.set(0f);
}
@ -775,7 +782,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
MAX_SPEED,
}
private void setupSpeedSlider(final SpeedSliderType type, String speedUnits, final int[] minValue, final int[] defaultValue, final int[] maxValue, final int min, final int max, View seekbarView) {
private static void setupSpeedSlider(final SpeedSliderType type, String speedUnits, final int[] minValue, final int[] defaultValue, final int[] maxValue, final int min, final int max, View seekbarView) {
View seekbarLayout;
int titleId;
final int[] speedValue;

View file

@ -3,6 +3,8 @@ package net.osmand.plus.dialogs;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
@ -25,7 +27,6 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleDividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitmeListDividerItem;
import net.osmand.plus.chooseplan.OsmLiveCancelledDialog;
import org.apache.commons.logging.Log;
@ -142,6 +143,7 @@ public class SendAnalyticsBottomSheetDialogFragment extends MenuBottomSheetDialo
settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.set(false);
settings.SEND_ANONYMOUS_APP_USAGE_DATA.set(false);
settings.SEND_ANONYMOUS_DATA_REQUEST_PROCESSED.set(true);
informAnalyticsPrefsUpdate();
}
@Override
@ -151,9 +153,17 @@ public class SendAnalyticsBottomSheetDialogFragment extends MenuBottomSheetDialo
settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.set(sendAnonymousMapDownloadsData);
settings.SEND_ANONYMOUS_APP_USAGE_DATA.set(sendAnonymousAppUsageData);
settings.SEND_ANONYMOUS_DATA_REQUEST_PROCESSED.set(true);
informAnalyticsPrefsUpdate();
dismiss();
}
private void informAnalyticsPrefsUpdate() {
Fragment target = getTargetFragment();
if (target instanceof OnSendAnalyticsPrefsUpdate) {
((OnSendAnalyticsPrefsUpdate) target).onAnalyticsPrefsUpdate();
}
}
public static boolean shouldShowDialog(@NonNull OsmandApplication app) {
OsmandSettings settings = app.getSettings();
int requestsCount = settings.SEND_ANONYMOUS_DATA_REQUESTS_COUNT.get();
@ -171,10 +181,11 @@ public class SendAnalyticsBottomSheetDialogFragment extends MenuBottomSheetDialo
return false;
}
public static void showInstance(@NonNull OsmandApplication app, @NonNull FragmentManager fm) {
public static void showInstance(@NonNull OsmandApplication app, @NonNull FragmentManager fm, @Nullable Fragment target) {
try {
if (fm.findFragmentByTag(SendAnalyticsBottomSheetDialogFragment.TAG) == null) {
SendAnalyticsBottomSheetDialogFragment fragment = new SendAnalyticsBottomSheetDialogFragment();
fragment.setTargetFragment(target, 0);
fragment.show(fm, SendAnalyticsBottomSheetDialogFragment.TAG);
OsmandSettings settings = app.getSettings();
@ -190,4 +201,10 @@ public class SendAnalyticsBottomSheetDialogFragment extends MenuBottomSheetDialo
LOG.error("showInstance", e);
}
}
public interface OnSendAnalyticsPrefsUpdate {
void onAnalyticsPrefsUpdate();
}
}

View file

@ -31,6 +31,7 @@ public class LockHelper implements SensorEventListener {
private OsmandApplication app;
private CommonPreference<Integer> turnScreenOnTime;
private CommonPreference<Boolean> turnScreenOnSensor;
private CommonPreference<Boolean> turnScreenOnEnabled;
@Nullable
private LockUIAdapter lockUIAdapter;
@ -48,6 +49,7 @@ public class LockHelper implements SensorEventListener {
this.app = app;
uiHandler = new Handler();
OsmandSettings settings = app.getSettings();
turnScreenOnEnabled = settings.TURN_SCREEN_ON_ENABLED;
turnScreenOnTime = settings.TURN_SCREEN_ON_TIME_INT;
turnScreenOnSensor = settings.TURN_SCREEN_ON_SENSOR;
@ -116,7 +118,7 @@ public class LockHelper implements SensorEventListener {
private void unlockEvent() {
int unlockTime = turnScreenOnTime.get();
if (unlockTime > 0) {
if (unlockTime > 0 && turnScreenOnEnabled.get()) {
timedUnlock(unlockTime * 1000L);
}
}
@ -165,7 +167,7 @@ public class LockHelper implements SensorEventListener {
public void onStop(@NonNull Activity activity) {
lock();
if (!activity.isFinishing() && isSensorEnabled()) {
if (!activity.isFinishing() && turnScreenOnEnabled.get() && isSensorEnabled()) {
switchSensorOn();
}
}

View file

@ -255,7 +255,7 @@ public class WaypointHelper {
public boolean isTypeEnabled(int type) {
if (type == ALARMS) {
return app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(appMode);
return app.getSettings().SHOW_ROUTING_ALARMS.get() && app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(appMode);
} else if (type == POI) {
return app.getSettings().SHOW_NEARBY_POI.getModeValue(appMode);
} else if (type == FAVORITES) {
@ -620,7 +620,8 @@ public class WaypointHelper {
AlarmInfo prevSpeedCam = null;
for (AlarmInfo i : route.getAlarmInfo()) {
if (i.getType() == AlarmInfoType.SPEED_CAMERA) {
if (app.getSettings().SHOW_CAMERAS.getModeValue(mode) || app.getSettings().SPEAK_SPEED_CAMERA.getModeValue(mode)) {
if (app.getSettings().SHOW_ROUTING_ALARMS.get() && app.getSettings().SHOW_CAMERAS.getModeValue(mode)
|| app.getSettings().SPEAK_SPEED_CAMERA.getModeValue(mode)) {
LocationPointWrapper lw = new LocationPointWrapper(route, ALARMS, i, 0, i.getLocationIndex());
if(prevSpeedCam != null &&
MapUtils.getDistance(prevSpeedCam.getLatitude(), prevSpeedCam.getLongitude(),
@ -633,7 +634,8 @@ public class WaypointHelper {
}
}
} else {
if (app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(mode) || app.getSettings().SPEAK_TRAFFIC_WARNINGS.getModeValue(mode)) {
if (app.getSettings().SHOW_ROUTING_ALARMS.get() && app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(mode)
|| app.getSettings().SPEAK_TRAFFIC_WARNINGS.getModeValue(mode)) {
LocationPointWrapper lw = new LocationPointWrapper(route, ALARMS, i, 0, i.getLocationIndex());
lw.setAnnounce(app.getSettings().SPEAK_TRAFFIC_WARNINGS.get());
array.add(lw);

View file

@ -1081,7 +1081,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
if (!poiFilters.isEmpty()) {
createPoiFiltersItems(mapActivity, poiFilters, optionsContainer);
}
if (traffic) {
if (traffic && app.getSettings().SHOW_ROUTING_ALARMS.get()) {
createWaypointItem(mapActivity, optionsContainer, WaypointHelper.ALARMS);
}
if (fav) {

View file

@ -1,14 +1,8 @@
package net.osmand.plus.routing;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import android.media.AudioManager;
import android.media.SoundPool;
import net.osmand.Location;
import net.osmand.binary.RouteDataObject;
@ -26,8 +20,14 @@ import net.osmand.router.RouteSegmentResult;
import net.osmand.router.TurnType;
import net.osmand.util.MapUtils;
import android.media.AudioManager;
import android.media.SoundPool;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class VoiceRouter {
@ -907,13 +907,14 @@ public class VoiceRouter {
}
private void play(CommandBuilder p) {
if (p != null) {
List<String> played = p.play();
notifyOnVoiceMessage(p.getListCommands(), played);
} else {
notifyOnVoiceMessage(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
if (settings.SPEAK_ROUTING_ALARMS.get()) {
if (p != null) {
List<String> played = p.play();
notifyOnVoiceMessage(p.getListCommands(), played);
} else {
notifyOnVoiceMessage(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
}
}
}
private void makeSound() {

View file

@ -0,0 +1,518 @@
package net.osmand.plus.settings;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.XmlRes;
import android.support.design.widget.AppBarLayout;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.support.v7.preference.PreferenceScreen;
import android.support.v7.view.ContextThemeWrapper;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
import net.osmand.plus.profiles.AppProfileArrayAdapter;
import net.osmand.plus.profiles.ProfileDataObject;
import net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet;
import net.osmand.plus.settings.bottomsheets.EditTextPreferenceBottomSheet;
import net.osmand.plus.settings.bottomsheets.MultiSelectPreferencesBottomSheet;
import net.osmand.plus.settings.bottomsheets.SingleSelectPreferenceBottomSheet;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import java.util.ArrayList;
import java.util.List;
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
protected OsmandApplication app;
protected OsmandSettings settings;
protected UiUtilities iconsCache;
protected List<ApplicationMode> modes = new ArrayList<ApplicationMode>();
private boolean nightMode;
private boolean wasDrawerDisabled;
@Override
public void onCreate(Bundle savedInstanceState) {
app = requireMyApplication();
settings = app.getSettings();
nightMode = !settings.isLightContent();
super.onCreate(savedInstanceState);
modes.clear();
modes.addAll(ApplicationMode.values(app));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
if (view != null) {
AndroidUtils.addStatusBarPadding21v(getContext(), view);
createToolbar(inflater, view);
setDivider(null);
}
return view;
}
@Override
public void onResume() {
super.onResume();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
wasDrawerDisabled = mapActivity.isDrawerDisabled();
if (!wasDrawerDisabled) {
mapActivity.disableDrawer();
}
}
}
@Override
public void onPause() {
super.onPause();
MapActivity mapActivity = getMapActivity();
if (!wasDrawerDisabled && mapActivity != null) {
mapActivity.enableDrawer();
}
}
private void createToolbar(LayoutInflater inflater, View view) {
AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.appbar);
int toolbarRes = getToolbarResId();
if (toolbarRes != -1) {
Context activityContext = getActivity();
final int themeRes = nightMode ? darkTheme : lightTheme;
final Context themedContext = new ContextThemeWrapper(activityContext, themeRes);
LayoutInflater themedInflater = LayoutInflater.from(themedContext);
View toolbarContainer = themedInflater.inflate(toolbarRes, null);
appBarLayout.addView(toolbarContainer);
view.findViewById(R.id.close_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.onBackPressed();
}
}
});
View switchProfile = view.findViewById(R.id.switch_profile_button);
if (switchProfile != null) {
switchProfile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectAppModeDialog().show();
}
});
}
updateToolbar(view);
}
}
private void updateToolbar(View view) {
if (view == null) {
return;
}
ApplicationMode selectedAppMode = getSelectedAppMode();
int iconRes = selectedAppMode.getIconRes();
int iconColor = selectedAppMode.getIconColorInfo().getColor(nightMode);
String title = selectedAppMode.isCustomProfile() ? selectedAppMode.getCustomProfileName() : getResources().getString(selectedAppMode.getNameKeyResource());
TextView toolbarTitle = (TextView) view.findViewById(R.id.toolbar_title);
if (toolbarTitle != null) {
toolbarTitle.setText(getToolbarTitle());
}
ImageView profileIcon = (ImageView) view.findViewById(R.id.profile_icon);
if (profileIcon != null) {
profileIcon.setImageDrawable(getIcon(iconRes, iconColor));
}
TextView profileTitle = (TextView) view.findViewById(R.id.profile_title);
if (profileTitle != null) {
profileTitle.setText(title);
}
TextView profileType = (TextView) view.findViewById(R.id.profile_type);
if (profileType != null) {
profileType.setVisibility(View.GONE);
}
View toolbarDivider = view.findViewById(R.id.toolbar_divider);
if (toolbarDivider != null) {
toolbarDivider.setBackgroundColor(ContextCompat.getColor(app, iconColor));
}
view.setBackgroundColor(ContextCompat.getColor(app, getBackgroundColor()));
}
int darkTheme = R.style.OsmandDarkTheme;
int lightTheme = R.style.OsmandLightTheme;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
getPreferenceManager().setPreferenceDataStore(settings.getDataStore());
updatePreferencesScreen();
}
@Override
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
Context activityContext = getActivity();
final int themeRes = nightMode ? darkTheme : lightTheme;
final Context themedContext = new ContextThemeWrapper(activityContext, themeRes);
LayoutInflater themedInflater = LayoutInflater.from(themedContext);
return super.onCreateRecyclerView(themedInflater, parent, savedInstanceState);
}
protected abstract void setupPreferences();
private void updatePreferencesScreen() {
if (getSelectedAppMode() != null) {
int resId = getPreferencesResId();
if (resId != -1) {
addPreferencesFromResource(getPreferencesResId());
setupPreferences();
registerPreferences();
}
}
}
private void registerPreferences() {
PreferenceScreen screen = getPreferenceScreen();
if (screen != null) {
for (int i = 0; i < screen.getPreferenceCount(); i++) {
Preference preference = screen.getPreference(i);
registerPreference(preference);
}
}
}
protected AlertDialog.Builder selectAppModeDialog() {
AlertDialog.Builder singleSelectDialogBuilder = new AlertDialog.Builder(getContext());
singleSelectDialogBuilder.setTitle(R.string.profile_settings);
final List<ProfileDataObject> activeModes = new ArrayList<>();
for (ApplicationMode am : ApplicationMode.values(getMyApplication())) {
boolean isSelected = false;
if (am == getSelectedAppMode()) {
isSelected = true;
}
activeModes.add(new ProfileDataObject(
am.toHumanString(getMyApplication()),
getAppModeDescription(am),
am.getStringKey(),
am.getIconRes(),
isSelected,
am.getIconColorInfo()
));
}
final AppProfileArrayAdapter modeNames = new AppProfileArrayAdapter(
getActivity(), R.layout.bottom_sheet_item_with_descr_and_radio_btn, activeModes, true);
singleSelectDialogBuilder.setNegativeButton(R.string.shared_string_cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
singleSelectDialogBuilder.setAdapter(modeNames, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ApplicationMode selectedAppMode = modes.get(which);
requireSettings().APPLICATION_MODE.set(selectedAppMode);
updateAllSettings();
}
});
return singleSelectDialogBuilder;
}
private String getAppModeDescription(ApplicationMode mode) {
String descr;
if (!mode.isCustomProfile()) {
descr = getString(R.string.profile_type_base_string);
} else {
descr = String.format(getString(R.string.profile_type_descr_string),
mode.getParent().toHumanString(getMyApplication()));
if (mode.getRoutingProfile() != null && mode.getRoutingProfile().contains("/")) {
descr = descr.concat(", " + mode.getRoutingProfile()
.substring(0, mode.getRoutingProfile().indexOf("/")));
}
}
return descr;
}
public void updateAllSettings() {
getListView().getRecycledViewPool().clear();
getPreferenceScreen().removeAll();
updatePreferencesScreen();
updateToolbar(getView());
}
@XmlRes
protected int getPreferencesResId() {
return -1;
}
@LayoutRes
protected int getToolbarResId() {
return -1;
}
protected String getToolbarTitle() {
return getString(R.string.shared_string_settings);
}
@ColorRes
protected int getStatusBarColorId() {
View view = getView();
if (view != null) {
if (Build.VERSION.SDK_INT >= 23 && !isNightMode()) {
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
return isNightMode() ? R.color.list_background_color_dark : R.color.list_background_color_light;
}
return -1;
}
@ColorRes
protected int getActiveProfileColor() {
return getSelectedAppMode().getIconColorInfo().getColor(isNightMode());
}
@ColorRes
protected int getBackgroundColor() {
return isNightMode() ? R.color.list_background_color_dark : R.color.list_background_color_light;
}
protected void registerPreference(Preference preference) {
if (preference != null) {
preference.setOnPreferenceChangeListener(this);
preference.setOnPreferenceClickListener(this);
if (preference instanceof ListPreference) {
ListPreference listPreference = (ListPreference) preference;
assert listPreference.getEntryValues().length == listPreference.getEntries().length;
}
}
}
public ApplicationMode getSelectedAppMode() {
return settings.APPLICATION_MODE.get();
}
public boolean isNightMode() {
return nightMode;
}
@Nullable
public MapActivity getMapActivity() {
FragmentActivity activity = getActivity();
if (activity instanceof MapActivity) {
return (MapActivity) activity;
} else {
return null;
}
}
@Nullable
protected OsmandApplication getMyApplication() {
FragmentActivity activity = getActivity();
if (activity != null) {
return (OsmandApplication) activity.getApplication();
} else {
return null;
}
}
@NonNull
protected OsmandApplication requireMyApplication() {
FragmentActivity activity = requireActivity();
return (OsmandApplication) activity.getApplication();
}
@Nullable
protected OsmandActionBarActivity getMyActivity() {
return (OsmandActionBarActivity) getActivity();
}
@NonNull
protected OsmandActionBarActivity requireMyActivity() {
return (OsmandActionBarActivity) requireActivity();
}
@Nullable
protected OsmandInAppPurchaseActivity getInAppPurchaseActivity() {
Activity activity = getActivity();
if (activity instanceof OsmandInAppPurchaseActivity) {
return (OsmandInAppPurchaseActivity) getActivity();
} else {
return null;
}
}
@Nullable
protected UiUtilities getIconsCache() {
OsmandApplication app = getMyApplication();
if (iconsCache == null && app != null) {
iconsCache = app.getUIUtilities();
}
return iconsCache;
}
protected Drawable getIcon(@DrawableRes int id) {
UiUtilities cache = getIconsCache();
return cache != null ? cache.getIcon(id) : null;
}
protected Drawable getActiveIcon(@DrawableRes int id) {
UiUtilities cache = getIconsCache();
return cache != null ? cache.getIcon(id, getActiveProfileColor()) : null;
}
protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
UiUtilities cache = getIconsCache();
return cache != null ? cache.getIcon(id, colorId) : null;
}
protected Drawable getContentIcon(@DrawableRes int id) {
UiUtilities cache = getIconsCache();
return cache != null ? cache.getThemedIcon(id) : null;
}
@Nullable
protected OsmandSettings getSettings() {
OsmandApplication app = getMyApplication();
if (app != null) {
return app.getSettings();
} else {
return null;
}
}
@NonNull
protected OsmandSettings requireSettings() {
OsmandApplication app = requireMyApplication();
return app.getSettings();
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}
@Override
public void onDisplayPreferenceDialog(Preference preference) {
if (preference instanceof ListPreferenceEx) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
SingleSelectPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
}
} else if (preference instanceof SwitchPreferenceEx) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
BooleanPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
}
} else if (preference instanceof EditTextPreference) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
EditTextPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
}
} else if (preference instanceof MultiSelectBooleanPreference) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
MultiSelectPreferencesBottomSheet.showInstance(getFragmentManager(), preference.getKey(), this);
}
} else {
super.onDisplayPreferenceDialog(preference);
}
}
@Override
public boolean onPreferenceClick(Preference preference) {
return false;
}
public SwitchPreference createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, int title, int summary, int layoutId) {
return createSwitchPreference(b, getString(title), getString(summary), layoutId);
}
public SwitchPreference createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, String title, String summary, int layoutId) {
SwitchPreference p = new SwitchPreference(getContext());
p.setTitle(title);
p.setKey(b.getId());
p.setSummary(summary);
p.setLayoutResource(layoutId);
return p;
}
public SwitchPreferenceEx createSwitchPreferenceEx(String prefId, int title, int layoutId) {
return createSwitchPreferenceEx(prefId, getString(title), null, layoutId);
}
public SwitchPreferenceEx createSwitchPreferenceEx(String prefId, int title, int summary, int layoutId) {
return createSwitchPreferenceEx(prefId, getString(title), getString(summary), layoutId);
}
public SwitchPreferenceEx createSwitchPreferenceEx(String prefId, String title, String summary, int layoutId) {
SwitchPreferenceEx p = new SwitchPreferenceEx(getContext());
p.setKey(prefId);
p.setTitle(title);
p.setSummary(summary);
p.setLayoutResource(layoutId);
return p;
}
public ListPreferenceEx createListPreferenceEx(String prefId, String[] names, Object[] values, int title, int layoutId) {
return createListPreferenceEx(prefId, names, values, getString(title), layoutId);
}
public ListPreferenceEx createListPreferenceEx(String prefId, String[] names, Object[] values, String title, int layoutId) {
ListPreferenceEx listPreference = new ListPreferenceEx(getContext());
listPreference.setKey(prefId);
listPreference.setTitle(title);
listPreference.setDialogTitle(title);
listPreference.setEntries(names);
listPreference.setEntryValues(values);
if (layoutId != 0) {
listPreference.setLayoutResource(layoutId);
}
return listPreference;
}
}

View file

@ -0,0 +1,170 @@
package net.osmand.plus.settings;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.aidl.OsmandAidlApi.ConnectedApp;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import java.util.List;
import static net.osmand.plus.profiles.EditProfileFragment.MAP_CONFIG;
import static net.osmand.plus.profiles.EditProfileFragment.OPEN_CONFIG_ON_MAP;
import static net.osmand.plus.profiles.EditProfileFragment.SELECTED_ITEM;
public class ConfigureProfileFragment extends BaseSettingsFragment {
public static final String TAG = "ConfigureProfileFragment";
@Override
protected int getPreferencesResId() {
return R.xml.configure_profile;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar_big;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.configure_profile);
}
@ColorRes
protected int getBackgroundColor() {
return isNightMode() ? R.color.activity_background_color_dark : R.color.activity_background_color_light;
}
@Override
protected void setupPreferences() {
Preference generalSettings = findPreference("general_settings");
Preference pluginSettings = findPreference("plugin_settings");
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
setupNavigationSettingsPref();
setupConfigureMapPref();
setupConnectedAppsPref();
setupOsmandPluginsPref();
}
private void setupNavigationSettingsPref() {
Preference navigationSettings = findPreference("navigation_settings");
navigationSettings.setIcon(getContentIcon(R.drawable.ic_action_gdirections_dark));
if (getSelectedAppMode() == ApplicationMode.DEFAULT) {
navigationSettings.setVisible(false);
}
}
private void setupConfigureMapPref() {
Context ctx = getContext();
if (ctx == null) {
return;
}
Preference configureMap = findPreference("configure_map");
configureMap.setIcon(getContentIcon(R.drawable.ic_action_layers_dark));
Intent intent = new Intent(ctx, MapActivity.class);
intent.putExtra(OPEN_CONFIG_ON_MAP, MAP_CONFIG);
intent.putExtra(SELECTED_ITEM, getSelectedAppMode().getStringKey());
configureMap.setIntent(intent);
configureMap.setVisible(false);
}
private void setupConnectedAppsPref() {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
List<ConnectedApp> connectedApps = app.getAidlApi().getConnectedApps();
for (ConnectedApp connectedApp : connectedApps) {
SwitchPreference preference = new SwitchPreference(app);
preference.setPersistent(false);
preference.setKey(connectedApp.getPack());
preference.setTitle(connectedApp.getName());
preference.setIcon(connectedApp.getIcon());
preference.setChecked(connectedApp.isEnabled());
preference.setLayoutResource(R.layout.preference_switch);
getPreferenceScreen().addPreference(preference);
}
}
private void setupOsmandPluginsPref() {
Context ctx = getContext();
if (ctx == null) {
return;
}
List<OsmandPlugin> plugins = OsmandPlugin.getVisiblePlugins();
for (OsmandPlugin plugin : plugins) {
SwitchPreferenceEx preference = new SwitchPreferenceEx(ctx);
preference.setPersistent(false);
preference.setKey(plugin.getId());
preference.setTitle(plugin.getName());
preference.setIcon(getPluginIcon(plugin));
preference.setChecked(plugin.isActive());
preference.setLayoutResource(R.layout.preference_dialog_and_switch);
preference.setIntent(getPluginIntent(plugin));
getPreferenceScreen().addPreference(preference);
}
}
private Drawable getPluginIcon(OsmandPlugin plugin) {
int iconResId = plugin.getLogoResourceId();
return plugin.isActive() ? getActiveIcon(iconResId) : getContentIcon(iconResId);
}
private Intent getPluginIntent(OsmandPlugin plugin) {
Intent intent;
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
if (settingsActivity != null && !plugin.needsInstallation()) {
intent = new Intent(getContext(), settingsActivity);
} else {
intent = new Intent(getContext(), PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId());
}
return intent;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
OsmandPlugin plugin = OsmandPlugin.getPlugin(key);
if (plugin != null) {
if (newValue instanceof Boolean) {
if ((plugin.isActive() || !plugin.needsInstallation())) {
if (OsmandPlugin.enablePlugin(getActivity(), app, plugin, (Boolean) newValue)) {
updateAllSettings();
return true;
}
} else if (plugin.needsInstallation() && preference.getIntent() != null) {
startActivity(preference.getIntent());
}
}
return false;
}
OsmandAidlApi aidlApi = app.getAidlApi();
ConnectedApp connectedApp = aidlApi.getConnectedApp(key);
if (connectedApp != null) {
return aidlApi.switchEnabled(connectedApp);
}
return super.onPreferenceChange(preference, newValue);
}
}

View file

@ -0,0 +1,244 @@
package net.osmand.plus.settings;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.support.v7.preference.PreferenceViewHolder;
import android.text.Layout;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.Location;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
public class CoordinatesFormatFragment extends BaseSettingsFragment {
public static final String TAG = "CoordinatesFormatFragment";
private static final String FORMAT_DEGREES = "format_degrees";
private static final String FORMAT_MINUTES = "format_minutes";
private static final String FORMAT_SECONDS = "format_seconds";
private static final String UTM_FORMAT = "utm_format";
private static final String OLC_FORMAT = "olc_format";
@Override
protected int getPreferencesResId() {
return R.xml.coordinates_format;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.coordinates_format);
}
@Override
protected void setupPreferences() {
PreferenceScreen screen = getPreferenceScreen();
screen.setOrderingAsAdded(false);
Preference generalSettings = findPreference("coordinates_format_info");
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
CheckBoxPreference degreesPref = (CheckBoxPreference) findPreference(FORMAT_DEGREES);
CheckBoxPreference minutesPref = (CheckBoxPreference) findPreference(FORMAT_MINUTES);
CheckBoxPreference secondsPref = (CheckBoxPreference) findPreference(FORMAT_SECONDS);
CheckBoxPreference olcPref = (CheckBoxPreference) findPreference(OLC_FORMAT);
CheckBoxPreference utmPref = createUtmFormatPref();
screen.addPreference(utmPref);
Location loc = app.getLocationProvider().getLastKnownLocation();
degreesPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_DEGREES));
minutesPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_MINUTES));
secondsPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_SECONDS));
utmPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.UTM_FORMAT));
olcPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.OLC_FORMAT));
int currentFormat = settings.COORDINATES_FORMAT.get();
String currentPrefKey = getCoordinatesKeyForFormat(currentFormat);
updateSelectedFormatPrefs(currentPrefKey);
}
private CheckBoxPreference createUtmFormatPref() {
CheckBoxPreference utmPref = new CheckBoxPreference(app) {
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
if (summaryView != null) {
summaryView.setOnTouchListener(getSummaryTouchListener());
}
}
};
utmPref.setKey(UTM_FORMAT);
utmPref.setTitle(R.string.navigate_point_format_utm);
utmPref.setPersistent(false);
utmPref.setOrder(4);
utmPref.setLayoutResource(R.layout.preference_radio_button);
return utmPref;
}
private View.OnTouchListener getSummaryTouchListener() {
return new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_DOWN) {
TextView widget = (TextView) v;
int x = (int) event.getX();
int y = (int) event.getY();
x -= widget.getTotalPaddingLeft();
y -= widget.getTotalPaddingTop();
x += widget.getScrollX();
y += widget.getScrollY();
Layout layout = widget.getLayout();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
Spannable spannable = new SpannableString(widget.getText());
ClickableSpan[] links = spannable.getSpans(off, off, ClickableSpan.class);
if (links.length != 0) {
if (action == MotionEvent.ACTION_UP) {
links[0].onClick(widget);
} else {
Selection.setSelection(spannable, spannable.getSpanStart(links[0]), spannable.getSpanEnd(links[0]));
}
return true;
} else {
Selection.removeSelection(spannable);
}
}
return false;
}
};
}
private CharSequence getCoordinatesFormatSummary(Location loc, int format) {
double lat = loc != null ? loc.getLatitude() : 49.41869;
double lon = loc != null ? loc.getLongitude() : 8.67339;
String formattedCoordinates = OsmAndFormatter.getFormattedCoordinates(lat, lon, format);
if (format == PointDescription.UTM_FORMAT) {
SpannableStringBuilder spannableBuilder = new SpannableStringBuilder();
spannableBuilder.append(getString(R.string.shared_string_example));
spannableBuilder.append(": ");
spannableBuilder.append(formattedCoordinates);
spannableBuilder.append("\n");
spannableBuilder.append(getString(R.string.utm_format_descr));
int start = spannableBuilder.length();
spannableBuilder.append(" ");
spannableBuilder.append(getString(R.string.shared_string_read_more));
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(@NonNull View widget) {
Toast.makeText(widget.getContext(), getString(R.string.shared_string_read_more), Toast.LENGTH_LONG).show();
}
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
};
spannableBuilder.setSpan(clickableSpan, start, spannableBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannableBuilder;
}
return getString(R.string.shared_string_example) + ": " + formattedCoordinates;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
int newFormat = getCoordinatesFormatForKey(key);
if (newFormat != -1) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
ChangeGeneralProfilesPrefBottomSheet.showInstance(fragmentManager, settings.COORDINATES_FORMAT.getId(), newFormat, this);
return false;
}
}
return super.onPreferenceChange(preference, newValue);
}
private void updateSelectedFormatPrefs(String key) {
PreferenceScreen screen = getPreferenceScreen();
if (screen != null) {
for (int i = 0; i < screen.getPreferenceCount(); i++) {
Preference pref = screen.getPreference(i);
if (pref instanceof CheckBoxPreference) {
CheckBoxPreference checkBoxPreference = ((CheckBoxPreference) pref);
boolean checked = checkBoxPreference.getKey().equals(key);
checkBoxPreference.setChecked(checked);
}
}
}
}
private int getCoordinatesFormatForKey(String key) {
switch (key) {
case FORMAT_DEGREES:
return PointDescription.FORMAT_DEGREES;
case FORMAT_MINUTES:
return PointDescription.FORMAT_MINUTES;
case FORMAT_SECONDS:
return PointDescription.FORMAT_SECONDS;
case UTM_FORMAT:
return PointDescription.UTM_FORMAT;
case OLC_FORMAT:
return PointDescription.OLC_FORMAT;
default:
return -1;
}
}
private String getCoordinatesKeyForFormat(int format) {
switch (format) {
case PointDescription.FORMAT_DEGREES:
return FORMAT_DEGREES;
case PointDescription.FORMAT_MINUTES:
return FORMAT_MINUTES;
case PointDescription.FORMAT_SECONDS:
return FORMAT_SECONDS;
case PointDescription.UTM_FORMAT:
return UTM_FORMAT;
case PointDescription.OLC_FORMAT:
return OLC_FORMAT;
default:
return "Unknown format";
}
}
}

View file

@ -0,0 +1,303 @@
package net.osmand.plus.settings;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.Preference;
import android.support.v7.widget.AppCompatCheckedTextView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
public static final String TAG = "GeneralProfileSettingsFragment";
@Override
protected int getPreferencesResId() {
return R.xml.general_profile_settings;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar_big;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.general_settings_2);
}
@Override
protected void setupPreferences() {
Preference appearanceCategory = findPreference("appearance_category");
Preference unitsAndFormats = findPreference("units_and_formats");
Preference other = findPreference("other");
appearanceCategory.setIconSpaceReserved(true);
unitsAndFormats.setIconSpaceReserved(true);
other.setIconSpaceReserved(true);
setupAppThemePref();
setupRotateMapPref();
setupMapScreenOrientationPref();
setupDrivingRegionPref();
setupUnitsOfLengthPref();
setupCoordinatesFormatPref();
setupAngularUnitsPref();
setupKalmanFilterPref();
setupMagneticFieldSensorPref();
setupMapEmptyStateAllowedPref();
setupDoNotUseAnimationsPref();
setupExternalInputDevicePref();
}
private void setupAppThemePref() {
final ListPreferenceEx appTheme = (ListPreferenceEx) findPreference(settings.OSMAND_THEME.getId());
appTheme.setEntries(new String[]{getString(R.string.dark_theme), getString(R.string.light_theme)});
appTheme.setEntryValues(new Integer[]{OsmandSettings.OSMAND_DARK_THEME, OsmandSettings.OSMAND_LIGHT_THEME});
appTheme.setIcon(getOsmandThemeIcon());
}
private Drawable getOsmandThemeIcon() {
return getIcon(settings.isLightContent() ? R.drawable.ic_action_sun : R.drawable.ic_action_moon);
}
private void setupRotateMapPref() {
final ListPreferenceEx rotateMap = (ListPreferenceEx) findPreference(settings.ROTATE_MAP.getId());
rotateMap.setEntries(new String[]{getString(R.string.rotate_map_none_opt), getString(R.string.rotate_map_bearing_opt), getString(R.string.rotate_map_compass_opt)});
rotateMap.setEntryValues(new Integer[]{OsmandSettings.ROTATE_MAP_NONE, OsmandSettings.ROTATE_MAP_BEARING, OsmandSettings.ROTATE_MAP_COMPASS});
rotateMap.setIcon(getRotateMapIcon());
}
private Drawable getRotateMapIcon() {
switch (settings.ROTATE_MAP.get()) {
case OsmandSettings.ROTATE_MAP_NONE:
return getIcon(R.drawable.ic_action_direction_north);
case OsmandSettings.ROTATE_MAP_BEARING:
return getIcon(R.drawable.ic_action_direction_movement);
default:
return getIcon(R.drawable.ic_action_direction_compass);
}
}
private void setupMapScreenOrientationPref() {
final ListPreferenceEx mapScreenOrientation = (ListPreferenceEx) findPreference(settings.MAP_SCREEN_ORIENTATION.getId());
mapScreenOrientation.setEntries(new String[]{getString(R.string.map_orientation_portrait), getString(R.string.map_orientation_landscape), getString(R.string.map_orientation_default)});
mapScreenOrientation.setEntryValues(new Integer[]{ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED});
mapScreenOrientation.setIcon(getMapScreenOrientationIcon());
}
private Drawable getMapScreenOrientationIcon() {
switch (settings.MAP_SCREEN_ORIENTATION.get()) {
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
return getIcon(R.drawable.ic_action_phone_portrait_orientation);
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
return getIcon(R.drawable.ic_action_phone_landscape_orientation);
default:
return getIcon(R.drawable.ic_action_phone_device_orientation);
}
}
private void setupDrivingRegionPref() {
Preference defaultDrivingRegion = findPreference(settings.DRIVING_REGION.getId());
defaultDrivingRegion.setIcon(getContentIcon(R.drawable.ic_action_car_dark));
defaultDrivingRegion.setSummary(getString(settings.DRIVING_REGION_AUTOMATIC.get() ? R.string.driving_region_automatic : settings.DRIVING_REGION.get().name));
}
private void setupUnitsOfLengthPref() {
OsmandSettings.MetricsConstants[] metricsConstants = OsmandSettings.MetricsConstants.values();
String[] entries = new String[metricsConstants.length];
Integer[] entryValues = new Integer[metricsConstants.length];
for (int i = 0; i < entries.length; i++) {
entries[i] = metricsConstants[i].toHumanString(app);
entryValues[i] = metricsConstants[i].ordinal();
}
ListPreferenceEx unitsOfLength = (ListPreferenceEx) findPreference(settings.METRIC_SYSTEM.getId());
unitsOfLength.setEntries(entries);
unitsOfLength.setEntryValues(entryValues);
unitsOfLength.setIcon(getIcon(R.drawable.ic_action_ruler_unit));
}
private void setupCoordinatesFormatPref() {
Preference coordinatesFormat = findPreference(settings.COORDINATES_FORMAT.getId());
coordinatesFormat.setIcon(getContentIcon(R.drawable.ic_action_coordinates_widget));
coordinatesFormat.setSummary(PointDescription.formatToHumanString(app, settings.COORDINATES_FORMAT.get()));
}
private void setupAngularUnitsPref() {
OsmandSettings.AngularConstants[] ac = OsmandSettings.AngularConstants.values();
String[] entries = new String[ac.length];
Integer[] entryValues = new Integer[ac.length];
for (int i = 0; i < entries.length; i++) {
if (ac[i] == OsmandSettings.AngularConstants.DEGREES) {
entries[i] = OsmandSettings.AngularConstants.DEGREES.toHumanString(app) + " 180";
entryValues[i] = OsmandSettings.AngularConstants.DEGREES.ordinal();
} else if (ac[i] == OsmandSettings.AngularConstants.DEGREES360) {
entries[i] = OsmandSettings.AngularConstants.DEGREES.toHumanString(app) + " 360";
entryValues[i] = OsmandSettings.AngularConstants.DEGREES360.ordinal();
} else {
entries[i] = ac[i].toHumanString(app);
entryValues[i] = OsmandSettings.AngularConstants.MILLIRADS.ordinal();
}
}
ListPreferenceEx angularUnits = (ListPreferenceEx) findPreference(settings.ANGULAR_UNITS.getId());
angularUnits.setEntries(entries);
angularUnits.setEntryValues(entryValues);
angularUnits.setIcon(getContentIcon(R.drawable.ic_action_angular_unit));
}
private void setupKalmanFilterPref() {
SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId());
kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass));
kalmanFilterPref.setDescription(getString(R.string.use_kalman_filter_compass_descr));
kalmanFilterPref.setIconSpaceReserved(true);
}
private void setupMagneticFieldSensorPref() {
SwitchPreferenceEx useMagneticSensorPref = (SwitchPreferenceEx) findPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS.getId());
useMagneticSensorPref.setTitle(getString(R.string.use_magnetic_sensor));
useMagneticSensorPref.setDescription(getString(R.string.use_magnetic_sensor_descr));
useMagneticSensorPref.setIconSpaceReserved(true);
}
private void setupMapEmptyStateAllowedPref() {
SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.MAP_EMPTY_STATE_ALLOWED.getId());
mapEmptyStateAllowedPref.setTitle(getString(R.string.tap_on_map_to_hide_interface));
mapEmptyStateAllowedPref.setDescription(getString(R.string.tap_on_map_to_hide_interface_descr));
mapEmptyStateAllowedPref.setIconSpaceReserved(true);
}
private void setupDoNotUseAnimationsPref() {
SwitchPreference doNotUseAnimations = (SwitchPreference) findPreference(settings.DO_NOT_USE_ANIMATIONS.getId());
doNotUseAnimations.setIconSpaceReserved(true);
}
private void setupExternalInputDevicePref() {
ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId());
externalInputDevice.setIconSpaceReserved(true);
externalInputDevice.setEntries(new String[]{
getString(R.string.sett_no_ext_input),
getString(R.string.sett_generic_ext_input),
getString(R.string.sett_wunderlinq_ext_input),
getString(R.string.sett_parrot_ext_input)
});
externalInputDevice.setEntryValues(new Integer[]{
OsmandSettings.NO_EXTERNAL_DEVICE,
OsmandSettings.GENERIC_EXTERNAL_DEVICE,
OsmandSettings.WUNDERLINQ_EXTERNAL_DEVICE,
OsmandSettings.PARROT_EXTERNAL_DEVICE}
);
}
private void showDrivingRegionDialog() {
final AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setTitle(getString(R.string.driving_region));
final List<OsmandSettings.DrivingRegion> drs = new ArrayList<>();
drs.add(null);
drs.addAll(Arrays.asList(OsmandSettings.DrivingRegion.values()));
int sel = -1;
OsmandSettings.DrivingRegion selectedDrivingRegion = settings.DRIVING_REGION.get();
if (settings.DRIVING_REGION_AUTOMATIC.get()) {
sel = 0;
}
for (int i = 1; i < drs.size(); i++) {
if (sel == -1 && drs.get(i) == selectedDrivingRegion) {
sel = i;
break;
}
}
final int selected = sel;
final ArrayAdapter<OsmandSettings.DrivingRegion> singleChoiceAdapter =
new ArrayAdapter<OsmandSettings.DrivingRegion>(getActivity(), R.layout.single_choice_description_item, R.id.text1, drs) {
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = getActivity().getLayoutInflater();
v = inflater.inflate(R.layout.single_choice_description_item, parent, false);
}
OsmandSettings.DrivingRegion item = getItem(position);
AppCompatCheckedTextView title = (AppCompatCheckedTextView) v.findViewById(R.id.text1);
TextView desc = (TextView) v.findViewById(R.id.description);
if (item != null) {
title.setText(getString(item.name));
desc.setVisibility(View.VISIBLE);
desc.setText(item.getDescription(v.getContext()));
} else {
title.setText(getString(R.string.driving_region_automatic));
desc.setVisibility(View.GONE);
}
title.setChecked(position == selected);
return v;
}
};
b.setAdapter(singleChoiceAdapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (drs.get(which) == null) {
settings.DRIVING_REGION_AUTOMATIC.set(true);
MapViewTrackingUtilities mapViewTrackingUtilities = getMyApplication().getMapViewTrackingUtilities();
if (mapViewTrackingUtilities != null) {
mapViewTrackingUtilities.resetDrivingRegionUpdate();
}
} else {
settings.DRIVING_REGION_AUTOMATIC.set(false);
settings.DRIVING_REGION.set(drs.get(which));
}
updateAllSettings();
}
});
b.setNegativeButton(R.string.shared_string_cancel, null);
b.show();
}
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals(settings.DRIVING_REGION.getId())) {
showDrivingRegionDialog();
return true;
}
return super.onPreferenceClick(preference);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
ChangeGeneralProfilesPrefBottomSheet.showInstance(fragmentManager, preference.getKey(), newValue, this);
}
return false;
}
}

View file

@ -0,0 +1,161 @@
package net.osmand.plus.settings;
import android.app.Activity;
import android.content.Context;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.FragmentManager;
import android.support.v7.preference.Preference;
import android.util.Pair;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsGeneralActivity;
import net.osmand.plus.dialogs.SendAnalyticsBottomSheetDialogFragment;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
public class GlobalSettingsFragment extends BaseSettingsFragment implements SendAnalyticsBottomSheetDialogFragment.OnSendAnalyticsPrefsUpdate, OnPreferenceChanged {
public static final String TAG = "GlobalSettingsFragment";
private static final String SEND_ANONYMOUS_DATA_PREF_ID = "send_anonymous_data";
@Override
protected int getPreferencesResId() {
return R.xml.global_settings;
}
@Override
protected int getToolbarResId() {
return R.layout.global_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.osmand_settings);
}
@Override
protected void setupPreferences() {
setupDefaultAppModePref();
setupPreferredLocalePref();
// setupExternalStorageDirPref();
setupSendAnonymousDataPref();
setupEnableProxyPref();
}
@Override
public void onDisplayPreferenceDialog(Preference preference) {
String prefId = preference.getKey();
if (prefId.equals(SEND_ANONYMOUS_DATA_PREF_ID)) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
SendAnalyticsBottomSheetDialogFragment.showInstance(app, fragmentManager, this);
}
} else {
super.onDisplayPreferenceDialog(preference);
}
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String prefId = preference.getKey();
if (prefId.equals(SEND_ANONYMOUS_DATA_PREF_ID)) {
if (newValue instanceof Boolean) {
boolean enabled = (Boolean) newValue;
if (enabled) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
SendAnalyticsBottomSheetDialogFragment.showInstance(app, fragmentManager, this);
}
} else {
settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.set(false);
settings.SEND_ANONYMOUS_APP_USAGE_DATA.set(false);
return true;
}
}
return false;
}
return super.onPreferenceChange(preference, newValue);
}
@Override
public void onPreferenceChanged(String prefId) {
if (prefId.equals(settings.DEFAULT_APPLICATION_MODE.getId())) {
setupDefaultAppModePref();
} else if (prefId.equals(settings.PREFERRED_LOCALE.getId())) {
// recreate activity to update locale
Activity activity = getActivity();
OsmandApplication app = getMyApplication();
if (app != null && activity != null) {
app.checkPreferredLocale();
activity.recreate();
}
}
}
@Override
public void onAnalyticsPrefsUpdate() {
setupSendAnonymousDataPref();
}
private void setupDefaultAppModePref() {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
ApplicationMode selectedMode = settings.DEFAULT_APPLICATION_MODE.get();
ApplicationMode[] appModes = ApplicationMode.values(app).toArray(new ApplicationMode[0]);
String[] entries = new String[appModes.length];
String[] entryValues = new String[appModes.length];
for (int i = 0; i < entries.length; i++) {
entries[i] = appModes[i].toHumanString(app);
entryValues[i] = appModes[i].getStringKey();
}
ListPreferenceEx defaultApplicationMode = (ListPreferenceEx) findPreference(settings.DEFAULT_APPLICATION_MODE.getId());
defaultApplicationMode.setIcon(getContentIcon(selectedMode.getIconRes()));
defaultApplicationMode.setEntries(entries);
defaultApplicationMode.setEntryValues(entryValues);
}
private void setupPreferredLocalePref() {
Context ctx = getContext();
if (ctx == null) {
return;
}
ListPreferenceEx preferredLocale = (ListPreferenceEx) findPreference(settings.PREFERRED_LOCALE.getId());
preferredLocale.setIcon(getContentIcon(R.drawable.ic_action_map_language));
preferredLocale.setSummary(settings.PREFERRED_LOCALE.get());
Pair<String[], String[]> preferredLocaleInfo = SettingsGeneralActivity.getPreferredLocaleIdsAndValues(ctx);
if (preferredLocaleInfo != null) {
preferredLocale.setEntries(preferredLocaleInfo.first);
preferredLocale.setEntryValues(preferredLocaleInfo.second);
}
// Add " (Display language)" to menu title in Latin letters for all non-en languages
if (!getResources().getString(R.string.preferred_locale).equals(getResources().getString(R.string.preferred_locale_no_translate))) {
preferredLocale.setTitle(getString(R.string.preferred_locale) + " (" + getString(R.string.preferred_locale_no_translate) + ")");
}
}
private void setupSendAnonymousDataPref() {
boolean enabled = settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get() || settings.SEND_ANONYMOUS_APP_USAGE_DATA.get();
SwitchPreference sendAnonymousData = (SwitchPreference) findPreference(SEND_ANONYMOUS_DATA_PREF_ID);
sendAnonymousData.setChecked(enabled);
}
private void setupEnableProxyPref() {
SwitchPreferenceEx enableProxy = (SwitchPreferenceEx) findPreference(settings.ENABLE_PROXY.getId());
enableProxy.setIcon(getContentIcon(R.drawable.ic_action_proxy));
}
}

View file

@ -0,0 +1,93 @@
package net.osmand.plus.settings;
import android.content.Intent;
import android.support.annotation.ColorRes;
import android.support.v4.app.FragmentManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.R;
import net.osmand.plus.profiles.SettingsProfileActivity;
import net.osmand.util.Algorithms;
public class MainSettingsFragment extends BaseSettingsFragment {
public static final String TAG = "MainSettingsFragment";
@Override
protected int getPreferencesResId() {
return R.xml.settings_main_screen;
}
@Override
protected int getToolbarResId() {
return R.layout.global_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.shared_string_settings);
}
@Override
public int getStatusBarColorId() {
return isNightMode() ? R.color.status_bar_color_light : R.color.status_bar_color_dark;
}
@ColorRes
protected int getBackgroundColor() {
return isNightMode() ? R.color.activity_background_color_dark : R.color.activity_background_color_light;
}
@Override
protected void setupPreferences() {
Preference globalSettings = findPreference("global_settings");
globalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
PreferenceCategory applicationProfiles = (PreferenceCategory) findPreference("application_profiles");
applicationProfiles.setIconSpaceReserved(true);
setupConfigureProfilePref();
setupManageProfilesPref();
}
private void setupManageProfilesPref() {
Preference manageProfiles = findPreference("manage_profiles");
manageProfiles.setIcon(getIcon(R.drawable.ic_action_manage_profiles));
manageProfiles.setIntent(new Intent(getActivity(), SettingsProfileActivity.class));
}
private void setupConfigureProfilePref() {
ApplicationMode selectedMode = getSelectedAppMode();
int iconRes = selectedMode.getIconRes();
int iconColor = getActiveProfileColor();
String title = selectedMode.toHumanString(getContext());
String profileType;
if (selectedMode.isCustomProfile()) {
profileType = String.format(getString(R.string.profile_type_descr_string), Algorithms.capitalizeFirstLetterAndLowercase(selectedMode.getParent().toHumanString(getContext())));
} else {
profileType = getString(R.string.profile_type_base_string);
}
Preference configureProfile = findPreference("configure_profile");
configureProfile.setIcon(getIcon(iconRes, iconColor));
configureProfile.setTitle(title);
configureProfile.setSummary(profileType);
}
public static boolean showInstance(FragmentManager fragmentManager) {
try {
MainSettingsFragment MainSettingsFragment = new MainSettingsFragment();
fragmentManager.beginTransaction()
.replace(R.id.fragmentContainer, MainSettingsFragment, TAG)
.addToBackStack(TAG)
.commitAllowingStateLoss();
return true;
} catch (Exception e) {
return false;
}
}
}

View file

@ -0,0 +1,132 @@
package net.osmand.plus.settings;
import android.support.v7.preference.Preference;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.AutoZoomMap;
import net.osmand.plus.R;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
public class MapDuringNavigationFragment extends BaseSettingsFragment {
public static final String TAG = "MapDuringNavigationFragment";
@Override
protected int getPreferencesResId() {
return R.xml.map_during_navigation;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.map_during_navigation);
}
@Override
protected void setupPreferences() {
Preference mapDuringNavigationInfo = findPreference("map_during_navigation_info");
mapDuringNavigationInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
setupAutoFollowPref();
setupAutoZoomMapPref();
setupSnapToRoadPref();
setupMapDirectionToCompassPref();
}
private void setupAutoFollowPref() {
Integer[] entryValues = new Integer[] {0, 5, 10, 15, 20, 25, 30, 45, 60, 90};
String[] entries = new String[entryValues.length];
entries[0] = getString(R.string.shared_string_never);
for (int i = 1; i < entryValues.length; i++) {
entries[i] = (int) entryValues[i] + " " + getString(R.string.int_seconds);
}
ListPreferenceEx autoFollowRoute = (ListPreferenceEx) findPreference(settings.AUTO_FOLLOW_ROUTE.getId());
autoFollowRoute.setEntries(entries);
autoFollowRoute.setEntryValues(entryValues);
}
private void setupAutoZoomMapPref() {
Integer[] entryValues = new Integer[AutoZoomMap.values().length + 1];
String[] entries = new String[entryValues.length];
int i = 0;
int selectedIndex = -1;
entries[i] = getString(R.string.auto_zoom_none);
entryValues[0] = 0;
if (!settings.AUTO_ZOOM_MAP.get()) {
selectedIndex = 0;
}
i++;
for (AutoZoomMap autoZoomMap : AutoZoomMap.values()) {
entries[i] = getString(autoZoomMap.name);
entryValues[i] = i;
if (selectedIndex == -1 && settings.AUTO_ZOOM_MAP_SCALE.get() == autoZoomMap) {
selectedIndex = i;
}
i++;
}
if (selectedIndex == -1) {
selectedIndex = 0;
}
ListPreferenceEx autoZoomMapPref = (ListPreferenceEx) findPreference(settings.AUTO_ZOOM_MAP.getId());
autoZoomMapPref.setEntries(entries);
autoZoomMapPref.setEntryValues(entryValues);
autoZoomMapPref.setValue(selectedIndex);
autoZoomMapPref.setPersistent(false);
}
private void setupSnapToRoadPref() {
SwitchPreferenceEx snapToRoad = (SwitchPreferenceEx) findPreference(settings.SNAP_TO_ROAD.getId());
snapToRoad.setTitle(getString(R.string.snap_to_road));
snapToRoad.setDescription(getString(R.string.snap_to_road_descr));
}
private void setupMapDirectionToCompassPref() {
String[] entries;
Float[] entryValues;
if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
entryValues = new Float[] {0f, 5f, 7f, 10f, 15f, 20f};
entries = new String[entryValues.length];
for (int i = 0; i < entryValues.length; i++) {
entries[i] = entryValues[i].intValue() + " " + getString(R.string.km_h);
}
} else {
Float[] speedLimitsMiles = new Float[] {-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f};
entryValues = new Float[] {0f, 3f, 5f, 7f, 10f, 15f};
entries = new String[entryValues.length];
for (int i = 0; i < entries.length; i++) {
entries[i] = speedLimitsMiles[i].intValue() + " " + getString(R.string.mile_per_hour);
}
}
ListPreferenceEx switchMapDirectionToCompass = (ListPreferenceEx) findPreference(settings.SWITCH_MAP_DIRECTION_TO_COMPASS.getId());
switchMapDirectionToCompass.setEntries(entries);
switchMapDirectionToCompass.setEntryValues(entryValues);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference.getKey().equals(settings.AUTO_ZOOM_MAP.getId())) {
if (newValue instanceof Integer) {
int position = (int) newValue;
if (position == 0) {
settings.AUTO_ZOOM_MAP.set(false);
} else {
settings.AUTO_ZOOM_MAP.set(true);
settings.AUTO_ZOOM_MAP_SCALE.set(OsmandSettings.AutoZoomMap.values()[position - 1]);
}
return true;
}
}
return super.onPreferenceChange(preference, newValue);
}
}

View file

@ -0,0 +1,50 @@
package net.osmand.plus.settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import net.osmand.plus.R;
public class NavigationFragment extends BaseSettingsFragment {
public static final String TAG = "NavigationFragment";
@Override
protected int getPreferencesResId() {
return R.xml.navigation_settings_new;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar_big;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.routing_settings_2);
}
@Override
protected void setupPreferences() {
Preference routeParameters = findPreference("route_parameters");
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
Preference mapDuringNavigation = findPreference("map_during_navigation");
mapDuringNavigation.setIconSpaceReserved(true);
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
routeParameters.setIcon(getContentIcon(R.drawable.ic_action_route_distance));
showRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_alert));
speakRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_volume_up));
turnScreenOn.setIcon(getContentIcon(R.drawable.ic_action_turn_screen_on));
setupVehicleParametersPref();
}
private void setupVehicleParametersPref() {
Preference vehicleParameters = findPreference("vehicle_parameters");
int iconRes = getSelectedAppMode().getIconRes();
vehicleParameters.setIcon(getContentIcon(iconRes));
}
}

View file

@ -0,0 +1,7 @@
package net.osmand.plus.settings;
public interface OnPreferenceChanged {
void onPreferenceChanged(String prefId);
}

View file

@ -0,0 +1,89 @@
package net.osmand.plus.settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.widget.Toast;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.R;
import net.osmand.plus.settings.preferences.EditTextPreferenceEx;
import static net.osmand.plus.activities.SettingsGeneralActivity.IP_ADDRESS_PATTERN;
public class ProxySettingsFragment extends BaseSettingsFragment {
public static final String TAG = ProxySettingsFragment.class.getSimpleName();
@Override
protected int getPreferencesResId() {
return R.xml.proxy_preferences;
}
@Override
protected int getToolbarResId() {
return R.layout.global_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.proxy_pref_title);
}
@Override
protected void setupPreferences() {
Preference mapDuringNavigationInfo = findPreference("proxy_preferences_info");
mapDuringNavigationInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
setupProxyHostPref();
setupProxyPortPref();
}
private void setupProxyHostPref() {
EditTextPreferenceEx hostPref = (EditTextPreferenceEx) findPreference(settings.PROXY_HOST.getId());
hostPref.setPersistent(false);
hostPref.setSummary(settings.PROXY_HOST.get());
hostPref.setDescription(R.string.proxy_host_descr);
hostPref.setIconSpaceReserved(true);
}
private void setupProxyPortPref() {
EditTextPreferenceEx portPref = (EditTextPreferenceEx) findPreference(settings.PROXY_PORT.getId());
portPref.setPersistent(false);
portPref.setSummary(String.valueOf(settings.PROXY_PORT.get()));
portPref.setDescription(R.string.proxy_port_descr);
portPref.setIconSpaceReserved(true);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String prefId = preference.getKey();
if (prefId.equals(settings.ENABLE_PROXY.getId())) {
return true;
} else if (prefId.equals(settings.PROXY_HOST.getId())) {
String ipAddress = (String) newValue;
if (ipAddress.matches(IP_ADDRESS_PATTERN)) {
settings.PROXY_HOST.set(ipAddress);
settings.ENABLE_PROXY.set(NetworkUtils.getProxy() != null);
preference.setSummary(ipAddress);
return true;
} else {
Toast.makeText(getContext(), getString(R.string.wrong_format), Toast.LENGTH_SHORT).show();
return false;
}
} else if (prefId.equals(settings.PROXY_PORT.getId())) {
int port = -1;
String portString = (String) newValue;
try {
port = Integer.valueOf(portString.replaceAll("[^0-9]", ""));
} catch (NumberFormatException e1) {
}
settings.PROXY_PORT.set(port);
settings.ENABLE_PROXY.set(NetworkUtils.getProxy() != null);
preference.setSummary(String.valueOf(port));
return true;
}
return super.onPreferenceChange(preference, newValue);
}
}

View file

@ -0,0 +1,258 @@
package net.osmand.plus.settings;
import android.graphics.drawable.Drawable;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.BooleanPreference;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.activities.SettingsNavigationActivity;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper;
import net.osmand.plus.routing.RouteProvider;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import net.osmand.router.GeneralRouter;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
public class RouteParametersFragment extends BaseSettingsFragment {
public static final String TAG = "RouteParametersFragment";
private static final String AVOID_ROUTING_PARAMETER_PREFIX = "avoid_";
private static final String PREFER_ROUTING_PARAMETER_PREFIX = "prefer_";
private static final String RELIEF_SMOOTHNESS_FACTOR = "relief_smoothness_factor";
private List<GeneralRouter.RoutingParameter> avoidParameters = new ArrayList<GeneralRouter.RoutingParameter>();
private List<GeneralRouter.RoutingParameter> preferParameters = new ArrayList<GeneralRouter.RoutingParameter>();
private List<GeneralRouter.RoutingParameter> reliefFactorParameters = new ArrayList<GeneralRouter.RoutingParameter>();
private List<GeneralRouter.RoutingParameter> otherRoutingParameters = new ArrayList<GeneralRouter.RoutingParameter>();
@Override
protected int getPreferencesResId() {
return R.xml.route_parameters;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.route_parameters);
}
@Override
protected void setupPreferences() {
Preference vehicleParametersInfo = findPreference("route_parameters_info");
vehicleParametersInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
vehicleParametersInfo.setTitle(getString(R.string.route_parameters_info, getSelectedAppMode().toHumanString(getContext())));
setupRoutingPrefs();
setupTimeConditionalRoutingPref();
}
private void setupTimeConditionalRoutingPref() {
SwitchPreference timeConditionalRouting = createSwitchPreferenceEx(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId(), R.string.temporary_conditional_routing, R.layout.preference_dialog_and_switch);
timeConditionalRouting.setIcon(getRoutingPrefIcon(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId()));
timeConditionalRouting.setSummaryOn(R.string.shared_string_enable);
timeConditionalRouting.setSummaryOff(R.string.shared_string_disable);
getPreferenceScreen().addPreference(timeConditionalRouting);
}
private void setupRoutingPrefs() {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
PreferenceScreen screen = getPreferenceScreen();
SwitchPreferenceEx fastRoute = createSwitchPreferenceEx(app.getSettings().FAST_ROUTE_MODE.getId(), R.string.fast_route_mode, R.layout.preference_dialog_and_switch);
fastRoute.setIcon(getRoutingPrefIcon(app.getSettings().FAST_ROUTE_MODE.getId()));
fastRoute.setDescription(getString(R.string.fast_route_mode_descr));
fastRoute.setSummaryOn(R.string.shared_string_enable);
fastRoute.setSummaryOff(R.string.shared_string_disable);
if (app.getSettings().getApplicationMode().getRouteService() != RouteProvider.RouteService.OSMAND) {
screen.addPreference(fastRoute);
} else {
ApplicationMode am = app.getSettings().getApplicationMode();
GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), am);
clearParameters();
if (router != null) {
Map<String, GeneralRouter.RoutingParameter> parameters = router.getParameters();
if (parameters.containsKey(GeneralRouter.USE_SHORTEST_WAY)) {
screen.addPreference(fastRoute);
}
for (Map.Entry<String, GeneralRouter.RoutingParameter> e : parameters.entrySet()) {
String param = e.getKey();
GeneralRouter.RoutingParameter routingParameter = e.getValue();
if (param.startsWith(AVOID_ROUTING_PARAMETER_PREFIX)) {
avoidParameters.add(routingParameter);
} else if (param.startsWith(PREFER_ROUTING_PARAMETER_PREFIX)) {
preferParameters.add(routingParameter);
} else if (RELIEF_SMOOTHNESS_FACTOR.equals(routingParameter.getGroup())) {
reliefFactorParameters.add(routingParameter);
} else if (!param.equals(GeneralRouter.USE_SHORTEST_WAY)
&& !param.equals(GeneralRouter.VEHICLE_HEIGHT)
&& !param.equals(GeneralRouter.VEHICLE_WEIGHT)
&& !RoutingOptionsHelper.DRIVING_STYLE.equals(routingParameter.getGroup())) {
otherRoutingParameters.add(routingParameter);
}
}
if (avoidParameters.size() > 0) {
MultiSelectBooleanPreference avoidRouting = new MultiSelectBooleanPreference(app);
avoidRouting.setKey(AVOID_ROUTING_PARAMETER_PREFIX);
avoidRouting.setTitle(R.string.avoid_in_routing_title);
avoidRouting.setSummary(R.string.avoid_in_routing_descr);
avoidRouting.setDescription(R.string.avoid_in_routing_descr);
avoidRouting.setLayoutResource(R.layout.preference_with_descr);
avoidRouting.setIcon(getRoutingPrefIcon(AVOID_ROUTING_PARAMETER_PREFIX));
String[] entries = new String[avoidParameters.size()];
String[] prefsIds = new String[avoidParameters.size()];
Set<String> enabledPrefsIds = new HashSet<>();
for (int i = 0; i < avoidParameters.size(); i++) {
GeneralRouter.RoutingParameter p = avoidParameters.get(i);
BooleanPreference booleanRoutingPref = (BooleanPreference) settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
entries[i] = SettingsBaseActivity.getRoutingStringPropertyName(app, p.getId(), p.getName());
prefsIds[i] = booleanRoutingPref.getId();
if (booleanRoutingPref.get()) {
enabledPrefsIds.add(booleanRoutingPref.getId());
}
}
avoidRouting.setEntries(entries);
avoidRouting.setEntryValues(prefsIds);
avoidRouting.setValues(enabledPrefsIds);
avoidRouting.setIconSpaceReserved(true);
screen.addPreference(avoidRouting);
}
if (preferParameters.size() > 0) {
Preference preferRouting = new Preference(app);
preferRouting.setKey(PREFER_ROUTING_PARAMETER_PREFIX);
preferRouting.setTitle(R.string.prefer_in_routing_title);
preferRouting.setSummary(R.string.prefer_in_routing_descr);
preferRouting.setLayoutResource(R.layout.preference_with_descr);
preferRouting.setIconSpaceReserved(true);
screen.addPreference(preferRouting);
}
if (reliefFactorParameters.size() > 0) {
String defaultTitle = Algorithms.capitalizeFirstLetterAndLowercase(RELIEF_SMOOTHNESS_FACTOR.replace('_', ' '));
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, RELIEF_SMOOTHNESS_FACTOR, defaultTitle);
Object[] entryValues = new Object[reliefFactorParameters.size()];
String[] entries = new String[entryValues.length];
String selectedParameterId = null;
for (int i = 0; i < reliefFactorParameters.size(); i++) {
GeneralRouter.RoutingParameter parameter = reliefFactorParameters.get(i);
entryValues[i] = parameter.getId();
entries[i] = SettingsNavigationActivity.getRoutinParameterTitle(app, parameter);
if (SettingsNavigationActivity.isRoutingParameterSelected(settings, am, parameter)) {
selectedParameterId = parameter.getId();
}
}
ListPreferenceEx reliefFactorRouting = createListPreferenceEx(RELIEF_SMOOTHNESS_FACTOR, entries, entryValues, title, R.layout.preference_with_descr);
reliefFactorRouting.setPersistent(false);
reliefFactorRouting.setValue(selectedParameterId);
reliefFactorRouting.setDescription(R.string.relief_smoothness_factor_descr);
reliefFactorRouting.setIconSpaceReserved(true);
screen.addPreference(reliefFactorRouting);
}
for (GeneralRouter.RoutingParameter p : otherRoutingParameters) {
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, p.getId(), p.getName());
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(app, p.getId(), p.getDescription());
if (p.getType() == GeneralRouter.RoutingParameterType.BOOLEAN) {
OsmandSettings.OsmandPreference pref = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
SwitchPreferenceEx switchPreferenceEx = (SwitchPreferenceEx) createSwitchPreferenceEx(pref.getId(), title, description, R.layout.preference_dialog_and_switch);
switchPreferenceEx.setDescription(description);
switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
switchPreferenceEx.setSummaryOn(R.string.shared_string_enable);
switchPreferenceEx.setSummaryOff(R.string.shared_string_disable);
switchPreferenceEx.setIconSpaceReserved(true);
screen.addPreference(switchPreferenceEx);
} else {
Object[] vls = p.getPossibleValues();
String[] svlss = new String[vls.length];
int i = 0;
for (Object o : vls) {
svlss[i++] = o.toString();
}
OsmandSettings.OsmandPreference pref = settings.getCustomRoutingProperty(p.getId(), p.getType() == GeneralRouter.RoutingParameterType.NUMERIC ? "0.0" : "-");
ListPreferenceEx listPreferenceEx = (ListPreferenceEx) createListPreferenceEx(pref.getId(), p.getPossibleValueDescriptions(), svlss, title, R.layout.preference_with_descr);
listPreferenceEx.setDescription(description);
listPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
listPreferenceEx.setIconSpaceReserved(true);
screen.addPreference(listPreferenceEx);
}
}
}
}
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
if (RELIEF_SMOOTHNESS_FACTOR.equals(key)) {
if (newValue instanceof String) {
String selectedParameterId = (String) newValue;
for (GeneralRouter.RoutingParameter parameter : reliefFactorParameters) {
String parameterId = parameter.getId();
SettingsNavigationActivity.setRoutingParameterSelected(settings, getSelectedAppMode(), parameterId, parameter.getDefaultBoolean(), parameterId.equals(selectedParameterId));
}
}
return true;
}
return super.onPreferenceChange(preference, newValue);
}
private void clearParameters() {
avoidParameters.clear();
preferParameters.clear();
reliefFactorParameters.clear();
otherRoutingParameters.clear();
}
private Drawable getRoutingPrefIcon(String prefId) {
switch (prefId) {
case GeneralRouter.ALLOW_PRIVATE:
return getIcon(R.drawable.ic_action_private_access);
case AVOID_ROUTING_PARAMETER_PREFIX:
return getContentIcon(R.drawable.ic_action_alert);
case "fast_route_mode":
return getIcon(R.drawable.ic_action_fastest_route);
case "enable_time_conditional_routing":
return getContentIcon(R.drawable.ic_action_road_works_dark);
default:
return null;
}
}
}

View file

@ -0,0 +1,47 @@
package net.osmand.plus.settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import net.osmand.plus.R;
public class ScreenAlertsFragment extends BaseSettingsFragment {
public static final String TAG = "ScreenAlertsFragment";
@Override
protected int getPreferencesResId() {
return R.xml.screen_alerts;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
protected String getToolbarTitle() {
return getString(R.string.screen_alerts);
}
@Override
protected void setupPreferences() {
setupShowRoutingAlarmsPref();
Preference showRoutingAlarmsInfo = findPreference("show_routing_alarms_info");
SwitchPreference showTrafficWarnings = (SwitchPreference) findPreference(settings.SHOW_TRAFFIC_WARNINGS.getId());
SwitchPreference showPedestrian = (SwitchPreference) findPreference(settings.SHOW_PEDESTRIAN.getId());
SwitchPreference showCameras = (SwitchPreference) findPreference(settings.SHOW_CAMERAS.getId());
SwitchPreference showTunnels = (SwitchPreference) findPreference(settings.SHOW_TUNNELS.getId());
showRoutingAlarmsInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
showTrafficWarnings.setIcon(getIcon(R.drawable.list_warnings_traffic_calming));
showPedestrian.setIcon(getIcon(R.drawable.list_warnings_pedestrian));
showCameras.setIcon(getIcon(R.drawable.list_warnings_speed_camera));
showTunnels.setIcon(getIcon(R.drawable.list_warnings_tunnel));
}
private void setupShowRoutingAlarmsPref() {
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
}
}

View file

@ -0,0 +1,68 @@
package net.osmand.plus.settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import net.osmand.plus.R;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
public class TurnScreenOnFragment extends BaseSettingsFragment {
public static final String TAG = "TurnScreenOnFragment";
@Override
protected int getPreferencesResId() {
return R.xml.turn_screen_on;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.turn_screen_on);
}
@Override
protected void setupPreferences() {
setupTurnScreenOnPref();
Preference turnScreenOnInfo = findPreference("turn_screen_on_info");
turnScreenOnInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
setupTurnScreenOnTimePref();
setupTurnScreenOnSensorPref();
}
private void setupTurnScreenOnPref() {
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
}
private void setupTurnScreenOnTimePref() {
Integer[] entryValues = new Integer[] {0, 5, 10, 15, 20, 30, 45, 60};
String[] entries = new String[entryValues.length];
entries[0] = getString(R.string.shared_string_never);
for (int i = 1; i < entryValues.length; i++) {
entries[i] = entryValues[i] + " " + getString(R.string.int_seconds);
}
ListPreferenceEx turnScreenOnTime = (ListPreferenceEx) findPreference(settings.TURN_SCREEN_ON_TIME_INT.getId());
turnScreenOnTime.setEntries(entries);
turnScreenOnTime.setEntryValues(entryValues);
turnScreenOnTime.setIcon(getContentIcon(R.drawable.ic_action_time_span));
}
private void setupTurnScreenOnSensorPref() {
String title = getString(R.string.turn_screen_on_sensor);
String description = getString(R.string.turn_screen_on_sensor_descr);
SwitchPreferenceEx turnScreenOnSensor = (SwitchPreferenceEx) findPreference(settings.TURN_SCREEN_ON_SENSOR.getId());
turnScreenOnSensor.setIcon(getContentIcon(R.drawable.ic_action_sensor_interaction));
turnScreenOnSensor.setTitle(title);
turnScreenOnSensor.setDescription(description);
}
}

View file

@ -0,0 +1,129 @@
package net.osmand.plus.settings;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.preference.Preference;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.routing.RouteProvider;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.router.GeneralRouter;
import java.util.Map;
import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
import static net.osmand.plus.activities.SettingsNavigationActivity.showSeekbarSettingsDialog;
public class VehicleParametersFragment extends BaseSettingsFragment {
public static final String TAG = "VehicleParametersFragment";
@Override
protected int getPreferencesResId() {
return R.xml.vehicle_parameters;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.vehicle_parameters);
}
@Override
protected void setupPreferences() {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
Preference vehicleParametersInfo = findPreference("vehicle_parameters_info");
vehicleParametersInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
vehicleParametersInfo.setTitle(getString(R.string.route_parameters_info, getSelectedAppMode().toHumanString(getContext())));
if (app.getSettings().getApplicationMode().getRouteService() == RouteProvider.RouteService.OSMAND) {
GeneralRouter router = getRouter(app.getRoutingConfig(), getSelectedAppMode());
if (router != null) {
Map<String, GeneralRouter.RoutingParameter> parameters = router.getParameters();
GeneralRouter.RoutingParameter vehicleHeight = parameters.get(GeneralRouter.VEHICLE_HEIGHT);
if (vehicleHeight != null) {
setupCustomRoutingPropertyPref(vehicleHeight);
}
GeneralRouter.RoutingParameter vehicleWeight = parameters.get(GeneralRouter.VEHICLE_WEIGHT);
if (vehicleWeight != null) {
setupCustomRoutingPropertyPref(vehicleWeight);
}
if (router.getProfile() != GeneralRouter.GeneralRouterProfile.PUBLIC_TRANSPORT) {
setupDefaultSpeedPref();
}
}
}
}
private void setupCustomRoutingPropertyPref(GeneralRouter.RoutingParameter parameter) {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
String parameterId = parameter.getId();
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, parameterId, parameter.getName());
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(app, parameterId, parameter.getDescription());
String defValue = parameter.getType() == GeneralRouter.RoutingParameterType.NUMERIC ? "0.0" : "-";
OsmandSettings.StringPreference pref = (OsmandSettings.StringPreference) app.getSettings().getCustomRoutingProperty(parameterId, defValue);
Object[] values = parameter.getPossibleValues();
String[] valuesStr = new String[values.length];
for (int i = 0; i < values.length; i++) {
valuesStr[i] = values[i].toString();
}
ListPreferenceEx listPreference = createListPreferenceEx(pref.getId(), parameter.getPossibleValueDescriptions(), valuesStr, title, R.layout.preference_with_descr);
listPreference.setDescription(description);
listPreference.setIcon(getPreferenceIcon(parameterId));
getPreferenceScreen().addPreference(listPreference);
}
private void setupDefaultSpeedPref() {
Context ctx = getContext();
if (ctx == null) {
return;
}
Preference defaultSpeedPref = new Preference(ctx);
defaultSpeedPref.setKey(GeneralRouter.DEFAULT_SPEED);
defaultSpeedPref.setTitle(R.string.default_speed_setting_title);
defaultSpeedPref.setSummary(R.string.default_speed_setting_descr);
defaultSpeedPref.setIcon(getPreferenceIcon(GeneralRouter.DEFAULT_SPEED));
defaultSpeedPref.setLayoutResource(R.layout.preference_with_descr);
getPreferenceScreen().addPreference(defaultSpeedPref);
}
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals(GeneralRouter.DEFAULT_SPEED)) {
showSeekbarSettingsDialog(getActivity());
return true;
}
return super.onPreferenceClick(preference);
}
private Drawable getPreferenceIcon(String prefId) {
switch (prefId) {
case GeneralRouter.DEFAULT_SPEED:
return getContentIcon(R.drawable.ic_action_speed);
case GeneralRouter.VEHICLE_HEIGHT:
return getIcon(R.drawable.ic_action_height_limit);
case GeneralRouter.VEHICLE_WEIGHT:
return getIcon(R.drawable.ic_action_weight_limit);
default:
return null;
}
}
}

View file

@ -0,0 +1,266 @@
package net.osmand.plus.settings;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.AudioManager;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.Preference;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import java.util.Set;
import static net.osmand.plus.activities.SettingsNavigationActivity.MORE_VALUE;
public class VoiceAnnouncesFragment extends BaseSettingsFragment {
public static final String TAG = "VoiceAnnouncesFragment";
@Override
protected int getPreferencesResId() {
return R.xml.voice_announces;
}
@Override
protected int getToolbarResId() {
return R.layout.profile_preference_toolbar;
}
@Override
protected String getToolbarTitle() {
return getString(R.string.voice_announces);
}
protected void setupPreferences() {
setupSpeakRoutingAlarmsPref();
Preference voiceAnnouncesInfo = findPreference("voice_announces_info");
voiceAnnouncesInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
Preference languageAndOutput = findPreference("language_and_output");
SwitchPreference speakStreetNames = (SwitchPreference) findPreference(settings.SPEAK_STREET_NAMES.getId());
SwitchPreference speakTrafficWarnings = (SwitchPreference) findPreference(settings.SPEAK_TRAFFIC_WARNINGS.getId());
SwitchPreference speakPedestrian = (SwitchPreference) findPreference(settings.SPEAK_PEDESTRIAN.getId());
SwitchPreference speakSpeedLimit = (SwitchPreference) findPreference(settings.SPEAK_SPEED_LIMIT.getId());
speakStreetNames.setIconSpaceReserved(true);
speakTrafficWarnings.setIconSpaceReserved(true);
speakPedestrian.setIconSpaceReserved(true);
speakSpeedLimit.setIconSpaceReserved(true);
languageAndOutput.setIconSpaceReserved(true);
setupSpeedLimitExceedPref();
SwitchPreference speakSpeedCamera = (SwitchPreference) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
SwitchPreference speakTunnels = (SwitchPreference) findPreference(settings.SPEAK_TUNNELS.getId());
SwitchPreference announceWpt = (SwitchPreference) findPreference(settings.ANNOUNCE_WPT.getId());
SwitchPreference announceNearbyFavorites = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_FAVORITES.getId());
SwitchPreference announceNearbyPoi = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_POI.getId());
speakSpeedCamera.setIconSpaceReserved(true);
speakTunnels.setIconSpaceReserved(true);
announceWpt.setIconSpaceReserved(true);
announceNearbyFavorites.setIconSpaceReserved(true);
announceNearbyPoi.setIconSpaceReserved(true);
setupKeepInformingPref();
setupArrivalAnnouncementPref();
setupVoiceProviderPref();
if (!Version.isBlackberry(app)) {
setupAudioStreamGuidancePref();
setupInterruptMusicPref();
}
}
private void setupSpeakRoutingAlarmsPref() {
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
}
private void setupSpeedLimitExceedPref() {
Float[] speedLimitValues;
String[] speedLimitNames;
if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
speedLimitValues = new Float[] {-10f, -7f, -5f, 0f, 5f, 7f, 10f, 15f, 20f};
speedLimitNames = new String[speedLimitValues.length];
for (int i = 0; i < speedLimitValues.length; i++) {
speedLimitNames[i] = speedLimitValues[i].intValue() + " " + getString(R.string.km_h);
}
} else {
speedLimitValues = new Float[] {-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f};
speedLimitNames = new String[speedLimitValues.length];
for (int i = 0; i < speedLimitNames.length; i++) {
speedLimitNames[i] = speedLimitValues[i].intValue() + " " + getString(R.string.mile_per_hour);
}
}
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.SPEED_LIMIT_EXCEED.getId());
voiceProvider.setEntries(speedLimitNames);
voiceProvider.setEntryValues(speedLimitValues);
voiceProvider.setIconSpaceReserved(true);
}
private void setupKeepInformingPref() {
Integer[] keepInformingValues = new Integer[] {0, 1, 2, 3, 5, 7, 10, 15, 20, 25, 30};
String[] keepInformingNames = new String[keepInformingValues.length];
keepInformingNames[0] = getString(R.string.keep_informing_never);
for (int i = 1; i < keepInformingValues.length; i++) {
keepInformingNames[i] = keepInformingValues[i] + " " + getString(R.string.int_min);
}
ListPreferenceEx keepInforming = (ListPreferenceEx) findPreference(settings.KEEP_INFORMING.getId());
keepInforming.setEntries(keepInformingNames);
keepInforming.setEntryValues(keepInformingValues);
keepInforming.setIconSpaceReserved(true);
}
private void setupArrivalAnnouncementPref() {
Float[] arrivalValues = new Float[] {1.5f, 1f, 0.5f, 0.25f};
String[] arrivalNames = new String[] {
getString(R.string.arrival_distance_factor_early),
getString(R.string.arrival_distance_factor_normally),
getString(R.string.arrival_distance_factor_late),
getString(R.string.arrival_distance_factor_at_last)
};
ListPreferenceEx arrivalDistanceFactor = (ListPreferenceEx) findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
arrivalDistanceFactor.setEntries(arrivalNames);
arrivalDistanceFactor.setEntryValues(arrivalValues);
arrivalDistanceFactor.setIconSpaceReserved(true);
}
private void setupVoiceProviderPref() {
Activity activity = getActivity();
if (activity == null) {
return;
}
Set<String> voiceFiles = app.getRoutingOptionsHelper().getVoiceFiles(activity);
String[] entries = new String[voiceFiles.size() + 2];
String[] entryValues = new String[voiceFiles.size() + 2];
int k = 0;
// entries[k++] = getString(R.string.shared_string_none);
entryValues[k] = OsmandSettings.VOICE_PROVIDER_NOT_USE;
entries[k++] = getString(R.string.shared_string_do_not_use);
for (String s : voiceFiles) {
entries[k] = (s.contains("tts") ? getString(R.string.ttsvoice) + " " : "") + FileNameTranslationHelper.getVoiceName(activity, s);
entryValues[k] = s;
k++;
}
entryValues[k] = MORE_VALUE;
entries[k] = getString(R.string.install_more);
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.VOICE_PROVIDER.getId());
voiceProvider.setEntries(entries);
voiceProvider.setEntryValues(entryValues);
voiceProvider.setIcon(getContentIcon(R.drawable.ic_action_volume_up));
}
private void setupAudioStreamGuidancePref() {
String[] streamTypes = new String[] {
getString(R.string.voice_stream_music),
getString(R.string.voice_stream_notification),
getString(R.string.voice_stream_voice_call)
};
//getString(R.string.shared_string_default)};
Integer[] streamIntTypes = new Integer[] {
AudioManager.STREAM_MUSIC,
AudioManager.STREAM_NOTIFICATION,
AudioManager.STREAM_VOICE_CALL
};
//AudioManager.USE_DEFAULT_STREAM_TYPE};
ListPreferenceEx audioStreamGuidance = createListPreferenceEx(settings.AUDIO_STREAM_GUIDANCE.getId(), streamTypes, streamIntTypes, R.string.choose_audio_stream, R.layout.preference_with_descr);
audioStreamGuidance.setIconSpaceReserved(true);
getPreferenceScreen().addPreference(audioStreamGuidance);
audioStreamGuidance.setDependency(settings.SPEAK_ROUTING_ALARMS.getId());
}
private void setupInterruptMusicPref() {
Preference interruptMusicPref = createSwitchPreference(settings.INTERRUPT_MUSIC, R.string.interrupt_music, R.string.interrupt_music_descr, R.layout.preference_switch);
interruptMusicPref.setIconSpaceReserved(true);
getPreferenceScreen().addPreference(interruptMusicPref);
interruptMusicPref.setDependency(settings.SPEAK_ROUTING_ALARMS.getId());
}
public void confirmSpeedCamerasDlg() {
Context ctx = getContext();
if (ctx == null) {
return;
}
AlertDialog.Builder bld = new AlertDialog.Builder(ctx);
bld.setMessage(R.string.confirm_usage_speed_cameras);
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
settings.SPEAK_SPEED_CAMERA.set(true);
SwitchPreference speakSpeedCamera = (SwitchPreference) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
if (speakSpeedCamera != null) {
speakSpeedCamera.setChecked(true);
}
}
});
bld.setNegativeButton(R.string.shared_string_cancel, null);
bld.show();
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String prefId = preference.getKey();
if (prefId.equals(settings.VOICE_PROVIDER.getId())) {
if (MORE_VALUE.equals(newValue)) {
// listPref.set(oldValue); // revert the change..
final Intent intent = new Intent(getContext(), DownloadActivity.class);
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
intent.putExtra(DownloadActivity.FILTER_CAT, DownloadActivityType.VOICE_FILE.getTag());
startActivity(intent);
} else if (newValue instanceof String) {
settings.VOICE_PROVIDER.set((String) newValue);
app.initVoiceCommandPlayer(getActivity(), getSelectedAppMode(), false, null, true, false);
}
return true;
}
if (prefId.equals(settings.SPEAK_SPEED_CAMERA.getId())) {
if (!settings.SPEAK_SPEED_CAMERA.get()) {
confirmSpeedCamerasDlg();
return false;
} else {
return true;
}
}
if (prefId.equals(settings.AUDIO_STREAM_GUIDANCE.getId())) {
// Sync DEFAULT value with CAR value, as we have other way to set it for now
if (getSelectedAppMode().equals(ApplicationMode.CAR) && newValue instanceof Integer) {
settings.AUDIO_STREAM_GUIDANCE.setModeValue(ApplicationMode.DEFAULT, (Integer) newValue);
} else {
settings.AUDIO_STREAM_GUIDANCE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_STREAM_GUIDANCE.getModeValue(ApplicationMode.CAR));
}
settings.AUDIO_USAGE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_USAGE.getModeValue(ApplicationMode.CAR));
return true;
}
return super.onPreferenceChange(preference, newValue);
}
}

View file

@ -0,0 +1,29 @@
package net.osmand.plus.settings.bottomsheets;
import android.os.Bundle;
import android.support.v7.preference.DialogPreference.TargetFragment;
import android.support.v7.preference.Preference;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFragment {
public static final String PREFERENCE_ID = "preference_id";
private Preference preference;
public Preference getPreference() {
if (preference == null) {
Bundle args = getArguments();
if (args != null && args.containsKey(PREFERENCE_ID)) {
String prefId = args.getString(PREFERENCE_ID);
TargetFragment targetFragment = (TargetFragment) getTargetFragment();
if (targetFragment != null) {
preference = targetFragment.findPreference(prefId);
}
}
}
return preference;
}
}

View file

@ -0,0 +1,104 @@
package net.osmand.plus.settings.bottomsheets;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.BooleanPreference;
import net.osmand.plus.OsmandSettings.OsmandPreference;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import org.apache.commons.logging.Log;
public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = BooleanPreferenceBottomSheet.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(BooleanPreferenceBottomSheet.class);
@Override
public void createMenuItems(Bundle savedInstanceState) {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
final SwitchPreferenceEx switchPreference = getSwitchPreferenceEx();
if (switchPreference == null) {
return;
}
OsmandPreference preference = app.getSettings().getPreference(switchPreference.getKey());
if (!(preference instanceof BooleanPreference)) {
return;
}
String title = switchPreference.getTitle().toString();
items.add(new TitleItem(title));
final OsmandSettings.BooleanPreference pref = (BooleanPreference) preference;
final String on = getString(R.string.shared_string_on);
final String off = getString(R.string.shared_string_off);
boolean checked = pref.get();
final BottomSheetItemWithCompoundButton[] preferenceBtn = new BottomSheetItemWithCompoundButton[1];
preferenceBtn[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(checked)
.setTitle(checked ? on : off)
.setLayoutId(R.layout.bottom_sheet_item_with_switch)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean newValue = !pref.get();
if (switchPreference.callChangeListener(newValue)) {
switchPreference.setChecked(newValue);
preferenceBtn[0].setTitle(newValue ? on : off);
preferenceBtn[0].setChecked(newValue);
}
}
})
.create();
items.add(preferenceBtn[0]);
String description = switchPreference.getDescription();
if (description != null) {
BaseBottomSheetItem preferenceDescription = new BottomSheetItemWithDescription.Builder()
.setDescription(description)
.setLayoutId(R.layout.bottom_sheet_item_description_long)
.create();
items.add(preferenceDescription);
}
}
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
private SwitchPreferenceEx getSwitchPreferenceEx() {
return (SwitchPreferenceEx) getPreference();
}
public static void showInstance(@NonNull FragmentManager fm, String prefId, Fragment target) {
try {
if (fm.findFragmentByTag(BooleanPreferenceBottomSheet.TAG) == null) {
Bundle args = new Bundle();
args.putString(PREFERENCE_ID, prefId);
BooleanPreferenceBottomSheet fragment = new BooleanPreferenceBottomSheet();
fragment.setArguments(args);
fragment.setTargetFragment(target, 0);
fragment.show(fm, BooleanPreferenceBottomSheet.TAG);
}
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
}
}

View file

@ -0,0 +1,165 @@
package net.osmand.plus.settings.bottomsheets;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.OsmandSettings.OsmandPreference;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.settings.BaseSettingsFragment;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = "ChangeGeneralProfilesPrefBottomSheet";
private static final Log LOG = PlatformUtil.getLog(ChangeGeneralProfilesPrefBottomSheet.class);
private Object newValue;
@Override
public void createMenuItems(Bundle savedInstanceState) {
final OsmandApplication app = getMyApplication();
Bundle args = getArguments();
if (app == null || args == null || newValue == null || !args.containsKey(PREFERENCE_ID)) {
return;
}
final String prefId = args.getString(PREFERENCE_ID);
CommonPreference pref = getPreference(prefId);
if (pref == null) {
return;
}
items.add(new TitleItem(getString(R.string.change_default_settings)));
StringBuilder builder = new StringBuilder();
final List<ApplicationMode> values = ApplicationMode.values(app);
List<ApplicationMode> appModesSameValue = new ArrayList<>();
for (int i = 0; i < values.size(); i++) {
ApplicationMode mode = values.get(i);
Object modeValue = pref.getModeValue(mode);
if (modeValue instanceof Enum) {
modeValue = ((Enum) modeValue).ordinal();
}
if (modeValue.equals(newValue)) {
appModesSameValue.add(mode);
}
}
Iterator<ApplicationMode> iterator = appModesSameValue.iterator();
while (iterator.hasNext()) {
builder.append(iterator.next().toHumanString(app));
builder.append(iterator.hasNext() ? ", " : '.');
}
if (builder.length() > 0) {
CharSequence description = AndroidUtils.getStyledString(app.getString(R.string.pref_selected_by_default_for_profiles), builder.toString(), Typeface.BOLD);
items.add(new LongDescriptionItem(description));
}
BaseBottomSheetItem applyToAllProfiles = new SimpleBottomSheetItem.Builder()
.setTitle(getString(R.string.apply_to_all_profiles))
.setIcon(getActiveIcon(R.drawable.ic_action_copy))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (ApplicationMode mode : values) {
app.getSettings().setPreference(prefId, newValue, mode);
}
BaseSettingsFragment target = (BaseSettingsFragment) getTargetFragment();
if (target != null) {
target.updateAllSettings();
}
dismiss();
}
})
.create();
items.add(applyToAllProfiles);
ApplicationMode selectedAppMode = getMyApplication().getSettings().APPLICATION_MODE.get();
BaseBottomSheetItem applyToCurrentProfile = new SimpleBottomSheetItem.Builder()
.setTitle(getString(R.string.apply_to_current_profile, selectedAppMode.toHumanString(app)))
.setIcon(getActiveIcon(selectedAppMode.getIconRes()))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
app.getSettings().setPreference(prefId, newValue);
BaseSettingsFragment target = (BaseSettingsFragment) getTargetFragment();
if (target != null) {
target.updateAllSettings();
}
dismiss();
}
})
.create();
items.add(applyToCurrentProfile);
BaseBottomSheetItem discardChanges = new SimpleBottomSheetItem.Builder()
.setTitle(getString(R.string.discard_changes))
.setIcon(getActiveIcon(R.drawable.ic_action_undo_dark))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
})
.create();
items.add(discardChanges);
}
@Override
protected boolean hideButtonsContainer() {
return true;
}
private CommonPreference getPreference(String prefId) {
OsmandApplication app = getMyApplication();
if (app != null) {
OsmandPreference pref = app.getSettings().getPreference(prefId);
if (pref instanceof CommonPreference) {
return (CommonPreference) pref;
}
}
return null;
}
public static void showInstance(@NonNull FragmentManager fm, String prefId, Object newValue, Fragment target) {
try {
if (fm.findFragmentByTag(ChangeGeneralProfilesPrefBottomSheet.TAG) == null) {
Bundle args = new Bundle();
args.putString(PREFERENCE_ID, prefId);
ChangeGeneralProfilesPrefBottomSheet fragment = new ChangeGeneralProfilesPrefBottomSheet();
fragment.setArguments(args);
fragment.setTargetFragment(target, 0);
fragment.newValue = newValue;
fragment.show(fm, ChangeGeneralProfilesPrefBottomSheet.TAG);
}
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
}
}

View file

@ -0,0 +1,98 @@
package net.osmand.plus.settings.bottomsheets;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.widget.EditText;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.settings.preferences.EditTextPreferenceEx;
import net.osmand.util.Algorithms;
public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = EditTextPreferenceBottomSheet.class.getSimpleName();
private static final String EDIT_TEXT_PREFERENCE_KEY = "edit_text_preference_key";
private EditText editText;
@Override
public void createMenuItems(Bundle savedInstanceState) {
Context ctx = getContext();
EditTextPreferenceEx editTextPreference = getEditTextPreference();
if (ctx == null || editTextPreference == null) {
return;
}
items.add(new TitleItem(editTextPreference.getDialogTitle().toString()));
String text;
if (savedInstanceState != null) {
text = savedInstanceState.getString(EDIT_TEXT_PREFERENCE_KEY);
} else {
text = editTextPreference.getText();
}
editText = new EditText(ctx);
editText.setText(text);
items.add(new SimpleBottomSheetItem.Builder().setCustomView(editText).create());
String description = editTextPreference.getDescription();
if (!Algorithms.isEmpty(description)) {
items.add(new LongDescriptionItem(description));
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(EDIT_TEXT_PREFERENCE_KEY, editText.getText().toString());
}
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
@Override
protected int getRightBottomButtonTextId() {
return R.string.shared_string_apply;
}
@Override
protected void onRightBottomButtonClick() {
EditTextPreferenceEx editTextPreference = getEditTextPreference();
if (editTextPreference != null) {
String value = editText.getText().toString();
if (editTextPreference.callChangeListener(value)) {
editTextPreference.setText(value);
}
}
dismiss();
}
private EditTextPreferenceEx getEditTextPreference() {
return (EditTextPreferenceEx) getPreference();
}
public static boolean showInstance(@NonNull FragmentManager fragmentManager, String key, Fragment target) {
try {
Bundle args = new Bundle();
args.putString(PREFERENCE_ID, key);
EditTextPreferenceBottomSheet fragment = new EditTextPreferenceBottomSheet();
fragment.setTargetFragment(target, 0);
fragment.setArguments(args);
fragment.show(fragmentManager, TAG);
return true;
} catch (RuntimeException e) {
return false;
}
}
}

View file

@ -0,0 +1,168 @@
package net.osmand.plus.settings.bottomsheets;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class MultiSelectPreferencesBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = MultiSelectPreferencesBottomSheet.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(MultiSelectPreferencesBottomSheet.class);
private static final String PREFERENCES_IDS = "preferences_ids";
private static final String PREFERENCE_CHANGED = "preference_changed";
private static final String PREFERENCES_ENTRIES = "preferences_entries";
private static final String ENABLED_PREFERENCES_IDS = "enabled_preferences_ids";
private MultiSelectBooleanPreference multiSelectBooleanPreference;
private String[] prefsIds;
private CharSequence[] entries;
private Set<String> enabledPrefs = new HashSet<>();
private boolean prefChanged;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
multiSelectBooleanPreference = getListPreference();
if (savedInstanceState == null) {
if (multiSelectBooleanPreference.getEntries() == null || multiSelectBooleanPreference.getPrefsIds() == null) {
LOG.error("MultiSelectListPreference requires an entries array and an entryValues array.");
return;
}
enabledPrefs.clear();
enabledPrefs.addAll(multiSelectBooleanPreference.getValues());
prefChanged = false;
entries = multiSelectBooleanPreference.getEntries();
prefsIds = multiSelectBooleanPreference.getPrefsIds();
} else {
enabledPrefs.clear();
enabledPrefs.addAll(savedInstanceState.getStringArrayList(ENABLED_PREFERENCES_IDS));
prefChanged = savedInstanceState.getBoolean(PREFERENCE_CHANGED, false);
entries = savedInstanceState.getCharSequenceArray(PREFERENCES_ENTRIES);
prefsIds = savedInstanceState.getStringArray(PREFERENCES_IDS);
}
}
@Override
public void createMenuItems(Bundle savedInstanceState) {
final OsmandApplication app = getMyApplication();
if (app == null || multiSelectBooleanPreference == null || prefsIds == null || entries == null) {
return;
}
String title = multiSelectBooleanPreference.getDialogTitle().toString();
items.add(new TitleItem(title));
String description = multiSelectBooleanPreference.getDescription();
if (!Algorithms.isEmpty(description)) {
items.add(new LongDescriptionItem(description));
}
for (int i = 0; i < entries.length; i++) {
String prefId = prefsIds[i];
String prefTitle = entries[i].toString();
boolean selected = enabledPrefs.contains(prefId);
final int index = i;
final BottomSheetItemWithCompoundButton[] item = new BottomSheetItemWithCompoundButton[1];
item[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(selected)
.setTitle(prefTitle)
.setLayoutId(R.layout.bottom_sheet_item_with_switch_no_icon)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !item[0].isChecked();
if (checked) {
prefChanged |= enabledPrefs.add(prefsIds[index]);
} else {
prefChanged |= enabledPrefs.remove(prefsIds[index]);
}
item[0].setChecked(checked);
}
})
.setTag(prefId)
.create();
items.add(item[0]);
}
}
@Override
public void onResume() {
super.onResume();
for (BaseBottomSheetItem item : items) {
if (item instanceof BottomSheetItemWithCompoundButton) {
String prefId = (String) item.getTag();
((BottomSheetItemWithCompoundButton) item).setChecked(enabledPrefs.contains(prefId));
}
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(PREFERENCE_CHANGED, prefChanged);
outState.putStringArray(PREFERENCES_IDS, prefsIds);
outState.putStringArrayList(ENABLED_PREFERENCES_IDS, new ArrayList<>(enabledPrefs));
outState.putCharSequenceArray(PREFERENCES_ENTRIES, entries);
}
@Override
protected int getRightBottomButtonTextId() {
return R.string.shared_string_apply;
}
@Override
protected void onRightBottomButtonClick() {
if (prefChanged) {
final Set<String> values = enabledPrefs;
if (multiSelectBooleanPreference.callChangeListener(values)) {
multiSelectBooleanPreference.setValues(values);
}
}
prefChanged = false;
dismiss();
}
private MultiSelectBooleanPreference getListPreference() {
return (MultiSelectBooleanPreference) getPreference();
}
public static boolean showInstance(@NonNull FragmentManager fragmentManager, String prefId, Fragment target) {
try {
Bundle args = new Bundle();
args.putString(PREFERENCE_ID, prefId);
MultiSelectPreferencesBottomSheet fragment = new MultiSelectPreferencesBottomSheet();
fragment.setTargetFragment(target, 0);
fragment.setArguments(args);
fragment.show(fragmentManager, TAG);
return true;
} catch (RuntimeException e) {
return false;
}
}
}

View file

@ -0,0 +1,144 @@
package net.osmand.plus.settings.bottomsheets;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.settings.OnPreferenceChanged;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.util.Algorithms;
public class SingleSelectPreferenceBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = SingleSelectPreferenceBottomSheet.class.getSimpleName();
private static final String SELECTED_ENTRY_INDEX_KEY = "selected_entry_index_key";
private ListPreferenceEx listPreference;
private int selectedEntryIndex = -1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
listPreference = getListPreference();
if (savedInstanceState != null) {
selectedEntryIndex = savedInstanceState.getInt(SELECTED_ENTRY_INDEX_KEY);
} else if (listPreference != null) {
selectedEntryIndex = listPreference.findIndexOfValue(listPreference.getValue());
}
}
@Override
public void createMenuItems(Bundle savedInstanceState) {
Context ctx = getContext();
if (ctx == null || listPreference == null || listPreference.getEntries() == null || listPreference.getEntryValues() == null) {
return;
}
String title = listPreference.getDialogTitle().toString();
items.add(new TitleItem(title));
String description = listPreference.getDescription();
if (!Algorithms.isEmpty(description)) {
items.add(new LongDescriptionItem(description));
}
String[] entries = listPreference.getEntries();
for (int i = 0; i < entries.length; i++) {
final BaseBottomSheetItem[] preferenceItem = new BottomSheetItemWithCompoundButton[1];
preferenceItem[0] = new BottomSheetItemWithCompoundButton.Builder()
.setChecked(i == selectedEntryIndex)
.setButtonTintList(AndroidUtils.createCheckedColorStateList(ctx, R.color.icon_color_default_light, getActiveColorId()))
.setTitle(entries[i])
.setTag(i)
.setLayoutId(R.layout.bottom_sheet_item_with_radio_btn_left)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectedEntryIndex = (int) preferenceItem[0].getTag();
updateItems();
}
})
.create();
items.add(preferenceItem[0]);
}
}
@Override
public void onResume() {
super.onResume();
updateItems();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(SELECTED_ENTRY_INDEX_KEY, selectedEntryIndex);
}
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
@Override
protected int getRightBottomButtonTextId() {
return R.string.shared_string_apply;
}
@Override
protected void onRightBottomButtonClick() {
Object[] entryValues = listPreference.getEntryValues();
if (entryValues != null && selectedEntryIndex >= 0) {
Object value = entryValues[selectedEntryIndex];
if (listPreference.callChangeListener(value)) {
listPreference.setValue(value);
}
Fragment target = getTargetFragment();
if (target instanceof OnPreferenceChanged) {
((OnPreferenceChanged) target).onPreferenceChanged(listPreference.getKey());
}
}
dismiss();
}
private void updateItems() {
for (BaseBottomSheetItem item : items) {
if (item instanceof BottomSheetItemWithCompoundButton) {
boolean checked = item.getTag().equals(selectedEntryIndex);
((BottomSheetItemWithCompoundButton) item).setChecked(checked);
}
}
}
private ListPreferenceEx getListPreference() {
return (ListPreferenceEx) getPreference();
}
public static boolean showInstance(@NonNull FragmentManager fragmentManager, String key, Fragment target) {
try {
Bundle args = new Bundle();
args.putString(PREFERENCE_ID, key);
SingleSelectPreferenceBottomSheet fragment = new SingleSelectPreferenceBottomSheet();
fragment.setTargetFragment(target, 0);
fragment.setArguments(args);
fragment.show(fragmentManager, TAG);
return true;
} catch (RuntimeException e) {
return false;
}
}
}

View file

@ -0,0 +1,38 @@
package net.osmand.plus.settings.preferences;
import android.content.Context;
import android.support.v7.preference.EditTextPreference;
import android.util.AttributeSet;
public class EditTextPreferenceEx extends EditTextPreference {
private String description;
public EditTextPreferenceEx(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public EditTextPreferenceEx(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public EditTextPreferenceEx(Context context, AttributeSet attrs) {
super(context, attrs);
}
public EditTextPreferenceEx(Context context) {
super(context);
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setDescription(int descriptionResId) {
setDescription(getContext().getString(descriptionResId));
}
}

View file

@ -0,0 +1,150 @@
package net.osmand.plus.settings.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.preference.DialogPreference;
import android.support.v7.preference.PreferenceDataStore;
import android.util.AttributeSet;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandSettings.PreferencesDataStore;
public class ListPreferenceEx extends DialogPreference {
private String[] entries;
private Object[] entryValues;
private Object selectedValue;
private String description;
public ListPreferenceEx(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public ListPreferenceEx(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public ListPreferenceEx(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ListPreferenceEx(Context context) {
super(context);
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setDescription(int descriptionResId) {
setDescription(getContext().getString(descriptionResId));
}
public void setEntries(String[] entries) {
this.entries = entries;
}
public String[] getEntries() {
return entries;
}
public void setEntryValues(Object[] entryValues) {
this.entryValues = entryValues;
}
public Object[] getEntryValues() {
return entryValues;
}
public void setValueIndex(int index) {
if (entryValues != null && index >= 0 && index < entryValues.length) {
setValue(entryValues[index]);
}
}
public Object getValue() {
return selectedValue;
}
public String getEntry() {
int index = getValueIndex();
return index >= 0 && entries != null ? entries[index] : null;
}
public int findIndexOfValue(Object value) {
if (value != null && entryValues != null) {
for (int i = 0; i < entryValues.length; i++) {
if (entryValues[i].equals(value)) {
return i;
}
}
}
return -1;
}
private int getValueIndex() {
return findIndexOfValue(selectedValue);
}
@Override
public CharSequence getDialogTitle() {
CharSequence dialogTitle = super.getDialogTitle();
return dialogTitle != null ? dialogTitle : getTitle();
}
@Override
public CharSequence getSummary() {
String entry = getEntry();
return entry != null ? entry : super.getSummary();
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index) {
return getPersistedValue(null);
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
selectedValue = restoreValue ? getPersistedValue(selectedValue) : (String) defaultValue;
notifyChanged();
}
public void setValue(Object value) {
// Always persist/notify the first time.
final boolean changed = selectedValue == null || !selectedValue.equals(value);
if (changed) {
selectedValue = value;
persistValue(value);
notifyChanged();
}
}
private Object getPersistedValue(Object defaultValue) {
PreferenceDataStore dataStore = getPreferenceDataStore();
if (dataStore instanceof PreferencesDataStore) {
Object value = ((PreferencesDataStore) dataStore).getValue(getKey(), defaultValue);
if (value instanceof Enum) {
return ((Enum) value).ordinal();
} else if (value instanceof ApplicationMode) {
return ((ApplicationMode) value).getStringKey();
} else {
return value;
}
}
return null;
}
private void persistValue(Object value) {
if (!shouldPersist()) {
return;
}
PreferenceDataStore dataStore = getPreferenceDataStore();
if (dataStore instanceof PreferencesDataStore) {
((PreferencesDataStore) dataStore).putValue(getKey(), value);
}
}
}

View file

@ -0,0 +1,108 @@
package net.osmand.plus.settings.preferences;
import android.content.Context;
import android.support.v14.preference.MultiSelectListPreference;
import android.support.v7.preference.PreferenceDataStore;
import android.util.AttributeSet;
import net.osmand.plus.OsmandSettings.PreferencesDataStore;
import java.util.HashSet;
import java.util.Set;
public class MultiSelectBooleanPreference extends MultiSelectListPreference {
private String description;
public MultiSelectBooleanPreference(Context context) {
super(context);
}
public MultiSelectBooleanPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MultiSelectBooleanPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public MultiSelectBooleanPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public CharSequence getDialogTitle() {
CharSequence dialogTitle = super.getDialogTitle();
return dialogTitle != null ? dialogTitle : getTitle();
}
@SuppressWarnings("unchecked")
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
setValues(restoreValue ? getPersistedBooleanPrefsIds(getValues()) : (Set<String>) defaultValue);
}
public void setValues(Set<String> values) {
getValues().clear();
getValues().addAll(values);
persistBooleanPrefs();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setDescription(int descriptionResId) {
setDescription(getContext().getString(descriptionResId));
}
public String[] getPrefsIds() {
CharSequence[] entryValues = getEntryValues();
String[] prefsIds = new String[entryValues.length];
for (int i = 0; i < entryValues.length; i++) {
prefsIds[i] = entryValues[i].toString();
}
return prefsIds;
}
private void persistBooleanPrefs() {
if (!shouldPersist()) {
return;
}
PreferenceDataStore dataStore = getPreferenceDataStore();
if (dataStore instanceof PreferencesDataStore) {
PreferencesDataStore preferencesDataStore = (PreferencesDataStore) dataStore;
for (String prefId : getPrefsIds()) {
preferencesDataStore.putBoolean(prefId, getValues().contains(prefId));
}
}
}
public Set<String> getPersistedBooleanPrefsIds(Set<String> defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
Set<String> enabledPrefs = new HashSet<>();
PreferenceDataStore dataStore = getPreferenceDataStore();
if (dataStore instanceof PreferencesDataStore && getEntryValues() != null) {
PreferencesDataStore preferencesDataStore = (PreferencesDataStore) dataStore;
for (String prefId : getPrefsIds()) {
boolean enabled = preferencesDataStore.getBoolean(prefId, false);
if (enabled) {
enabledPrefs.add(prefId);
}
}
}
return enabledPrefs;
}
}

View file

@ -0,0 +1,41 @@
package net.osmand.plus.settings.preferences;
import android.content.Context;
import android.support.v14.preference.SwitchPreference;
import android.util.AttributeSet;
public class SwitchPreferenceEx extends SwitchPreference {
private String description;
public SwitchPreferenceEx(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public SwitchPreferenceEx(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SwitchPreferenceEx(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SwitchPreferenceEx(Context context) {
super(context);
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
protected void onClick() {
if (getFragment() == null && getIntent() == null) {
getPreferenceManager().showDialog(this);
}
}
}

View file

@ -366,6 +366,7 @@ public class MapWidgetRegistry {
}).setLayout(R.layout.list_item_text_button).createItem());
addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME);
addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
addControlId(map, cm, R.string.show_lanes, settings.SHOW_LANES);
}
public void updateMapMarkersMode(MapActivity mapActivity) {

View file

@ -1248,13 +1248,14 @@ public class RouteInfoWidgetsFactory {
}
public boolean updateInfo(DrawSettings drawSettings) {
boolean showRoutingAlarms = settings.SHOW_ROUTING_ALARMS.get();
boolean trafficWarnings = settings.SHOW_TRAFFIC_WARNINGS.get();
boolean cams = settings.SHOW_CAMERAS.get();
boolean peds = settings.SHOW_PEDESTRIAN.get();
boolean tunnels = settings.SHOW_TUNNELS.get();
boolean visible = false;
if ((rh.isFollowingMode() || trackingUtilities.isMapLinkedToLocation())
&& (trafficWarnings || cams)) {
&& showRoutingAlarms && (trafficWarnings || cams)) {
AlarmInfo alarm;
if(rh.isFollowingMode() && !rh.isDeviatedFromRoute() && rh.getCurrentGPXRoute() == null) {
alarm = wh.getMostImportantAlarm(settings.METRIC_SYSTEM.get(), cams);