Profile settings fourth part
This commit is contained in:
parent
bf486bbfd6
commit
3d99231ef1
34 changed files with 407 additions and 289 deletions
|
@ -11,12 +11,13 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<string name="utm_format_descr">"OsmAnd uses UTM Standard format which is similar but not identical to UTM Nato format."</string>
|
<string name="configure_profile_info">All settings below are affected only selected profile.</string>
|
||||||
|
<string name="utm_format_descr">OsmAnd uses UTM Standard format which is similar but not identical to UTM Nato format.</string>
|
||||||
<string name="shared_string_example">Example</string>
|
<string name="shared_string_example">Example</string>
|
||||||
<string name="navigate_point_format_utm">UTM Standard</string>
|
<string name="navigate_point_format_utm">UTM Standard</string>
|
||||||
<string name="navigate_point_format_olc">Open Location Code</string>
|
<string name="navigate_point_format_olc">Open Location Code</string>
|
||||||
<string name="coordinates_format_info">The selected format will be applied to all places in the application.</string>
|
<string name="coordinates_format_info">The selected format will be applied to all places in the application.</string>
|
||||||
<string name="pref_selected_by_default_for_profiles">This setting is selected by default for profiles: %s.</string>
|
<string name="pref_selected_by_default_for_profiles">This setting is selected by default for profiles: %s</string>
|
||||||
<string name="change_default_settings">Change default settings</string>
|
<string name="change_default_settings">Change default settings</string>
|
||||||
<string name="discard_changes">Discard changes</string>
|
<string name="discard_changes">Discard changes</string>
|
||||||
<string name="apply_to_current_profile">Apply to current %1$s profile</string>
|
<string name="apply_to_current_profile">Apply to current %1$s profile</string>
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
<string name="start_up_message_pref">Start up message</string>
|
<string name="start_up_message_pref">Start up message</string>
|
||||||
<string name="analytics_pref_title">Analytics</string>
|
<string name="analytics_pref_title">Analytics</string>
|
||||||
<string name="turn_screen_on_info">Show map during navigation above the lock screen.</string>
|
<string name="turn_screen_on_info">Show map during navigation above the lock screen.</string>
|
||||||
<string name="vehicle_parameters_info">These settings affect the construction of the route. Will be applied only to the selected profile: %1$s.</string>
|
<string name="route_parameters_info">These settings affect the construction of the route. Will be applied only to the selected profile: %1$s.</string>
|
||||||
<string name="wake_time">Wake time</string>
|
<string name="wake_time">Wake time</string>
|
||||||
<string name="units_and_formats">Units & formats</string>
|
<string name="units_and_formats">Units & formats</string>
|
||||||
<string name="appearance">Appearance</string>
|
<string name="appearance">Appearance</string>
|
||||||
|
@ -42,8 +43,6 @@
|
||||||
<string name="manage_profiles">Manage application profiles…</string>
|
<string name="manage_profiles">Manage application profiles…</string>
|
||||||
<string name="osmand_settings_descr">Affect the entire application</string>
|
<string name="osmand_settings_descr">Affect the entire application</string>
|
||||||
<string name="osmand_settings">OsmAnd settings</string>
|
<string name="osmand_settings">OsmAnd settings</string>
|
||||||
<string name="personal_account_descr">Create or Log in into personal account</string>
|
|
||||||
<string name="personal_account">Personal account</string>
|
|
||||||
<string name="copy_from_other_profile">Copy from other profile</string>
|
<string name="copy_from_other_profile">Copy from other profile</string>
|
||||||
<string name="turn_screen_on">Turn screen on</string>
|
<string name="turn_screen_on">Turn screen on</string>
|
||||||
<string name="map_during_navigation_info">Map during navigation</string>
|
<string name="map_during_navigation_info">Map during navigation</string>
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="configure_profile_info"
|
||||||
|
android:layout="@layout/preference_info"
|
||||||
|
android:persistent="false"
|
||||||
|
android:selectable="false"
|
||||||
|
android:title="@string/configure_profile_info" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="general_settings"
|
android:key="general_settings"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
|
@ -29,10 +36,9 @@
|
||||||
android:title="@string/configure_map"
|
android:title="@string/configure_map"
|
||||||
tools:icon="@drawable/ic_action_layers_dark" />
|
tools:icon="@drawable/ic_action_layers_dark" />
|
||||||
|
|
||||||
<Preference
|
<PreferenceCategory
|
||||||
android:key="plugin_settings"
|
android:key="plugin_settings"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:selectable="false"
|
|
||||||
android:summary="@string/list_of_installed_plugins"
|
android:summary="@string/list_of_installed_plugins"
|
||||||
android:title="@string/plugin_settings" />
|
android:title="@string/plugin_settings" />
|
||||||
|
|
||||||
|
|
|
@ -56,22 +56,29 @@
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="use_kalman_filter_compass"
|
android:key="use_kalman_filter_compass"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
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" />
|
android:title="@string/use_kalman_filter_compass" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="use_magnetic_field_sensor_compass"
|
android:key="use_magnetic_field_sensor_compass"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
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" />
|
android:title="@string/use_magnetic_sensor" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="map_empty_state_allowed"
|
android:key="map_empty_state_allowed"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
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" />
|
android:title="@string/tap_on_map_to_hide_interface" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="do_not_use_animations"
|
android:key="do_not_use_animations"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:summary="@string/do_not_use_animations_descr"
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on"
|
||||||
android:title="@string/do_not_use_animations" />
|
android:title="@string/do_not_use_animations" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
android:icon="@drawable/ic_world_globe_dark"
|
android:icon="@drawable/ic_world_globe_dark"
|
||||||
|
@ -31,17 +31,23 @@
|
||||||
android:icon="@drawable/ic_action_privacy_and_security"
|
android:icon="@drawable/ic_action_privacy_and_security"
|
||||||
android:key="send_anonymous_data"
|
android:key="send_anonymous_data"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
android:layout="@layout/preference_dialog_and_switch"
|
||||||
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on"
|
||||||
android:title="@string/analytics_pref_title" />
|
android:title="@string/analytics_pref_title" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:icon="@drawable/ic_action_notification"
|
android:icon="@drawable/ic_action_notification"
|
||||||
android:key="do_not_show_startup_messages"
|
android:key="do_not_show_startup_messages"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on"
|
||||||
android:title="@string/start_up_message_pref" />
|
android:title="@string/start_up_message_pref" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="enable_proxy"
|
android:key="enable_proxy"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
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"
|
android:title="@string/proxy_pref_title"
|
||||||
app:fragment="net.osmand.plus.settings.ProxySettingsFragment"
|
app:fragment="net.osmand.plus.settings.ProxySettingsFragment"
|
||||||
tools:icon="@drawable/ic_action_proxy" />
|
tools:icon="@drawable/ic_action_proxy" />
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="map_during_navigation_info"
|
android:key="map_during_navigation_info"
|
||||||
android:selectable="false"
|
|
||||||
android:layout="@layout/preference_info"
|
android:layout="@layout/preference_info"
|
||||||
|
android:selectable="false"
|
||||||
android:title="@string/map_during_navigation_info" />
|
android:title="@string/map_during_navigation_info" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="snap_to_road"
|
android:key="snap_to_road"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
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" />
|
android:title="@string/snap_to_road" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="show_routing_alarms"
|
android:key="show_routing_alarms"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
android:layout="@layout/preference_dialog_and_switch"
|
||||||
android:switchTextOff="@string/shared_string_off"
|
android:summaryOff="@string/shared_string_off"
|
||||||
android:switchTextOn="@string/shared_string_on"
|
android:summaryOn="@string/shared_string_on"
|
||||||
android:title="@string/screen_alerts"
|
android:title="@string/screen_alerts"
|
||||||
app:fragment="net.osmand.plus.settings.ScreenAlertsFragment"
|
app:fragment="net.osmand.plus.settings.ScreenAlertsFragment"
|
||||||
tools:icon="@drawable/ic_action_alert" />
|
tools:icon="@drawable/ic_action_alert" />
|
||||||
|
@ -48,10 +48,10 @@
|
||||||
app:fragment="net.osmand.plus.settings.MapDuringNavigationFragment" />
|
app:fragment="net.osmand.plus.settings.MapDuringNavigationFragment" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="turn_screen_on"
|
android:key="turn_screen_on_enabled"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
android:layout="@layout/preference_dialog_and_switch"
|
||||||
android:switchTextOff="@string/shared_string_off"
|
android:summaryOff="@string/shared_string_off"
|
||||||
android:switchTextOn="@string/shared_string_on"
|
android:summaryOn="@string/shared_string_on"
|
||||||
android:title="@string/turn_screen_on"
|
android:title="@string/turn_screen_on"
|
||||||
app:fragment="net.osmand.plus.settings.TurnScreenOnFragment"
|
app:fragment="net.osmand.plus.settings.TurnScreenOnFragment"
|
||||||
tools:icon="@drawable/ic_action_turn_screen_on" />
|
tools:icon="@drawable/ic_action_turn_screen_on" />
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="enable_proxy"
|
android:key="enable_proxy"
|
||||||
tools:title="@string/enable_proxy_title" />
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="proxy_preferences_info"
|
android:key="proxy_preferences_info"
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
android:layout="@layout/preference_info"
|
android:layout="@layout/preference_info"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
tools:title="@string/route_parameters" />
|
tools:title="@string/route_parameters_info" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -5,28 +5,33 @@
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="show_routing_alarms"
|
android:key="show_routing_alarms"
|
||||||
android:layout="@layout/preference_top_switch"
|
android:layout="@layout/preference_top_switch"
|
||||||
tools:summary="@string/shared_string_on" />
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:icon="@drawable/ic_action_info_dark"
|
|
||||||
android:key="show_routing_alarms_info"
|
android:key="show_routing_alarms_info"
|
||||||
android:selectable="false"
|
|
||||||
android:layout="@layout/preference_info"
|
android:layout="@layout/preference_info"
|
||||||
android:title="@string/screen_alerts_descr" />
|
android:selectable="false"
|
||||||
|
android:title="@string/screen_alerts_descr"
|
||||||
|
tools:icon="@drawable/ic_action_info_dark" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="show_routing_alarms"
|
||||||
android:key="show_traffic_warnings"
|
android:key="show_traffic_warnings"
|
||||||
android:title="@string/show_traffic_warnings" />
|
android:title="@string/show_traffic_warnings" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="show_routing_alarms"
|
||||||
android:key="show_pedestrian"
|
android:key="show_pedestrian"
|
||||||
android:title="@string/show_pedestrian_warnings" />
|
android:title="@string/show_pedestrian_warnings" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="show_routing_alarms"
|
||||||
android:key="show_cameras"
|
android:key="show_cameras"
|
||||||
android:title="@string/show_cameras" />
|
android:title="@string/show_cameras" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="show_routing_alarms"
|
||||||
android:key="show_tunnels"
|
android:key="show_tunnels"
|
||||||
android:title="@string/show_tunnels" />
|
android:title="@string/show_tunnels" />
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,6 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<!-- <Preference-->
|
|
||||||
<!-- android:key="personal_account"-->
|
|
||||||
<!-- android:layout="@layout/preference_with_descr"-->
|
|
||||||
<!-- android:persistent="false"-->
|
|
||||||
<!-- android:summary="@string/personal_account_descr"-->
|
|
||||||
<!-- android:title="@string/personal_account"-->
|
|
||||||
<!-- tools:icon="@drawable/ic_person" />-->
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="global_settings"
|
android:key="global_settings"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
|
|
|
@ -2,22 +2,29 @@
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="turn_screen_on"
|
android:key="turn_screen_on_enabled"
|
||||||
android:layout="@layout/preference_top_switch" />
|
android:layout="@layout/preference_top_switch"
|
||||||
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="turn_screen_on_info"
|
android:key="turn_screen_on_info"
|
||||||
android:layout="@layout/preference_info"
|
android:layout="@layout/preference_info"
|
||||||
|
android:persistent="false"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
android:title="@string/turn_screen_on_info" />
|
android:title="@string/turn_screen_on_info" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:dependency="turn_screen_on_enabled"
|
||||||
android:key="turn_screen_on_time_int"
|
android:key="turn_screen_on_time_int"
|
||||||
android:title="@string/wake_time" />
|
android:title="@string/wake_time" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
|
android:dependency="turn_screen_on_enabled"
|
||||||
android:key="turn_screen_on_sensor"
|
android:key="turn_screen_on_sensor"
|
||||||
android:layout="@layout/preference_dialog_and_switch"
|
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" />
|
android:title="@string/turn_screen_on_sensor" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -5,7 +5,9 @@
|
||||||
<Preference
|
<Preference
|
||||||
android:key="vehicle_parameters_info"
|
android:key="vehicle_parameters_info"
|
||||||
android:layout="@layout/preference_info"
|
android:layout="@layout/preference_info"
|
||||||
|
android:persistent="false"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
tools:title="@string/vehicle_parameters_info" />
|
tools:icon="@drawable/ic_action_info_dark"
|
||||||
|
tools:title="@string/route_parameters_info" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -5,71 +5,84 @@
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="speak_routing_alarms"
|
android:key="speak_routing_alarms"
|
||||||
android:layout="@layout/preference_top_switch"
|
android:layout="@layout/preference_top_switch"
|
||||||
tools:summary="@string/shared_string_on" />
|
android:summaryOff="@string/shared_string_off"
|
||||||
|
android:summaryOn="@string/shared_string_on" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="voice_announces_info"
|
android:key="voice_announces_info"
|
||||||
android:selectable="false"
|
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
|
android:selectable="false"
|
||||||
android:summary="@string/voice_announces_info"
|
android:summary="@string/voice_announces_info"
|
||||||
tools:icon="@drawable/ic_action_info_dark" />
|
tools:icon="@drawable/ic_action_info_dark" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speak_street_names"
|
android:key="speak_street_names"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_street_names" />
|
android:title="@string/speak_street_names" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speak_traffic_warnings"
|
android:key="speak_traffic_warnings"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_traffic_warnings" />
|
android:title="@string/speak_traffic_warnings" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speak_pedestrian"
|
android:key="speak_pedestrian"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_pedestrian" />
|
android:title="@string/speak_pedestrian" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speak_speed_limit"
|
android:key="speak_speed_limit"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_speed_limit" />
|
android:title="@string/speak_speed_limit" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speed_limit_exceed"
|
android:key="speed_limit_exceed"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:title="@string/speed_limit_exceed" />
|
android:title="@string/speed_limit_exceed" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speak_cameras"
|
android:key="speak_cameras"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_cameras" />
|
android:title="@string/speak_cameras" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="speak_tunnels"
|
android:key="speak_tunnels"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/show_tunnels" />
|
android:title="@string/show_tunnels" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="announce_wpt"
|
android:key="announce_wpt"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/shared_string_gpx_waypoints" />
|
android:title="@string/shared_string_gpx_waypoints" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="announce_nearby_favorites"
|
android:key="announce_nearby_favorites"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_favorites" />
|
android:title="@string/speak_favorites" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="announce_nearby_poi"
|
android:key="announce_nearby_poi"
|
||||||
android:layout="@layout/preference_switch"
|
android:layout="@layout/preference_switch"
|
||||||
android:title="@string/speak_poi" />
|
android:title="@string/speak_poi" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="keep_informing"
|
android:key="keep_informing"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:title="@string/keep_informing" />
|
android:title="@string/keep_informing" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="arrival_distance_factor"
|
android:key="arrival_distance_factor"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:title="@string/arrival_distance" />
|
android:title="@string/arrival_distance" />
|
||||||
|
@ -80,8 +93,10 @@
|
||||||
android:title="@string/language_and_output" />
|
android:title="@string/language_and_output" />
|
||||||
|
|
||||||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:dependency="speak_routing_alarms"
|
||||||
android:key="voice_provider"
|
android:key="voice_provider"
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
|
android:persistent="false"
|
||||||
android:title="@string/voice_provider"
|
android:title="@string/voice_provider"
|
||||||
tools:icon="@drawable/ic_action_volume_up" />
|
tools:icon="@drawable/ic_action_volume_up" />
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
|
import android.media.AudioAttributes;
|
||||||
|
import android.media.AudioManager;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -38,6 +40,7 @@ import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||||
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
|
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
|
import net.osmand.plus.voice.CommandPlayer;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -158,6 +161,7 @@ public class OsmandSettings {
|
||||||
ctx = clientContext;
|
ctx = clientContext;
|
||||||
this.settingsAPI = settinsAPI;
|
this.settingsAPI = settinsAPI;
|
||||||
CUSTOM_SHARED_PREFERENCES_NAME = CUSTOM_SHARED_PREFERENCES_PREFIX + sharedPreferencesName;
|
CUSTOM_SHARED_PREFERENCES_NAME = CUSTOM_SHARED_PREFERENCES_PREFIX + sharedPreferencesName;
|
||||||
|
dataStore = new PreferencesDataStore();
|
||||||
initPrefs();
|
initPrefs();
|
||||||
setCustomized();
|
setCustomized();
|
||||||
}
|
}
|
||||||
|
@ -471,9 +475,15 @@ public class OsmandSettings {
|
||||||
if (global) {
|
if (global) {
|
||||||
return set(obj);
|
return set(obj);
|
||||||
}
|
}
|
||||||
boolean ch = setValue(getProfilePreferences(mode), obj);
|
Object profilePrefs = getProfilePreferences(mode);
|
||||||
|
boolean changed = setValue(profilePrefs, obj);
|
||||||
|
|
||||||
|
if (changed && cache && cachedPreference == profilePrefs) {
|
||||||
|
cachedValue = obj;
|
||||||
|
}
|
||||||
|
|
||||||
fireEvent(obj);
|
fireEvent(obj);
|
||||||
return ch;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getProfileDefaultValue(ApplicationMode mode) {
|
public T getProfileDefaultValue(ApplicationMode mode) {
|
||||||
|
@ -1227,11 +1237,11 @@ public class OsmandSettings {
|
||||||
public final CommonPreference<Boolean> ENABLE_PROXY = new BooleanPreference("enable_proxy", false) {
|
public final CommonPreference<Boolean> ENABLE_PROXY = new BooleanPreference("enable_proxy", false) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean setValue(Object prefs, Boolean val) {
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
boolean changed = super.setValue(prefs, val);
|
boolean valueSet = super.setValue(prefs, val);
|
||||||
if (changed) {
|
if (valueSet) {
|
||||||
NetworkUtils.setProxy(val ? PROXY_HOST.get() : null, val ? PROXY_PORT.get() : 0);
|
NetworkUtils.setProxy(val ? PROXY_HOST.get() : null, val ? PROXY_PORT.get() : 0);
|
||||||
}
|
}
|
||||||
return changed;
|
return valueSet;
|
||||||
}
|
}
|
||||||
}.makeGlobal();
|
}.makeGlobal();
|
||||||
|
|
||||||
|
@ -1309,9 +1319,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_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_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> SPEAK_TUNNELS = new BooleanPreference("speak_tunnels", false).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true).makeProfile().cache();
|
|
||||||
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_FAVORITES = new BooleanPreference("announce_nearby_favorites", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true) {
|
||||||
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_POI = new BooleanPreference("announce_nearby_poi", false).makeProfile().cache();
|
@Override
|
||||||
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
|
boolean changed = super.setValue(prefs, val);
|
||||||
|
if (changed) {
|
||||||
|
SHOW_WPT.set(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
}.makeProfile().cache();
|
||||||
|
|
||||||
|
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_FAVORITES = new BooleanPreference("announce_nearby_favorites", false) {
|
||||||
|
@Override
|
||||||
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
|
boolean changed = super.setValue(prefs, val);
|
||||||
|
if (changed) {
|
||||||
|
SHOW_NEARBY_FAVORITES.set(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
}.makeProfile().cache();
|
||||||
|
|
||||||
|
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_POI = new BooleanPreference("announce_nearby_poi", false) {
|
||||||
|
@Override
|
||||||
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
|
boolean changed = super.setValue(prefs, val);
|
||||||
|
if (changed) {
|
||||||
|
SHOW_NEARBY_POI.set(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
}.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_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();
|
public final OsmandPreference<Boolean> GPX_CALCULATE_RTEPT = new BooleanPreference("gpx_routing_calculate_rtept", true).makeGlobal().cache();
|
||||||
|
@ -1437,7 +1480,7 @@ public class OsmandSettings {
|
||||||
KEEP_INFORMING.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0);
|
KEEP_INFORMING.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommonPreference<Boolean> TURN_SCREEN_ON = new BooleanPreference("turn_screen_on", false).makeProfile();
|
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();
|
public final CommonPreference<Integer> TURN_SCREEN_ON_TIME_INT = new IntPreference("turn_screen_on_time_int", 0).makeProfile();
|
||||||
|
|
||||||
|
@ -1487,8 +1530,31 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Integer> LEVEL_TO_SWITCH_VECTOR_RASTER = new IntPreference("level_to_switch_vector_raster", 1).makeGlobal().cache();
|
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
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Integer> AUDIO_STREAM_GUIDANCE = new IntPreference("audio_stream",
|
public final OsmandPreference<Integer> AUDIO_STREAM_GUIDANCE = new IntPreference("audio_stream", 3/*AudioManager.STREAM_MUSIC*/) {
|
||||||
3/*AudioManager.STREAM_MUSIC*/).makeProfile();
|
@Override
|
||||||
|
protected boolean setValue(Object prefs, Integer stream) {
|
||||||
|
boolean valueSet = super.setValue(prefs, stream);
|
||||||
|
|
||||||
|
if (valueSet) {
|
||||||
|
CommandPlayer player = ctx.getPlayer();
|
||||||
|
if (player != null) {
|
||||||
|
player.updateAudioStream(get());
|
||||||
|
}
|
||||||
|
// Sync corresponding AUDIO_USAGE value
|
||||||
|
ApplicationMode mode = APPLICATION_MODE.get();
|
||||||
|
if (stream == AudioManager.STREAM_MUSIC) {
|
||||||
|
AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE);
|
||||||
|
} else if (stream == AudioManager.STREAM_NOTIFICATION) {
|
||||||
|
AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_NOTIFICATION);
|
||||||
|
} else if (stream == AudioManager.STREAM_VOICE_CALL) {
|
||||||
|
AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_VOICE_COMMUNICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return valueSet;
|
||||||
|
}
|
||||||
|
}.makeProfile();
|
||||||
|
|
||||||
// Corresponding USAGE value for AudioAttributes
|
// Corresponding USAGE value for AudioAttributes
|
||||||
public final OsmandPreference<Integer> AUDIO_USAGE = new IntPreference("audio_usage",
|
public final OsmandPreference<Integer> AUDIO_USAGE = new IntPreference("audio_usage",
|
||||||
12/*AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE*/).makeProfile();
|
12/*AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE*/).makeProfile();
|
||||||
|
|
|
@ -645,7 +645,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
||||||
if (!initialSpeedCam) {
|
if (!initialSpeedCam) {
|
||||||
if (settings.SPEAK_SPEED_CAMERA.get()) {
|
if (settings.SPEAK_SPEED_CAMERA.get()) {
|
||||||
settings.SPEAK_SPEED_CAMERA.set(false);
|
settings.SPEAK_SPEED_CAMERA.set(false);
|
||||||
confirmSpeedCamerasDlg(SettingsNavigationActivity.this, settings);
|
confirmSpeedCamerasDlg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,8 +659,8 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void confirmSpeedCamerasDlg(Activity activity, final OsmandSettings settings) {
|
private void confirmSpeedCamerasDlg() {
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
||||||
bld.setMessage(R.string.confirm_usage_speed_cameras);
|
bld.setMessage(R.string.confirm_usage_speed_cameras);
|
||||||
bld.setPositiveButton(R.string.shared_string_yes, new OnClickListener() {
|
bld.setPositiveButton(R.string.shared_string_yes, new OnClickListener() {
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class LockHelper implements SensorEventListener {
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private CommonPreference<Integer> turnScreenOnTime;
|
private CommonPreference<Integer> turnScreenOnTime;
|
||||||
private CommonPreference<Boolean> turnScreenOnSensor;
|
private CommonPreference<Boolean> turnScreenOnSensor;
|
||||||
|
private CommonPreference<Boolean> turnScreenOnEnabled;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LockUIAdapter lockUIAdapter;
|
private LockUIAdapter lockUIAdapter;
|
||||||
|
@ -48,6 +49,7 @@ public class LockHelper implements SensorEventListener {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
uiHandler = new Handler();
|
uiHandler = new Handler();
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
|
turnScreenOnEnabled = settings.TURN_SCREEN_ON_ENABLED;
|
||||||
turnScreenOnTime = settings.TURN_SCREEN_ON_TIME_INT;
|
turnScreenOnTime = settings.TURN_SCREEN_ON_TIME_INT;
|
||||||
turnScreenOnSensor = settings.TURN_SCREEN_ON_SENSOR;
|
turnScreenOnSensor = settings.TURN_SCREEN_ON_SENSOR;
|
||||||
|
|
||||||
|
@ -116,7 +118,7 @@ public class LockHelper implements SensorEventListener {
|
||||||
|
|
||||||
private void unlockEvent() {
|
private void unlockEvent() {
|
||||||
int unlockTime = turnScreenOnTime.get();
|
int unlockTime = turnScreenOnTime.get();
|
||||||
if (unlockTime > 0) {
|
if (unlockTime > 0 && turnScreenOnEnabled.get()) {
|
||||||
timedUnlock(unlockTime * 1000L);
|
timedUnlock(unlockTime * 1000L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +167,7 @@ public class LockHelper implements SensorEventListener {
|
||||||
|
|
||||||
public void onStop(@NonNull Activity activity) {
|
public void onStop(@NonNull Activity activity) {
|
||||||
lock();
|
lock();
|
||||||
if (!activity.isFinishing() && isSensorEnabled()) {
|
if (!activity.isFinishing() && turnScreenOnEnabled.get() && isSensorEnabled()) {
|
||||||
switchSensorOn();
|
switchSensorOn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ public class WaypointHelper {
|
||||||
|
|
||||||
public boolean isTypeEnabled(int type) {
|
public boolean isTypeEnabled(int type) {
|
||||||
if (type == ALARMS) {
|
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) {
|
} else if (type == POI) {
|
||||||
return app.getSettings().SHOW_NEARBY_POI.getModeValue(appMode);
|
return app.getSettings().SHOW_NEARBY_POI.getModeValue(appMode);
|
||||||
} else if (type == FAVORITES) {
|
} else if (type == FAVORITES) {
|
||||||
|
@ -620,7 +620,8 @@ public class WaypointHelper {
|
||||||
AlarmInfo prevSpeedCam = null;
|
AlarmInfo prevSpeedCam = null;
|
||||||
for (AlarmInfo i : route.getAlarmInfo()) {
|
for (AlarmInfo i : route.getAlarmInfo()) {
|
||||||
if (i.getType() == AlarmInfoType.SPEED_CAMERA) {
|
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());
|
LocationPointWrapper lw = new LocationPointWrapper(route, ALARMS, i, 0, i.getLocationIndex());
|
||||||
if(prevSpeedCam != null &&
|
if(prevSpeedCam != null &&
|
||||||
MapUtils.getDistance(prevSpeedCam.getLatitude(), prevSpeedCam.getLongitude(),
|
MapUtils.getDistance(prevSpeedCam.getLatitude(), prevSpeedCam.getLongitude(),
|
||||||
|
@ -633,7 +634,8 @@ public class WaypointHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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());
|
LocationPointWrapper lw = new LocationPointWrapper(route, ALARMS, i, 0, i.getLocationIndex());
|
||||||
lw.setAnnounce(app.getSettings().SPEAK_TRAFFIC_WARNINGS.get());
|
lw.setAnnounce(app.getSettings().SPEAK_TRAFFIC_WARNINGS.get());
|
||||||
array.add(lw);
|
array.add(lw);
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (!poiFilters.isEmpty()) {
|
if (!poiFilters.isEmpty()) {
|
||||||
createPoiFiltersItems(mapActivity, poiFilters, optionsContainer);
|
createPoiFiltersItems(mapActivity, poiFilters, optionsContainer);
|
||||||
}
|
}
|
||||||
if (traffic) {
|
if (traffic && app.getSettings().SHOW_ROUTING_ALARMS.get()) {
|
||||||
createWaypointItem(mapActivity, optionsContainer, WaypointHelper.ALARMS);
|
createWaypointItem(mapActivity, optionsContainer, WaypointHelper.ALARMS);
|
||||||
}
|
}
|
||||||
if (fav) {
|
if (fav) {
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
package net.osmand.plus.routing;
|
package net.osmand.plus.routing;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import android.media.AudioManager;
|
||||||
import java.lang.ref.WeakReference;
|
import android.media.SoundPool;
|
||||||
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 net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
|
@ -26,8 +20,14 @@ import net.osmand.router.RouteSegmentResult;
|
||||||
import net.osmand.router.TurnType;
|
import net.osmand.router.TurnType;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import android.media.AudioManager;
|
import java.io.IOException;
|
||||||
import android.media.SoundPool;
|
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 {
|
public class VoiceRouter {
|
||||||
|
@ -907,13 +907,14 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void play(CommandBuilder p) {
|
private void play(CommandBuilder p) {
|
||||||
|
if (settings.SPEAK_ROUTING_ALARMS.get()) {
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
List<String> played = p.play();
|
List<String> played = p.play();
|
||||||
notifyOnVoiceMessage(p.getListCommands(), played);
|
notifyOnVoiceMessage(p.getListCommands(), played);
|
||||||
} else {
|
} else {
|
||||||
notifyOnVoiceMessage(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
|
notifyOnVoiceMessage(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeSound() {
|
private void makeSound() {
|
||||||
|
|
|
@ -281,7 +281,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
||||||
if (preference != null) {
|
if (preference != null) {
|
||||||
preference.setOnPreferenceChangeListener(this);
|
preference.setOnPreferenceChangeListener(this);
|
||||||
preference.setOnPreferenceClickListener(this);
|
preference.setOnPreferenceClickListener(this);
|
||||||
preference.setIconSpaceReserved(true);
|
|
||||||
|
|
||||||
if (preference instanceof ListPreference) {
|
if (preference instanceof ListPreference) {
|
||||||
ListPreference listPreference = (ListPreference) preference;
|
ListPreference listPreference = (ListPreference) preference;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ChangeGeneralProfilesPrefBottomSheet extends MenuBottomSheetDialogFragment {
|
public class ChangeGeneralProfilesPrefBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
@ -39,7 +40,7 @@ public class ChangeGeneralProfilesPrefBottomSheet extends MenuBottomSheetDialogF
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
final OsmandApplication app = getMyApplication();
|
final OsmandApplication app = getMyApplication();
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
if (app == null || args == null || !args.containsKey(PREFERENCE_ID)) {
|
if (app == null || args == null || newValue == null || !args.containsKey(PREFERENCE_ID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String prefId = args.getString(PREFERENCE_ID);
|
final String prefId = args.getString(PREFERENCE_ID);
|
||||||
|
@ -57,17 +58,18 @@ public class ChangeGeneralProfilesPrefBottomSheet extends MenuBottomSheetDialogF
|
||||||
for (int i = 0; i < values.size(); i++) {
|
for (int i = 0; i < values.size(); i++) {
|
||||||
ApplicationMode mode = values.get(i);
|
ApplicationMode mode = values.get(i);
|
||||||
Object modeValue = pref.getModeValue(mode);
|
Object modeValue = pref.getModeValue(mode);
|
||||||
|
if (modeValue instanceof Enum) {
|
||||||
|
modeValue = ((Enum) modeValue).ordinal();
|
||||||
|
}
|
||||||
if (modeValue.equals(newValue)) {
|
if (modeValue.equals(newValue)) {
|
||||||
appModesSameValue.add(mode);
|
appModesSameValue.add(mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < appModesSameValue.size(); i++) {
|
Iterator<ApplicationMode> iterator = appModesSameValue.iterator();
|
||||||
ApplicationMode mode = appModesSameValue.get(i);
|
while (iterator.hasNext()) {
|
||||||
builder.append(mode.toHumanString(app));
|
builder.append(iterator.next().toHumanString(app));
|
||||||
if (i < appModesSameValue.size() - 1) {
|
builder.append(iterator.hasNext() ? ", " : '.');
|
||||||
builder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builder.length() > 0) {
|
if (builder.length() > 0) {
|
||||||
|
@ -85,6 +87,10 @@ public class ChangeGeneralProfilesPrefBottomSheet extends MenuBottomSheetDialogF
|
||||||
for (ApplicationMode mode : values) {
|
for (ApplicationMode mode : values) {
|
||||||
app.getSettings().setPreference(prefId, newValue, mode);
|
app.getSettings().setPreference(prefId, newValue, mode);
|
||||||
}
|
}
|
||||||
|
BaseSettingsFragment target = (BaseSettingsFragment) getTargetFragment();
|
||||||
|
if (target != null) {
|
||||||
|
target.updateAllSettings();
|
||||||
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -101,6 +107,10 @@ public class ChangeGeneralProfilesPrefBottomSheet extends MenuBottomSheetDialogF
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
app.getSettings().setPreference(prefId, newValue);
|
app.getSettings().setPreference(prefId, newValue);
|
||||||
|
BaseSettingsFragment target = (BaseSettingsFragment) getTargetFragment();
|
||||||
|
if (target != null) {
|
||||||
|
target.updateAllSettings();
|
||||||
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
Preference generalSettings = findPreference("general_settings");
|
Preference generalSettings = findPreference("general_settings");
|
||||||
Preference navigationSettings = findPreference("navigation_settings");
|
Preference navigationSettings = findPreference("navigation_settings");
|
||||||
|
Preference pluginSettings = findPreference("plugin_settings");
|
||||||
|
|
||||||
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
|
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
|
||||||
navigationSettings.setIcon(getContentIcon(R.drawable.ic_action_gdirections_dark));
|
navigationSettings.setIcon(getContentIcon(R.drawable.ic_action_gdirections_dark));
|
||||||
|
|
|
@ -92,6 +92,7 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
utmPref.setKey(UTM_FORMAT);
|
utmPref.setKey(UTM_FORMAT);
|
||||||
|
utmPref.setTitle(R.string.navigate_point_format_utm);
|
||||||
utmPref.setPersistent(false);
|
utmPref.setPersistent(false);
|
||||||
utmPref.setOrder(4);
|
utmPref.setOrder(4);
|
||||||
utmPref.setLayoutResource(R.layout.preference_radio_button);
|
utmPref.setLayoutResource(R.layout.preference_radio_button);
|
||||||
|
|
|
@ -15,7 +15,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.StateChangedListener;
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -69,13 +68,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
||||||
appTheme.setEntries(new String[] {getString(R.string.dark_theme), getString(R.string.light_theme)});
|
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.setEntryValues(new Integer[] {OsmandSettings.OSMAND_DARK_THEME, OsmandSettings.OSMAND_LIGHT_THEME});
|
||||||
appTheme.setIcon(getOsmandThemeIcon());
|
appTheme.setIcon(getOsmandThemeIcon());
|
||||||
|
|
||||||
settings.OSMAND_THEME.addListener(new StateChangedListener<Integer>() {
|
|
||||||
@Override
|
|
||||||
public void stateChanged(Integer change) {
|
|
||||||
appTheme.setIcon(getOsmandThemeIcon());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getOsmandThemeIcon() {
|
private Drawable getOsmandThemeIcon() {
|
||||||
|
@ -87,13 +79,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
||||||
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.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.setEntryValues(new Integer[] {OsmandSettings.ROTATE_MAP_NONE, OsmandSettings.ROTATE_MAP_BEARING, OsmandSettings.ROTATE_MAP_COMPASS});
|
||||||
rotateMap.setIcon(getRotateMapIcon());
|
rotateMap.setIcon(getRotateMapIcon());
|
||||||
|
|
||||||
settings.ROTATE_MAP.addListener(new StateChangedListener<Integer>() {
|
|
||||||
@Override
|
|
||||||
public void stateChanged(Integer change) {
|
|
||||||
rotateMap.setIcon(getRotateMapIcon());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getRotateMapIcon() {
|
private Drawable getRotateMapIcon() {
|
||||||
|
@ -112,13 +97,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
||||||
mapScreenOrientation.setEntries(new String[] {getString(R.string.map_orientation_portrait), getString(R.string.map_orientation_landscape), getString(R.string.map_orientation_default)});
|
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.setEntryValues(new Integer[] {ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED});
|
||||||
mapScreenOrientation.setIcon(getMapScreenOrientationIcon());
|
mapScreenOrientation.setIcon(getMapScreenOrientationIcon());
|
||||||
|
|
||||||
settings.MAP_SCREEN_ORIENTATION.addListener(new StateChangedListener<Integer>() {
|
|
||||||
@Override
|
|
||||||
public void stateChanged(Integer change) {
|
|
||||||
mapScreenOrientation.setIcon(getMapScreenOrientationIcon());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getMapScreenOrientationIcon() {
|
private Drawable getMapScreenOrientationIcon() {
|
||||||
|
@ -157,21 +135,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
||||||
Preference coordinatesFormat = findPreference(settings.COORDINATES_FORMAT.getId());
|
Preference coordinatesFormat = findPreference(settings.COORDINATES_FORMAT.getId());
|
||||||
coordinatesFormat.setIcon(getContentIcon(R.drawable.ic_action_coordinates_widget));
|
coordinatesFormat.setIcon(getContentIcon(R.drawable.ic_action_coordinates_widget));
|
||||||
coordinatesFormat.setSummary(PointDescription.formatToHumanString(app, settings.COORDINATES_FORMAT.get()));
|
coordinatesFormat.setSummary(PointDescription.formatToHumanString(app, settings.COORDINATES_FORMAT.get()));
|
||||||
|
|
||||||
// coordinatesFormat.setEntries(new String[] {
|
|
||||||
// PointDescription.formatToHumanString(ctx, PointDescription.FORMAT_DEGREES),
|
|
||||||
// PointDescription.formatToHumanString(ctx, PointDescription.FORMAT_MINUTES),
|
|
||||||
// PointDescription.formatToHumanString(ctx, PointDescription.FORMAT_SECONDS),
|
|
||||||
// PointDescription.formatToHumanString(ctx, PointDescription.UTM_FORMAT),
|
|
||||||
// PointDescription.formatToHumanString(ctx, PointDescription.OLC_FORMAT)
|
|
||||||
// });
|
|
||||||
// coordinatesFormat.setPrefsIds(new Integer[] {
|
|
||||||
// PointDescription.FORMAT_DEGREES,
|
|
||||||
// PointDescription.FORMAT_MINUTES,
|
|
||||||
// PointDescription.FORMAT_SECONDS,
|
|
||||||
// PointDescription.UTM_FORMAT,
|
|
||||||
// PointDescription.OLC_FORMAT
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAngularUnitsPref() {
|
private void setupAngularUnitsPref() {
|
||||||
|
@ -200,36 +163,33 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
private void setupKalmanFilterPref() {
|
private void setupKalmanFilterPref() {
|
||||||
SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId());
|
SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId());
|
||||||
kalmanFilterPref.setSummaryOn(R.string.shared_string_on);
|
|
||||||
kalmanFilterPref.setSummaryOff(R.string.shared_string_off);
|
|
||||||
kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass));
|
kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass));
|
||||||
kalmanFilterPref.setDescription(getString(R.string.use_kalman_filter_compass_descr));
|
kalmanFilterPref.setDescription(getString(R.string.use_kalman_filter_compass_descr));
|
||||||
|
kalmanFilterPref.setIconSpaceReserved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupMagneticFieldSensorPref() {
|
private void setupMagneticFieldSensorPref() {
|
||||||
SwitchPreferenceEx useMagneticSensorPref = (SwitchPreferenceEx) findPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS.getId());
|
SwitchPreferenceEx useMagneticSensorPref = (SwitchPreferenceEx) findPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS.getId());
|
||||||
useMagneticSensorPref.setSummaryOn(R.string.shared_string_on);
|
|
||||||
useMagneticSensorPref.setSummaryOff(R.string.shared_string_off);
|
|
||||||
useMagneticSensorPref.setTitle(getString(R.string.use_magnetic_sensor));
|
useMagneticSensorPref.setTitle(getString(R.string.use_magnetic_sensor));
|
||||||
useMagneticSensorPref.setDescription(getString(R.string.use_magnetic_sensor_descr));
|
useMagneticSensorPref.setDescription(getString(R.string.use_magnetic_sensor_descr));
|
||||||
|
useMagneticSensorPref.setIconSpaceReserved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupMapEmptyStateAllowedPref() {
|
private void setupMapEmptyStateAllowedPref() {
|
||||||
SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.MAP_EMPTY_STATE_ALLOWED.getId());
|
SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.MAP_EMPTY_STATE_ALLOWED.getId());
|
||||||
mapEmptyStateAllowedPref.setSummaryOn(R.string.shared_string_on);
|
|
||||||
mapEmptyStateAllowedPref.setSummaryOff(R.string.shared_string_off);
|
|
||||||
mapEmptyStateAllowedPref.setTitle(getString(R.string.tap_on_map_to_hide_interface));
|
mapEmptyStateAllowedPref.setTitle(getString(R.string.tap_on_map_to_hide_interface));
|
||||||
mapEmptyStateAllowedPref.setDescription(getString(R.string.tap_on_map_to_hide_interface_descr));
|
mapEmptyStateAllowedPref.setDescription(getString(R.string.tap_on_map_to_hide_interface_descr));
|
||||||
|
mapEmptyStateAllowedPref.setIconSpaceReserved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDoNotUseAnimationsPref() {
|
private void setupDoNotUseAnimationsPref() {
|
||||||
SwitchPreference doNotUseAnimations = (SwitchPreference) findPreference(settings.DO_NOT_USE_ANIMATIONS.getId());
|
SwitchPreference doNotUseAnimations = (SwitchPreference) findPreference(settings.DO_NOT_USE_ANIMATIONS.getId());
|
||||||
doNotUseAnimations.setSummaryOn(R.string.shared_string_on);
|
doNotUseAnimations.setIconSpaceReserved(true);
|
||||||
doNotUseAnimations.setSummaryOff(R.string.shared_string_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupExternalInputDevicePref() {
|
private void setupExternalInputDevicePref() {
|
||||||
ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId());
|
ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId());
|
||||||
|
externalInputDevice.setIconSpaceReserved(true);
|
||||||
externalInputDevice.setEntries(new String[] {
|
externalInputDevice.setEntries(new String[] {
|
||||||
getString(R.string.sett_no_ext_input),
|
getString(R.string.sett_no_ext_input),
|
||||||
getString(R.string.sett_generic_ext_input),
|
getString(R.string.sett_generic_ext_input),
|
||||||
|
|
|
@ -319,21 +319,15 @@ public class GlobalSettingsFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
private void setupSendAnonymousDataPref() {
|
private void setupSendAnonymousDataPref() {
|
||||||
SwitchPreferenceEx sendAnonymousData = (SwitchPreferenceEx) findPreference(settings.SEND_ANONYMOUS_DATA.getId());
|
SwitchPreferenceEx sendAnonymousData = (SwitchPreferenceEx) findPreference(settings.SEND_ANONYMOUS_DATA.getId());
|
||||||
sendAnonymousData.setSummaryOn(R.string.shared_string_on);
|
|
||||||
sendAnonymousData.setSummaryOff(R.string.shared_string_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDoNotShowStartupMessagesPref() {
|
private void setupDoNotShowStartupMessagesPref() {
|
||||||
SwitchPreference doNotShowStartupMessages = (SwitchPreference) findPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES.getId());
|
SwitchPreference doNotShowStartupMessages = (SwitchPreference) findPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES.getId());
|
||||||
doNotShowStartupMessages.setSummaryOn(R.string.shared_string_on);
|
|
||||||
doNotShowStartupMessages.setSummaryOff(R.string.shared_string_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupEnableProxyPref() {
|
private void setupEnableProxyPref() {
|
||||||
SwitchPreferenceEx enableProxy = (SwitchPreferenceEx) findPreference(settings.ENABLE_PROXY.getId());
|
SwitchPreferenceEx enableProxy = (SwitchPreferenceEx) findPreference(settings.ENABLE_PROXY.getId());
|
||||||
enableProxy.setIcon(getContentIcon(R.drawable.ic_action_proxy));
|
enableProxy.setIcon(getContentIcon(R.drawable.ic_action_proxy));
|
||||||
enableProxy.setSummaryOn(R.string.shared_string_on);
|
|
||||||
enableProxy.setSummaryOff(R.string.shared_string_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,7 +30,6 @@ public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
Preference mapDuringNavigationInfo = findPreference("map_during_navigation_info");
|
Preference mapDuringNavigationInfo = findPreference("map_during_navigation_info");
|
||||||
mapDuringNavigationInfo.setTitle(R.string.map_during_navigation_info);
|
|
||||||
mapDuringNavigationInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
mapDuringNavigationInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||||
|
|
||||||
setupAutoFollowPref();
|
setupAutoFollowPref();
|
||||||
|
@ -86,8 +85,6 @@ public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
||||||
private void setupSnapToRoadPref() {
|
private void setupSnapToRoadPref() {
|
||||||
SwitchPreferenceEx snapToRoad = (SwitchPreferenceEx) findPreference(settings.SNAP_TO_ROAD.getId());
|
SwitchPreferenceEx snapToRoad = (SwitchPreferenceEx) findPreference(settings.SNAP_TO_ROAD.getId());
|
||||||
snapToRoad.setTitle(getString(R.string.snap_to_road));
|
snapToRoad.setTitle(getString(R.string.snap_to_road));
|
||||||
snapToRoad.setSummaryOn(R.string.shared_string_on);
|
|
||||||
snapToRoad.setSummaryOff(R.string.shared_string_off);
|
|
||||||
snapToRoad.setDescription(getString(R.string.snap_to_road_descr));
|
snapToRoad.setDescription(getString(R.string.snap_to_road_descr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,19 +27,24 @@ public class NavigationFragment extends BaseSettingsFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
Preference routeParameters = findPreference("route_parameters");
|
Preference routeParameters = findPreference("route_parameters");
|
||||||
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference("show_routing_alarms");
|
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
|
||||||
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference("speak_routing_alarms");
|
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
|
||||||
Preference vehicleParameters = findPreference("vehicle_parameters");
|
|
||||||
Preference mapDuringNavigation = findPreference("map_during_navigation");
|
Preference mapDuringNavigation = findPreference("map_during_navigation");
|
||||||
SwitchPreference turnScreenOn = (SwitchPreference) findPreference("turn_screen_on");
|
mapDuringNavigation.setIconSpaceReserved(true);
|
||||||
|
|
||||||
|
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
|
||||||
|
|
||||||
routeParameters.setIcon(getContentIcon(R.drawable.ic_action_route_distance));
|
routeParameters.setIcon(getContentIcon(R.drawable.ic_action_route_distance));
|
||||||
showRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_alert));
|
showRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_alert));
|
||||||
speakRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_volume_up));
|
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();
|
int iconRes = getSelectedAppMode().getIconRes();
|
||||||
vehicleParameters.setIcon(getContentIcon(iconRes));
|
vehicleParameters.setIcon(getContentIcon(iconRes));
|
||||||
|
|
||||||
turnScreenOn.setIcon(getContentIcon(R.drawable.ic_action_turn_screen_on));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,29 +41,22 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
private void setupEnableProxyPref() {
|
private void setupEnableProxyPref() {
|
||||||
SwitchPreference enableProxyPref = (SwitchPreference) findPreference(settings.ENABLE_PROXY.getId());
|
SwitchPreference enableProxyPref = (SwitchPreference) findPreference(settings.ENABLE_PROXY.getId());
|
||||||
enableProxyPref.setSummaryOn(R.string.shared_string_on);
|
|
||||||
enableProxyPref.setSummaryOff(R.string.shared_string_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupProxyHostPref() {
|
private void setupProxyHostPref() {
|
||||||
EditTextPreferenceEx hostPref = (EditTextPreferenceEx) findPreference(settings.PROXY_HOST.getId());
|
EditTextPreferenceEx hostPref = (EditTextPreferenceEx) findPreference(settings.PROXY_HOST.getId());
|
||||||
|
hostPref.setPersistent(false);
|
||||||
hostPref.setSummary(settings.PROXY_HOST.get());
|
hostPref.setSummary(settings.PROXY_HOST.get());
|
||||||
hostPref.setDescription(R.string.proxy_host_descr);
|
hostPref.setDescription(R.string.proxy_host_descr);
|
||||||
|
hostPref.setIconSpaceReserved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupProxyPortPref() {
|
private void setupProxyPortPref() {
|
||||||
EditTextPreferenceEx portPref = (EditTextPreferenceEx) findPreference(settings.PROXY_PORT.getId());
|
EditTextPreferenceEx portPref = (EditTextPreferenceEx) findPreference(settings.PROXY_PORT.getId());
|
||||||
|
portPref.setPersistent(false);
|
||||||
portPref.setSummary(String.valueOf(settings.PROXY_PORT.get()));
|
portPref.setSummary(String.valueOf(settings.PROXY_PORT.get()));
|
||||||
portPref.setDescription(R.string.proxy_port_descr);
|
portPref.setDescription(R.string.proxy_port_descr);
|
||||||
}
|
portPref.setIconSpaceReserved(true);
|
||||||
|
|
||||||
protected void enableProxy(boolean enable) {
|
|
||||||
settings.ENABLE_PROXY.set(enable);
|
|
||||||
if (enable) {
|
|
||||||
NetworkUtils.setProxy(settings.PROXY_HOST.get(), settings.PROXY_PORT.get());
|
|
||||||
} else {
|
|
||||||
NetworkUtils.setProxy(null, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,8 +69,8 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
|
||||||
String ipAddress = (String) newValue;
|
String ipAddress = (String) newValue;
|
||||||
if (ipAddress.matches(IP_ADDRESS_PATTERN)) {
|
if (ipAddress.matches(IP_ADDRESS_PATTERN)) {
|
||||||
settings.PROXY_HOST.set(ipAddress);
|
settings.PROXY_HOST.set(ipAddress);
|
||||||
enableProxy(NetworkUtils.getProxy() != null);
|
settings.ENABLE_PROXY.set(NetworkUtils.getProxy() != null);
|
||||||
setupProxyHostPref();
|
preference.setSummary(ipAddress);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getContext(), getString(R.string.wrong_format), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), getString(R.string.wrong_format), Toast.LENGTH_SHORT).show();
|
||||||
|
@ -91,8 +84,8 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
|
||||||
} catch (NumberFormatException e1) {
|
} catch (NumberFormatException e1) {
|
||||||
}
|
}
|
||||||
settings.PROXY_PORT.set(port);
|
settings.PROXY_PORT.set(port);
|
||||||
enableProxy(NetworkUtils.getProxy() != null);
|
settings.ENABLE_PROXY.set(NetworkUtils.getProxy() != null);
|
||||||
setupProxyPortPref();
|
preference.setSummary(String.valueOf(port));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package net.osmand.plus.settings;
|
package net.osmand.plus.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.v14.preference.SwitchPreference;
|
import android.support.v14.preference.SwitchPreference;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.BooleanPreference;
|
import net.osmand.plus.OsmandSettings.BooleanPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -58,6 +58,10 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupPreferences() {
|
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();
|
setupRoutingPrefs();
|
||||||
setupTimeConditionalRoutingPref();
|
setupTimeConditionalRoutingPref();
|
||||||
}
|
}
|
||||||
|
@ -71,22 +75,22 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupRoutingPrefs() {
|
private void setupRoutingPrefs() {
|
||||||
Context ctx = getContext();
|
OsmandApplication app = getMyApplication();
|
||||||
if (ctx == null) {
|
if (app == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PreferenceScreen screen = getPreferenceScreen();
|
PreferenceScreen screen = getPreferenceScreen();
|
||||||
|
|
||||||
SwitchPreferenceEx fastRoute = createSwitchPreferenceEx(settings.FAST_ROUTE_MODE.getId(), R.string.fast_route_mode, R.layout.preference_dialog_and_switch);
|
SwitchPreferenceEx fastRoute = createSwitchPreferenceEx(app.getSettings().FAST_ROUTE_MODE.getId(), R.string.fast_route_mode, R.layout.preference_dialog_and_switch);
|
||||||
fastRoute.setIcon(getRoutingPrefIcon(settings.FAST_ROUTE_MODE.getId()));
|
fastRoute.setIcon(getRoutingPrefIcon(app.getSettings().FAST_ROUTE_MODE.getId()));
|
||||||
fastRoute.setDescription(getString(R.string.fast_route_mode_descr));
|
fastRoute.setDescription(getString(R.string.fast_route_mode_descr));
|
||||||
fastRoute.setSummaryOn(R.string.shared_string_enable);
|
fastRoute.setSummaryOn(R.string.shared_string_enable);
|
||||||
fastRoute.setSummaryOff(R.string.shared_string_disable);
|
fastRoute.setSummaryOff(R.string.shared_string_disable);
|
||||||
|
|
||||||
if (settings.getApplicationMode().getRouteService() != RouteProvider.RouteService.OSMAND) {
|
if (app.getSettings().getApplicationMode().getRouteService() != RouteProvider.RouteService.OSMAND) {
|
||||||
screen.addPreference(fastRoute);
|
screen.addPreference(fastRoute);
|
||||||
} else {
|
} else {
|
||||||
ApplicationMode am = settings.getApplicationMode();
|
ApplicationMode am = app.getSettings().getApplicationMode();
|
||||||
GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), am);
|
GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), am);
|
||||||
clearParameters();
|
clearParameters();
|
||||||
if (router != null) {
|
if (router != null) {
|
||||||
|
@ -111,7 +115,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (avoidParameters.size() > 0) {
|
if (avoidParameters.size() > 0) {
|
||||||
MultiSelectBooleanPreference avoidRouting = new MultiSelectBooleanPreference(ctx);
|
MultiSelectBooleanPreference avoidRouting = new MultiSelectBooleanPreference(app);
|
||||||
avoidRouting.setKey(AVOID_ROUTING_PARAMETER_PREFIX);
|
avoidRouting.setKey(AVOID_ROUTING_PARAMETER_PREFIX);
|
||||||
avoidRouting.setTitle(R.string.avoid_in_routing_title);
|
avoidRouting.setTitle(R.string.avoid_in_routing_title);
|
||||||
avoidRouting.setSummary(R.string.avoid_in_routing_descr);
|
avoidRouting.setSummary(R.string.avoid_in_routing_descr);
|
||||||
|
@ -127,7 +131,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
GeneralRouter.RoutingParameter p = avoidParameters.get(i);
|
GeneralRouter.RoutingParameter p = avoidParameters.get(i);
|
||||||
BooleanPreference booleanRoutingPref = (BooleanPreference) settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
BooleanPreference booleanRoutingPref = (BooleanPreference) settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
||||||
|
|
||||||
entries[i] = SettingsBaseActivity.getRoutingStringPropertyName(ctx, p.getId(), p.getName());
|
entries[i] = SettingsBaseActivity.getRoutingStringPropertyName(app, p.getId(), p.getName());
|
||||||
prefsIds[i] = booleanRoutingPref.getId();
|
prefsIds[i] = booleanRoutingPref.getId();
|
||||||
|
|
||||||
if (booleanRoutingPref.get()) {
|
if (booleanRoutingPref.get()) {
|
||||||
|
@ -138,20 +142,22 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
avoidRouting.setEntries(entries);
|
avoidRouting.setEntries(entries);
|
||||||
avoidRouting.setEntryValues(prefsIds);
|
avoidRouting.setEntryValues(prefsIds);
|
||||||
avoidRouting.setValues(enabledPrefsIds);
|
avoidRouting.setValues(enabledPrefsIds);
|
||||||
|
avoidRouting.setIconSpaceReserved(true);
|
||||||
|
|
||||||
screen.addPreference(avoidRouting);
|
screen.addPreference(avoidRouting);
|
||||||
}
|
}
|
||||||
if (preferParameters.size() > 0) {
|
if (preferParameters.size() > 0) {
|
||||||
Preference preferRouting = new Preference(ctx);
|
Preference preferRouting = new Preference(app);
|
||||||
preferRouting.setKey(PREFER_ROUTING_PARAMETER_PREFIX);
|
preferRouting.setKey(PREFER_ROUTING_PARAMETER_PREFIX);
|
||||||
preferRouting.setTitle(R.string.prefer_in_routing_title);
|
preferRouting.setTitle(R.string.prefer_in_routing_title);
|
||||||
preferRouting.setSummary(R.string.prefer_in_routing_descr);
|
preferRouting.setSummary(R.string.prefer_in_routing_descr);
|
||||||
preferRouting.setLayoutResource(R.layout.preference_with_descr);
|
preferRouting.setLayoutResource(R.layout.preference_with_descr);
|
||||||
|
preferRouting.setIconSpaceReserved(true);
|
||||||
screen.addPreference(preferRouting);
|
screen.addPreference(preferRouting);
|
||||||
}
|
}
|
||||||
if (reliefFactorParameters.size() > 0) {
|
if (reliefFactorParameters.size() > 0) {
|
||||||
String defaultTitle = Algorithms.capitalizeFirstLetterAndLowercase(RELIEF_SMOOTHNESS_FACTOR.replace('_', ' '));
|
String defaultTitle = Algorithms.capitalizeFirstLetterAndLowercase(RELIEF_SMOOTHNESS_FACTOR.replace('_', ' '));
|
||||||
String title = SettingsBaseActivity.getRoutingStringPropertyName(ctx, RELIEF_SMOOTHNESS_FACTOR, defaultTitle);
|
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, RELIEF_SMOOTHNESS_FACTOR, defaultTitle);
|
||||||
|
|
||||||
Object[] entryValues = new Object[reliefFactorParameters.size()];
|
Object[] entryValues = new Object[reliefFactorParameters.size()];
|
||||||
String[] entries = new String[entryValues.length];
|
String[] entries = new String[entryValues.length];
|
||||||
|
@ -160,7 +166,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
for (int i = 0; i < reliefFactorParameters.size(); i++) {
|
for (int i = 0; i < reliefFactorParameters.size(); i++) {
|
||||||
GeneralRouter.RoutingParameter parameter = reliefFactorParameters.get(i);
|
GeneralRouter.RoutingParameter parameter = reliefFactorParameters.get(i);
|
||||||
entryValues[i] = parameter.getId();
|
entryValues[i] = parameter.getId();
|
||||||
entries[i] = SettingsNavigationActivity.getRoutinParameterTitle(ctx, parameter);
|
entries[i] = SettingsNavigationActivity.getRoutinParameterTitle(app, parameter);
|
||||||
if (SettingsNavigationActivity.isRoutingParameterSelected(settings, am, parameter)) {
|
if (SettingsNavigationActivity.isRoutingParameterSelected(settings, am, parameter)) {
|
||||||
selectedParameterId = parameter.getId();
|
selectedParameterId = parameter.getId();
|
||||||
}
|
}
|
||||||
|
@ -170,12 +176,13 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
reliefFactorRouting.setPersistent(false);
|
reliefFactorRouting.setPersistent(false);
|
||||||
reliefFactorRouting.setValue(selectedParameterId);
|
reliefFactorRouting.setValue(selectedParameterId);
|
||||||
reliefFactorRouting.setDescription(R.string.relief_smoothness_factor_descr);
|
reliefFactorRouting.setDescription(R.string.relief_smoothness_factor_descr);
|
||||||
|
reliefFactorRouting.setIconSpaceReserved(true);
|
||||||
|
|
||||||
screen.addPreference(reliefFactorRouting);
|
screen.addPreference(reliefFactorRouting);
|
||||||
}
|
}
|
||||||
for (GeneralRouter.RoutingParameter p : otherRoutingParameters) {
|
for (GeneralRouter.RoutingParameter p : otherRoutingParameters) {
|
||||||
String title = SettingsBaseActivity.getRoutingStringPropertyName(ctx, p.getId(), p.getName());
|
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, p.getId(), p.getName());
|
||||||
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(ctx, p.getId(), p.getDescription());
|
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(app, p.getId(), p.getDescription());
|
||||||
|
|
||||||
if (p.getType() == GeneralRouter.RoutingParameterType.BOOLEAN) {
|
if (p.getType() == GeneralRouter.RoutingParameterType.BOOLEAN) {
|
||||||
OsmandSettings.OsmandPreference pref = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
OsmandSettings.OsmandPreference pref = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
||||||
|
@ -185,6 +192,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
|
switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
|
||||||
switchPreferenceEx.setSummaryOn(R.string.shared_string_enable);
|
switchPreferenceEx.setSummaryOn(R.string.shared_string_enable);
|
||||||
switchPreferenceEx.setSummaryOff(R.string.shared_string_disable);
|
switchPreferenceEx.setSummaryOff(R.string.shared_string_disable);
|
||||||
|
switchPreferenceEx.setIconSpaceReserved(true);
|
||||||
|
|
||||||
screen.addPreference(switchPreferenceEx);
|
screen.addPreference(switchPreferenceEx);
|
||||||
} else {
|
} else {
|
||||||
|
@ -199,6 +207,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
ListPreferenceEx listPreferenceEx = (ListPreferenceEx) createListPreferenceEx(pref.getId(), p.getPossibleValueDescriptions(), svlss, title, R.layout.preference_with_descr);
|
ListPreferenceEx listPreferenceEx = (ListPreferenceEx) createListPreferenceEx(pref.getId(), p.getPossibleValueDescriptions(), svlss, title, R.layout.preference_with_descr);
|
||||||
listPreferenceEx.setDescription(description);
|
listPreferenceEx.setDescription(description);
|
||||||
listPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
|
listPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
|
||||||
|
listPreferenceEx.setIconSpaceReserved(true);
|
||||||
|
|
||||||
screen.addPreference(listPreferenceEx);
|
screen.addPreference(listPreferenceEx);
|
||||||
}
|
}
|
||||||
|
@ -226,8 +235,8 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearParameters() {
|
private void clearParameters() {
|
||||||
preferParameters.clear();
|
|
||||||
avoidParameters.clear();
|
avoidParameters.clear();
|
||||||
|
preferParameters.clear();
|
||||||
reliefFactorParameters.clear();
|
reliefFactorParameters.clear();
|
||||||
otherRoutingParameters.clear();
|
otherRoutingParameters.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,9 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
|
setupShowRoutingAlarmsPref();
|
||||||
|
|
||||||
Preference showRoutingAlarmsInfo = findPreference("show_routing_alarms_info");
|
Preference showRoutingAlarmsInfo = findPreference("show_routing_alarms_info");
|
||||||
|
|
||||||
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
|
|
||||||
showRoutingAlarms.setSummaryOn(R.string.shared_string_on);
|
|
||||||
showRoutingAlarms.setSummaryOff(R.string.shared_string_off);
|
|
||||||
|
|
||||||
SwitchPreference showTrafficWarnings = (SwitchPreference) findPreference(settings.SHOW_TRAFFIC_WARNINGS.getId());
|
SwitchPreference showTrafficWarnings = (SwitchPreference) findPreference(settings.SHOW_TRAFFIC_WARNINGS.getId());
|
||||||
SwitchPreference showPedestrian = (SwitchPreference) findPreference(settings.SHOW_PEDESTRIAN.getId());
|
SwitchPreference showPedestrian = (SwitchPreference) findPreference(settings.SHOW_PEDESTRIAN.getId());
|
||||||
SwitchPreference showCameras = (SwitchPreference) findPreference(settings.SHOW_CAMERAS.getId());
|
SwitchPreference showCameras = (SwitchPreference) findPreference(settings.SHOW_CAMERAS.getId());
|
||||||
|
@ -42,4 +39,9 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
|
||||||
showCameras.setIcon(getIcon(R.drawable.list_warnings_speed_camera));
|
showCameras.setIcon(getIcon(R.drawable.list_warnings_speed_camera));
|
||||||
showTunnels.setIcon(getIcon(R.drawable.list_warnings_tunnel));
|
showTunnels.setIcon(getIcon(R.drawable.list_warnings_tunnel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupShowRoutingAlarmsPref() {
|
||||||
|
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -38,9 +38,7 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupTurnScreenOnPref() {
|
private void setupTurnScreenOnPref() {
|
||||||
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON.getId());
|
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
|
||||||
turnScreenOn.setSummaryOn(R.string.shared_string_on);
|
|
||||||
turnScreenOn.setSummaryOff(R.string.shared_string_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupTurnScreenOnTimePref() {
|
private void setupTurnScreenOnTimePref() {
|
||||||
|
@ -65,8 +63,6 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
|
||||||
SwitchPreferenceEx turnScreenOnSensor = (SwitchPreferenceEx) findPreference(settings.TURN_SCREEN_ON_SENSOR.getId());
|
SwitchPreferenceEx turnScreenOnSensor = (SwitchPreferenceEx) findPreference(settings.TURN_SCREEN_ON_SENSOR.getId());
|
||||||
turnScreenOnSensor.setIcon(getContentIcon(R.drawable.ic_action_sensor_interaction));
|
turnScreenOnSensor.setIcon(getContentIcon(R.drawable.ic_action_sensor_interaction));
|
||||||
turnScreenOnSensor.setTitle(title);
|
turnScreenOnSensor.setTitle(title);
|
||||||
turnScreenOnSensor.setSummaryOn(R.string.shared_string_on);
|
|
||||||
turnScreenOnSensor.setSummaryOff(R.string.shared_string_off);
|
|
||||||
turnScreenOnSensor.setDescription(description);
|
turnScreenOnSensor.setDescription(description);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,9 +45,9 @@ public class VehicleParametersFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
Preference vehicleParametersInfo = findPreference("vehicle_parameters_info");
|
Preference vehicleParametersInfo = findPreference("vehicle_parameters_info");
|
||||||
vehicleParametersInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
vehicleParametersInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||||
vehicleParametersInfo.setTitle(getString(R.string.vehicle_parameters_info, getSelectedAppMode().toHumanString(getContext())));
|
vehicleParametersInfo.setTitle(getString(R.string.route_parameters_info, getSelectedAppMode().toHumanString(getContext())));
|
||||||
|
|
||||||
if (settings.getApplicationMode().getRouteService() == RouteProvider.RouteService.OSMAND) {
|
if (app.getSettings().getApplicationMode().getRouteService() == RouteProvider.RouteService.OSMAND) {
|
||||||
GeneralRouter router = getRouter(app.getRoutingConfig(), getSelectedAppMode());
|
GeneralRouter router = getRouter(app.getRoutingConfig(), getSelectedAppMode());
|
||||||
if (router != null) {
|
if (router != null) {
|
||||||
Map<String, GeneralRouter.RoutingParameter> parameters = router.getParameters();
|
Map<String, GeneralRouter.RoutingParameter> parameters = router.getParameters();
|
||||||
|
@ -68,16 +68,16 @@ public class VehicleParametersFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCustomRoutingPropertyPref(GeneralRouter.RoutingParameter parameter) {
|
private void setupCustomRoutingPropertyPref(GeneralRouter.RoutingParameter parameter) {
|
||||||
Context ctx = getContext();
|
OsmandApplication app = getMyApplication();
|
||||||
if (ctx == null) {
|
if (app == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String parameterId = parameter.getId();
|
String parameterId = parameter.getId();
|
||||||
String title = SettingsBaseActivity.getRoutingStringPropertyName(ctx, parameterId, parameter.getName());
|
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, parameterId, parameter.getName());
|
||||||
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(ctx, parameterId, parameter.getDescription());
|
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(app, parameterId, parameter.getDescription());
|
||||||
|
|
||||||
String defValue = parameter.getType() == GeneralRouter.RoutingParameterType.NUMERIC ? "0.0" : "-";
|
String defValue = parameter.getType() == GeneralRouter.RoutingParameterType.NUMERIC ? "0.0" : "-";
|
||||||
OsmandSettings.StringPreference pref = (OsmandSettings.StringPreference) settings.getCustomRoutingProperty(parameterId, defValue);
|
OsmandSettings.StringPreference pref = (OsmandSettings.StringPreference) app.getSettings().getCustomRoutingProperty(parameterId, defValue);
|
||||||
|
|
||||||
Object[] values = parameter.getPossibleValues();
|
Object[] values = parameter.getPossibleValues();
|
||||||
String[] valuesStr = new String[values.length];
|
String[] valuesStr = new String[values.length];
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
package net.osmand.plus.settings;
|
package net.osmand.plus.settings;
|
||||||
|
|
||||||
import android.media.AudioAttributes;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.support.v14.preference.SwitchPreference;
|
import android.support.v14.preference.SwitchPreference;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
|
|
||||||
import net.osmand.StateChangedListener;
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
import net.osmand.plus.voice.CommandPlayer;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -33,14 +36,13 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
return R.layout.profile_preference_toolbar;
|
return R.layout.profile_preference_toolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected String getToolbarTitle() {
|
protected String getToolbarTitle() {
|
||||||
return getString(R.string.voice_announces);
|
return getString(R.string.voice_announces);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
|
setupSpeakRoutingAlarmsPref();
|
||||||
speakRoutingAlarms.setSummaryOn(R.string.shared_string_on);
|
|
||||||
speakRoutingAlarms.setSummaryOff(R.string.shared_string_off);
|
|
||||||
|
|
||||||
Preference voiceAnnouncesInfo = findPreference("voice_announces_info");
|
Preference voiceAnnouncesInfo = findPreference("voice_announces_info");
|
||||||
voiceAnnouncesInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
voiceAnnouncesInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||||
|
@ -50,14 +52,25 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
SwitchPreference speakPedestrian = (SwitchPreference) findPreference(settings.SPEAK_PEDESTRIAN.getId());
|
SwitchPreference speakPedestrian = (SwitchPreference) findPreference(settings.SPEAK_PEDESTRIAN.getId());
|
||||||
SwitchPreference speakSpeedLimit = (SwitchPreference) findPreference(settings.SPEAK_SPEED_LIMIT.getId());
|
SwitchPreference speakSpeedLimit = (SwitchPreference) findPreference(settings.SPEAK_SPEED_LIMIT.getId());
|
||||||
|
|
||||||
setupSpeedLimitExceedPref();
|
speakStreetNames.setIconSpaceReserved(true);
|
||||||
setupSpeakSpeedCameraPref();
|
speakTrafficWarnings.setIconSpaceReserved(true);
|
||||||
|
speakPedestrian.setIconSpaceReserved(true);
|
||||||
|
speakSpeedLimit.setIconSpaceReserved(true);
|
||||||
|
|
||||||
|
setupSpeedLimitExceedPref();
|
||||||
|
|
||||||
|
SwitchPreference speakSpeedCamera = (SwitchPreference) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
|
||||||
SwitchPreference speakTunnels = (SwitchPreference) findPreference(settings.SPEAK_TUNNELS.getId());
|
SwitchPreference speakTunnels = (SwitchPreference) findPreference(settings.SPEAK_TUNNELS.getId());
|
||||||
SwitchPreference announceWpt = (SwitchPreference) findPreference(settings.ANNOUNCE_WPT.getId());
|
SwitchPreference announceWpt = (SwitchPreference) findPreference(settings.ANNOUNCE_WPT.getId());
|
||||||
SwitchPreference announceNearbyFavorites = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_FAVORITES.getId());
|
SwitchPreference announceNearbyFavorites = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_FAVORITES.getId());
|
||||||
SwitchPreference announceNearbyPoi = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_POI.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();
|
setupKeepInformingPref();
|
||||||
setupArrivalAnnouncementPref();
|
setupArrivalAnnouncementPref();
|
||||||
setupVoiceProviderPref();
|
setupVoiceProviderPref();
|
||||||
|
@ -68,6 +81,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupSpeakRoutingAlarmsPref() {
|
||||||
|
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void setupSpeedLimitExceedPref() {
|
private void setupSpeedLimitExceedPref() {
|
||||||
Float[] speedLimitValues;
|
Float[] speedLimitValues;
|
||||||
String[] speedLimitNames;
|
String[] speedLimitNames;
|
||||||
|
@ -91,18 +109,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.SPEED_LIMIT_EXCEED.getId());
|
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.SPEED_LIMIT_EXCEED.getId());
|
||||||
voiceProvider.setEntries(speedLimitNames);
|
voiceProvider.setEntries(speedLimitNames);
|
||||||
voiceProvider.setEntryValues(speedLimitValues);
|
voiceProvider.setEntryValues(speedLimitValues);
|
||||||
}
|
voiceProvider.setIconSpaceReserved(true);
|
||||||
|
|
||||||
private void setupSpeakSpeedCameraPref() {
|
|
||||||
settings.SPEAK_SPEED_CAMERA.addListener(new StateChangedListener<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public void stateChanged(Boolean change) {
|
|
||||||
SwitchPreference speakSpeedCamera = (SwitchPreference) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
|
|
||||||
if (speakSpeedCamera != null) {
|
|
||||||
speakSpeedCamera.setChecked(change);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupKeepInformingPref() {
|
private void setupKeepInformingPref() {
|
||||||
|
@ -113,9 +120,10 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
keepInformingNames[i] = keepInformingValues[i] + " " + getString(R.string.int_min);
|
keepInformingNames[i] = keepInformingValues[i] + " " + getString(R.string.int_min);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.KEEP_INFORMING.getId());
|
ListPreferenceEx keepInforming = (ListPreferenceEx) findPreference(settings.KEEP_INFORMING.getId());
|
||||||
voiceProvider.setEntries(keepInformingNames);
|
keepInforming.setEntries(keepInformingNames);
|
||||||
voiceProvider.setEntryValues(keepInformingValues);
|
keepInforming.setEntryValues(keepInformingValues);
|
||||||
|
keepInforming.setIconSpaceReserved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupArrivalAnnouncementPref() {
|
private void setupArrivalAnnouncementPref() {
|
||||||
|
@ -127,13 +135,18 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
getString(R.string.arrival_distance_factor_at_last)
|
getString(R.string.arrival_distance_factor_at_last)
|
||||||
};
|
};
|
||||||
|
|
||||||
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
|
ListPreferenceEx arrivalDistanceFactor = (ListPreferenceEx) findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
|
||||||
voiceProvider.setEntries(arrivalNames);
|
arrivalDistanceFactor.setEntries(arrivalNames);
|
||||||
voiceProvider.setEntryValues(arrivalValues);
|
arrivalDistanceFactor.setEntryValues(arrivalValues);
|
||||||
|
arrivalDistanceFactor.setIconSpaceReserved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupVoiceProviderPref() {
|
private void setupVoiceProviderPref() {
|
||||||
Set<String> voiceFiles = app.getRoutingOptionsHelper().getVoiceFiles(getActivity());
|
Activity activity = getActivity();
|
||||||
|
if (activity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> voiceFiles = app.getRoutingOptionsHelper().getVoiceFiles(activity);
|
||||||
String[] entries = new String[voiceFiles.size() + 2];
|
String[] entries = new String[voiceFiles.size() + 2];
|
||||||
String[] entryValues = new String[voiceFiles.size() + 2];
|
String[] entryValues = new String[voiceFiles.size() + 2];
|
||||||
|
|
||||||
|
@ -142,7 +155,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
entryValues[k] = OsmandSettings.VOICE_PROVIDER_NOT_USE;
|
entryValues[k] = OsmandSettings.VOICE_PROVIDER_NOT_USE;
|
||||||
entries[k++] = getString(R.string.shared_string_do_not_use);
|
entries[k++] = getString(R.string.shared_string_do_not_use);
|
||||||
for (String s : voiceFiles) {
|
for (String s : voiceFiles) {
|
||||||
entries[k] = (s.contains("tts") ? getString(R.string.ttsvoice) + " " : "") + FileNameTranslationHelper.getVoiceName(getActivity(), s);
|
entries[k] = (s.contains("tts") ? getString(R.string.ttsvoice) + " " : "") + FileNameTranslationHelper.getVoiceName(activity, s);
|
||||||
entryValues[k] = s;
|
entryValues[k] = s;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
@ -170,55 +183,79 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
};
|
};
|
||||||
//AudioManager.USE_DEFAULT_STREAM_TYPE};
|
//AudioManager.USE_DEFAULT_STREAM_TYPE};
|
||||||
|
|
||||||
ListPreferenceEx lp = createListPreferenceEx(settings.AUDIO_STREAM_GUIDANCE.getId(), streamTypes, streamIntTypes, R.string.choose_audio_stream, R.layout.preference_with_descr);
|
ListPreferenceEx audioStreamGuidance = createListPreferenceEx(settings.AUDIO_STREAM_GUIDANCE.getId(), streamTypes, streamIntTypes, R.string.choose_audio_stream, R.layout.preference_with_descr);
|
||||||
getPreferenceScreen().addPreference(lp);
|
audioStreamGuidance.setIconSpaceReserved(true);
|
||||||
|
|
||||||
|
getPreferenceScreen().addPreference(audioStreamGuidance);
|
||||||
|
|
||||||
|
audioStreamGuidance.setDependency(settings.SPEAK_ROUTING_ALARMS.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupInterruptMusicPref() {
|
private void setupInterruptMusicPref() {
|
||||||
Preference interruptMusicPref = createSwitchPreference(settings.INTERRUPT_MUSIC, R.string.interrupt_music, R.string.interrupt_music_descr, R.layout.preference_switch);
|
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);
|
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
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
String prefId = preference.getKey();
|
String prefId = preference.getKey();
|
||||||
|
|
||||||
if (prefId.equals(settings.ANNOUNCE_NEARBY_POI.getId())) {
|
if (prefId.equals(settings.VOICE_PROVIDER.getId())) {
|
||||||
settings.SHOW_NEARBY_POI.set(settings.ANNOUNCE_NEARBY_POI.get());
|
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);
|
||||||
}
|
}
|
||||||
if (prefId.equals(settings.ANNOUNCE_NEARBY_FAVORITES.getId())) {
|
return true;
|
||||||
settings.SHOW_NEARBY_FAVORITES.set(settings.ANNOUNCE_NEARBY_FAVORITES.get());
|
|
||||||
}
|
|
||||||
if (prefId.equals(settings.ANNOUNCE_WPT.getId())) {
|
|
||||||
settings.SHOW_WPT.set(settings.ANNOUNCE_WPT.get());
|
|
||||||
}
|
}
|
||||||
if (prefId.equals(settings.SPEAK_SPEED_CAMERA.getId())) {
|
if (prefId.equals(settings.SPEAK_SPEED_CAMERA.getId())) {
|
||||||
if (!settings.SPEAK_SPEED_CAMERA.get()) {
|
if (!settings.SPEAK_SPEED_CAMERA.get()) {
|
||||||
SettingsNavigationActivity.confirmSpeedCamerasDlg(getActivity(), settings);
|
confirmSpeedCamerasDlg();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prefId.equals(settings.AUDIO_STREAM_GUIDANCE.getId())) {
|
if (prefId.equals(settings.AUDIO_STREAM_GUIDANCE.getId())) {
|
||||||
CommandPlayer player = app.getPlayer();
|
|
||||||
if (player != null) {
|
|
||||||
player.updateAudioStream(settings.AUDIO_STREAM_GUIDANCE.get());
|
|
||||||
}
|
|
||||||
// Sync corresponding AUDIO_USAGE value
|
|
||||||
ApplicationMode mode = getSelectedAppMode();
|
|
||||||
int stream = settings.AUDIO_STREAM_GUIDANCE.getModeValue(mode);
|
|
||||||
if (stream == AudioManager.STREAM_MUSIC) {
|
|
||||||
settings.AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE);
|
|
||||||
} else if (stream == AudioManager.STREAM_NOTIFICATION) {
|
|
||||||
settings.AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_NOTIFICATION);
|
|
||||||
} else if (stream == AudioManager.STREAM_VOICE_CALL) {
|
|
||||||
settings.AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_VOICE_COMMUNICATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync DEFAULT value with CAR value, as we have other way to set it for now
|
// 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_STREAM_GUIDANCE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_STREAM_GUIDANCE.getModeValue(ApplicationMode.CAR));
|
||||||
|
}
|
||||||
settings.AUDIO_USAGE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_USAGE.getModeValue(ApplicationMode.CAR));
|
settings.AUDIO_USAGE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_USAGE.getModeValue(ApplicationMode.CAR));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1248,13 +1248,14 @@ public class RouteInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateInfo(DrawSettings drawSettings) {
|
public boolean updateInfo(DrawSettings drawSettings) {
|
||||||
|
boolean showRoutingAlarms = settings.SHOW_ROUTING_ALARMS.get();
|
||||||
boolean trafficWarnings = settings.SHOW_TRAFFIC_WARNINGS.get();
|
boolean trafficWarnings = settings.SHOW_TRAFFIC_WARNINGS.get();
|
||||||
boolean cams = settings.SHOW_CAMERAS.get();
|
boolean cams = settings.SHOW_CAMERAS.get();
|
||||||
boolean peds = settings.SHOW_PEDESTRIAN.get();
|
boolean peds = settings.SHOW_PEDESTRIAN.get();
|
||||||
boolean tunnels = settings.SHOW_TUNNELS.get();
|
boolean tunnels = settings.SHOW_TUNNELS.get();
|
||||||
boolean visible = false;
|
boolean visible = false;
|
||||||
if ((rh.isFollowingMode() || trackingUtilities.isMapLinkedToLocation())
|
if ((rh.isFollowingMode() || trackingUtilities.isMapLinkedToLocation())
|
||||||
&& (trafficWarnings || cams)) {
|
&& showRoutingAlarms && (trafficWarnings || cams)) {
|
||||||
AlarmInfo alarm;
|
AlarmInfo alarm;
|
||||||
if(rh.isFollowingMode() && !rh.isDeviatedFromRoute() && rh.getCurrentGPXRoute() == null) {
|
if(rh.isFollowingMode() && !rh.isDeviatedFromRoute() && rh.getCurrentGPXRoute() == null) {
|
||||||
alarm = wh.getMostImportantAlarm(settings.METRIC_SYSTEM.get(), cams);
|
alarm = wh.getMostImportantAlarm(settings.METRIC_SYSTEM.get(), cams);
|
||||||
|
|
Loading…
Reference in a new issue