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