Make driving_region_automatic profile dependent preference

This commit is contained in:
Chumva 2019-09-05 09:39:03 +03:00
parent 3d99231ef1
commit 3f12808b76
3 changed files with 2 additions and 107 deletions

View file

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="routing_preferences"
android:title="@string/routing_preferences_descr">
<CheckBoxPreference
android:key="fast_route_mode"
android:summary="@string/fast_route_mode_descr"
android:title="@string/fast_route_mode" />
<Preference
android:key="avoid_in_routing"
android:summary="@string/avoid_in_routing_descr"
android:title="@string/avoid_in_routing_title" />
<Preference
android:key="prefer_in_routing"
android:summary="@string/prefer_in_routing_descr"
android:title="@string/prefer_in_routing_title" />
</PreferenceCategory>
<PreferenceCategory
android:key="guidance_preferences"
android:title="@string/guidance_preferences_descr">
<ListPreference
android:key="auto_follow_route"
android:summary="@string/choose_auto_follow_route_descr"
android:title="@string/choose_auto_follow_route" />
<Preference
android:key="auto_zoom_map_on_off"
android:summary="@string/auto_zoom_map_descr"
android:title="@string/auto_zoom_map" />
<CheckBoxPreference
android:key="snap_to_road"
android:summary="@string/snap_to_road_descr"
android:title="@string/snap_to_road" />
<CheckBoxPreference
android:key="enable_time_conditional_routing"
android:title="@string/temporary_conditional_routing" />
<Preference
android:key="show_routing_alarms"
android:summary="@string/show_warnings_descr"
android:title="@string/show_warnings_title" />
<Preference
android:key="speak_routing_alarms"
android:summary="@string/speak_descr"
android:title="@string/speak_title" />
<ListPreference
android:key="keep_informing"
android:summary="@string/keep_informing_descr"
android:title="@string/keep_informing" />
<ListPreference
android:key="arrival_distance_factor"
android:summary="@string/arrival_distance_descr"
android:title="@string/arrival_distance" />
<ListPreference
android:key="default_speed_system"
android:summary="@string/default_speed_system_descr"
android:title="@string/default_speed_system" />
<ListPreference
android:key="speed_limit_exceed"
android:summary="@string/speed_limit_exceed_message"
android:title="@string/speed_limit_exceed" />
<ListPreference
android:key="speed_for_map_to_direction_of_movement"
android:summary="@string/map_orientation_change_in_accordance_with_speed_descr"
android:title="@string/map_orientation_change_in_accordance_with_speed" />
<!--
<CheckBoxPreference android:title="@string/show_zoom_buttons_navigation" android:summary="@string/show_zoom_buttons_navigation_descr" android:key="show_zoom_buttons_navigation" />
-->
<!--
<ListPreference
android:key="delay_to_start_navigation"
android:title="@string/delay_to_start_navigation"
android:summary="@string/delay_to_start_navigation_descr" />
-->
</PreferenceCategory>
<PreferenceCategory
android:key="turn_screen_on"
android:title="@string/wake_on_voice">
<Preference
android:selectable="false"
android:summary="@string/wake_on_voice_descr" />
<ListPreference
android:key="turn_screen_on_time_int"
android:summary="@string/turn_screen_on_time_descr"
android:title="@string/shared_string_time" />
<CheckBoxPreference
android:key="turn_screen_on_sensor"
android:summary="@string/turn_screen_on_sensor_descr"
android:title="@string/turn_screen_on_sensor" />
</PreferenceCategory>
<PreferenceCategory
android:key="voice"
android:title="@string/voice_pref_title">
<ListPreference
android:key="voice_provider"
android:summary="@string/voice_provider_descr"
android:title="@string/voice_provider" />
</PreferenceCategory>
</PreferenceScreen>

View file

@ -948,7 +948,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> FIRST_MAP_IS_DOWNLOADED = new BooleanPreference(
"first_map_is_downloaded", false);
public final CommonPreference<Boolean> DRIVING_REGION_AUTOMATIC = new BooleanPreference("driving_region_automatic", true).makeGlobal().cache();
public final CommonPreference<Boolean> DRIVING_REGION_AUTOMATIC = new BooleanPreference("driving_region_automatic", true).makeProfile().cache();
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumIntPreference<DrivingRegion>(
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
protected boolean setValue(Object prefs, DrivingRegion val) {

View file

@ -113,6 +113,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
private void setupDrivingRegionPref() {
Preference defaultDrivingRegion = findPreference(settings.DRIVING_REGION.getId());
defaultDrivingRegion.setIcon(getContentIcon(R.drawable.ic_action_car_dark));
defaultDrivingRegion.setSummary(getString(settings.DRIVING_REGION_AUTOMATIC.get() ? R.string.driving_region_automatic : settings.DRIVING_REGION.get().name));
}
private void setupUnitsOfLengthPref() {