commit
b36d5a92d8
2 changed files with 16 additions and 16 deletions
|
@ -43,7 +43,8 @@ public class OsmAndPreferencesDataStore extends PreferenceDataStore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putBoolean(String key, boolean value) {
|
public void putBoolean(String key, boolean value) {
|
||||||
if (osmandSettings.DISABLE_COMPLEX_ROUTING.getId().equals(key)) {
|
if (osmandSettings.DISABLE_COMPLEX_ROUTING.getId().equals(key)
|
||||||
|
|| osmandSettings.DISABLE_WRONG_DIRECTION_RECALC.getId().equals(key)) {
|
||||||
osmandSettings.setPreference(key, !value, appMode);
|
osmandSettings.setPreference(key, !value, appMode);
|
||||||
} else {
|
} else {
|
||||||
osmandSettings.setPreference(key, value, appMode);
|
osmandSettings.setPreference(key, value, appMode);
|
||||||
|
@ -107,7 +108,8 @@ public class OsmAndPreferencesDataStore extends PreferenceDataStore {
|
||||||
OsmandPreference<?> preference = osmandSettings.getPreference(key);
|
OsmandPreference<?> preference = osmandSettings.getPreference(key);
|
||||||
if (preference instanceof BooleanPreference) {
|
if (preference instanceof BooleanPreference) {
|
||||||
BooleanPreference booleanPreference = (BooleanPreference) preference;
|
BooleanPreference booleanPreference = (BooleanPreference) preference;
|
||||||
if (osmandSettings.DISABLE_COMPLEX_ROUTING.getId().equals(booleanPreference.getId())) {
|
if (osmandSettings.DISABLE_COMPLEX_ROUTING.getId().equals(booleanPreference.getId())
|
||||||
|
|| osmandSettings.DISABLE_WRONG_DIRECTION_RECALC.getId().equals(booleanPreference.getId())) {
|
||||||
return !booleanPreference.getModeValue(appMode);
|
return !booleanPreference.getModeValue(appMode);
|
||||||
}
|
}
|
||||||
return booleanPreference.getModeValue(appMode);
|
return booleanPreference.getModeValue(appMode);
|
||||||
|
|
|
@ -31,9 +31,8 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.routing.RouteService;
|
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
import net.osmand.plus.routing.RouteProvider;
|
import net.osmand.plus.routing.RouteService;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.BooleanPreference;
|
import net.osmand.plus.settings.backend.BooleanPreference;
|
||||||
|
@ -357,15 +356,14 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupReverseDirectionRecalculation(PreferenceScreen screen) {
|
private void setupReverseDirectionRecalculation(PreferenceScreen screen) {
|
||||||
SwitchPreferenceEx recalcRouteReverseDirectionPreference =
|
OsmandPreference<Boolean> preference = settings.DISABLE_WRONG_DIRECTION_RECALC;
|
||||||
createSwitchPreferenceEx(settings.DISABLE_WRONG_DIRECTION_RECALC.getId(),
|
SwitchPreferenceEx switchPreference = createSwitchPreferenceEx(preference.getId(),
|
||||||
R.string.in_case_of_reverse_direction,
|
R.string.in_case_of_reverse_direction,
|
||||||
R.layout.preference_with_descr_dialog_and_switch);
|
R.layout.preference_with_descr_dialog_and_switch);
|
||||||
recalcRouteReverseDirectionPreference.setIcon(
|
switchPreference.setIcon(getRoutingPrefIcon(preference.getId()));
|
||||||
getRoutingPrefIcon(settings.DISABLE_WRONG_DIRECTION_RECALC.getId()));
|
switchPreference.setSummaryOn(R.string.shared_string_enabled);
|
||||||
recalcRouteReverseDirectionPreference.setSummaryOn(R.string.shared_string_enabled);
|
switchPreference.setSummaryOff(R.string.shared_string_disabled);
|
||||||
recalcRouteReverseDirectionPreference.setSummaryOff(R.string.shared_string_disabled);
|
screen.addPreference(switchPreference);
|
||||||
screen.addPreference(recalcRouteReverseDirectionPreference);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupRouteRecalcHeader(PreferenceScreen screen) {
|
private void setupRouteRecalcHeader(PreferenceScreen screen) {
|
||||||
|
@ -546,7 +544,9 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
if (settings.DISABLE_COMPLEX_ROUTING.getId().equals(preference.getKey()) && newValue instanceof Boolean) {
|
if ((settings.DISABLE_COMPLEX_ROUTING.getId().equals(preference.getKey()) ||
|
||||||
|
settings.DISABLE_WRONG_DIRECTION_RECALC.getId().equals(preference.getKey())) &&
|
||||||
|
newValue instanceof Boolean) {
|
||||||
return onConfirmPreferenceChange(preference.getKey(), !(Boolean) newValue, getApplyQueryType()); // pref ui was inverted
|
return onConfirmPreferenceChange(preference.getKey(), !(Boolean) newValue, getApplyQueryType()); // pref ui was inverted
|
||||||
}
|
}
|
||||||
return onConfirmPreferenceChange(preference.getKey(), newValue, getApplyQueryType());
|
return onConfirmPreferenceChange(preference.getKey(), newValue, getApplyQueryType());
|
||||||
|
@ -573,8 +573,6 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
||||||
applyPreference(ROUTING_RECALC_DISTANCE, applyToAllProfiles, valueToSave);
|
applyPreference(ROUTING_RECALC_DISTANCE, applyToAllProfiles, valueToSave);
|
||||||
applyPreference(settings.DISABLE_OFFROUTE_RECALC.getId(), applyToAllProfiles, !enabled);
|
applyPreference(settings.DISABLE_OFFROUTE_RECALC.getId(), applyToAllProfiles, !enabled);
|
||||||
updateRouteRecalcDistancePref();
|
updateRouteRecalcDistancePref();
|
||||||
} else if (settings.DISABLE_WRONG_DIRECTION_RECALC.getId().equals(prefId)) {
|
|
||||||
applyPreference(settings.DISABLE_WRONG_DIRECTION_RECALC.getId(), applyToAllProfiles, newValue);
|
|
||||||
} else {
|
} else {
|
||||||
super.onApplyPreferenceChange(prefId, applyToAllProfiles, newValue);
|
super.onApplyPreferenceChange(prefId, applyToAllProfiles, newValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue