Merge pull request #9961 from osmandapp/Move_development_settings
Move development settings
This commit is contained in:
commit
e0a0441c31
8 changed files with 151 additions and 126 deletions
|
@ -11,6 +11,14 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="use_native_pt_desc">Switch to Java (safe) Public Transport routing calculation</string>
|
||||
<string name="use_native_pt">Native Public Transport development</string>
|
||||
<string name="use_fast_recalculation_desc">Recalculates only the initial part of the route. Can be used for long trips.</string>
|
||||
<string name="complex_routing_descr">Two-phase routing for car navigation.</string>
|
||||
<string name="use_complex_routing">Complex routing</string>
|
||||
<string name="use_live_routing">OsmAnd Live data</string>
|
||||
<string name="use_live_public_transport">OsmAnd Live data</string>
|
||||
<string name="development">Development</string>
|
||||
<string name="routing_attr_avoid_footways_name">Avoid footways</string>
|
||||
<string name="routing_attr_avoid_footways_description">Avoid footways</string>
|
||||
<string name="osm_live_payment_subscription_management_hw">Payment will be charged to your AppGallery account at the confirmation of purchase.\n\nSubscription automatically renews unless it is canceled before the renewal date. Your account will be charged for renewal period(month/three month/year) only on the renewal date.\n\nYou can manage and cancel your subscriptions by going to your AppGallery settings.</string>
|
||||
|
@ -3662,7 +3670,6 @@
|
|||
<string name="plugin_install_needs_network">You need to be online to install this plugin.</string>
|
||||
<string name="get_plugin">Get</string>
|
||||
<string name="use_fast_recalculation">Smart route recalculation</string>
|
||||
<string name="use_fast_recalculation_desc">For long trips, only recalculate the initial part of the route.</string>
|
||||
<string name="do_you_like_osmand">Do you like OsmAnd?</string>
|
||||
<string name="we_really_care_about_your_opinion">Your opinion and feedback is valued.</string>
|
||||
<string name="rate_this_app">Rate this app</string>
|
||||
|
|
|
@ -25,46 +25,11 @@
|
|||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="@string/safe_mode" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="pt_safe_mode"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_disabled"
|
||||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="Native PT development" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="routing"
|
||||
android:layout="@layout/preference_category_with_descr"
|
||||
android:title="@string/routing_settings" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="disable_complex_routing"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_disabled"
|
||||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="@string/disable_complex_routing" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="use_fast_recalculation"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_disabled"
|
||||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="@string/use_fast_recalculation" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="enable_osmc_routing"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_disabled"
|
||||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="@string/use_osm_live_routing" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="enable_osmc_public_transport"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_disabled"
|
||||
android:summaryOn="@string/shared_string_enabled"
|
||||
android:title="@string/use_osm_live_public_transport" />
|
||||
|
||||
<Preference
|
||||
android:key="simulate_your_location"
|
||||
android:layout="@layout/preference_with_descr"
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class Version {
|
||||
|
||||
private final String appVersion;
|
||||
|
@ -149,4 +151,21 @@ public class Version {
|
|||
return v;
|
||||
}
|
||||
|
||||
public static boolean isOpenGlAvailable(OsmandApplication app) {
|
||||
if ("qnx".equals(System.getProperty("os.name"))) {
|
||||
return false;
|
||||
}
|
||||
File nativeLibraryDir = new File(app.getApplicationInfo().nativeLibraryDir);
|
||||
if (nativeLibraryDir.exists() && nativeLibraryDir.canRead()) {
|
||||
File[] files = nativeLibraryDir.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if ("libOsmAndCoreWithJNI.so".equals(file.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -35,12 +35,7 @@ public class DevelopmentSettingsFragment extends BaseSettingsFragment {
|
|||
|
||||
setupOpenglRenderPref();
|
||||
setupSafeModePref();
|
||||
setupPTSafeMode();
|
||||
|
||||
setupDisableComplexRoutingPref();
|
||||
setupFastRecalculationPref();
|
||||
setupOsmLiveForRoutingPref();
|
||||
setupOsmLiveForPublicTransportPref();
|
||||
setupSimulateYourLocationPref();
|
||||
|
||||
Preference debuggingAndDevelopment = findPreference("debugging_and_development");
|
||||
|
@ -62,13 +57,17 @@ public class DevelopmentSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
private void setupOpenglRenderPref() {
|
||||
SwitchPreferenceEx useOpenglRender = (SwitchPreferenceEx) findPreference(settings.USE_OPENGL_RENDER.getId());
|
||||
SwitchPreferenceEx useOpenglRender = findPreference(settings.USE_OPENGL_RENDER.getId());
|
||||
if (Version.isOpenGlAvailable(app)) {
|
||||
useOpenglRender.setDescription(getString(R.string.use_opengl_render_descr));
|
||||
useOpenglRender.setIconSpaceReserved(false);
|
||||
} else {
|
||||
useOpenglRender.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSafeModePref() {
|
||||
SwitchPreferenceEx safeMode = (SwitchPreferenceEx) findPreference(settings.SAFE_MODE.getId());
|
||||
SwitchPreferenceEx safeMode = findPreference(settings.SAFE_MODE.getId());
|
||||
if (!Version.isBlackberry(app)) {
|
||||
safeMode.setDescription(getString(R.string.safe_mode_description));
|
||||
safeMode.setIconSpaceReserved(false);
|
||||
|
@ -82,40 +81,6 @@ public class DevelopmentSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupPTSafeMode() {
|
||||
SwitchPreferenceEx ptSafeMode = (SwitchPreferenceEx) findPreference(settings.PT_SAFE_MODE.getId());
|
||||
if (!Version.isBlackberry(app)) {
|
||||
ptSafeMode.setDescription("Switch to Java (safe) Public Transport routing calculation");
|
||||
ptSafeMode.setIconSpaceReserved(false);
|
||||
} else {
|
||||
ptSafeMode.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupDisableComplexRoutingPref() {
|
||||
SwitchPreferenceEx disableComplexRouting = (SwitchPreferenceEx) findPreference(settings.DISABLE_COMPLEX_ROUTING.getId());
|
||||
disableComplexRouting.setDescription(getString(R.string.disable_complex_routing_descr));
|
||||
disableComplexRouting.setIconSpaceReserved(false);
|
||||
}
|
||||
|
||||
private void setupFastRecalculationPref() {
|
||||
SwitchPreferenceEx useFastRecalculation = (SwitchPreferenceEx) findPreference(settings.USE_FAST_RECALCULATION.getId());
|
||||
useFastRecalculation.setDescription(getString(R.string.use_fast_recalculation_desc));
|
||||
useFastRecalculation.setIconSpaceReserved(false);
|
||||
}
|
||||
|
||||
private void setupOsmLiveForRoutingPref() {
|
||||
SwitchPreferenceEx useOsmLiveForRouting = (SwitchPreferenceEx) findPreference(settings.USE_OSM_LIVE_FOR_ROUTING.getId());
|
||||
useOsmLiveForRouting.setDescription(getString(R.string.use_osm_live_routing_description));
|
||||
useOsmLiveForRouting.setIconSpaceReserved(false);
|
||||
}
|
||||
|
||||
private void setupOsmLiveForPublicTransportPref() {
|
||||
SwitchPreferenceEx useOsmLiveForPublicTransport = (SwitchPreferenceEx) findPreference(settings.USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT.getId());
|
||||
useOsmLiveForPublicTransport.setDescription(getString(R.string.use_osm_live_public_transport_description));
|
||||
useOsmLiveForPublicTransport.setIconSpaceReserved(false);
|
||||
}
|
||||
|
||||
private void setupSimulateYourLocationPref() {
|
||||
final Preference simulateYourLocation = findPreference(SIMULATE_YOUR_LOCATION);
|
||||
simulateYourLocation.setIconSpaceReserved(false);
|
||||
|
|
|
@ -14,11 +14,11 @@ import android.preference.PreferenceScreen;
|
|||
|
||||
import net.osmand.plus.OsmAndLocationSimulation;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.util.SunriseSunset;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -34,41 +34,27 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
app.applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
getToolbar().setTitle(R.string.debugging_and_development);
|
||||
PreferenceScreen cat = getPreferenceScreen();
|
||||
PreferenceScreen category = getPreferenceScreen();
|
||||
Preference pref;
|
||||
|
||||
cat.addPreference(createCheckBoxPreference(settings.USE_OPENGL_RENDER,
|
||||
if (Version.isOpenGlAvailable(app)) {
|
||||
category.addPreference(createCheckBoxPreference(settings.USE_OPENGL_RENDER,
|
||||
R.string.use_opengl_render, R.string.use_opengl_render_descr));
|
||||
}
|
||||
|
||||
if (!Version.isBlackberry(app)) {
|
||||
CheckBoxPreference nativeCheckbox = createCheckBoxPreference(settings.SAFE_MODE, R.string.safe_mode, R.string.safe_mode_description);
|
||||
CheckBoxPreference nativePTCheckbox = createCheckBoxPreference(settings.PT_SAFE_MODE, "Native PT routing development", "Switch to Java (safe) Public Transport routing calculation");
|
||||
// disable the checkbox if the library cannot be used
|
||||
if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || settings.NATIVE_RENDERING_FAILED.get()) {
|
||||
nativeCheckbox.setEnabled(false);
|
||||
nativeCheckbox.setChecked(true);
|
||||
}
|
||||
cat.addPreference(nativeCheckbox);
|
||||
cat.addPreference(nativePTCheckbox);
|
||||
category.addPreference(nativeCheckbox);
|
||||
}
|
||||
|
||||
PreferenceCategory navigation = new PreferenceCategory(this);
|
||||
navigation.setTitle(R.string.routing_settings);
|
||||
cat.addPreference(navigation);
|
||||
navigation.addPreference(createCheckBoxPreference(settings.DISABLE_COMPLEX_ROUTING,
|
||||
R.string.disable_complex_routing, R.string.disable_complex_routing_descr));
|
||||
|
||||
navigation.addPreference(createCheckBoxPreference(settings.USE_FAST_RECALCULATION,
|
||||
R.string.use_fast_recalculation, R.string.use_fast_recalculation_desc));
|
||||
|
||||
navigation.addPreference(createCheckBoxPreference(settings.USE_OSM_LIVE_FOR_ROUTING,
|
||||
R.string.use_osm_live_routing,
|
||||
R.string.use_osm_live_routing_description));
|
||||
|
||||
navigation.addPreference(createCheckBoxPreference(settings.USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT,
|
||||
R.string.use_osm_live_public_transport,
|
||||
R.string.use_osm_live_public_transport_description));
|
||||
|
||||
category.addPreference(navigation);
|
||||
pref = new Preference(this);
|
||||
final Preference simulate = pref;
|
||||
final OsmAndLocationSimulation sim = getMyApplication().getLocationProvider().getLocationSimulation();
|
||||
|
@ -95,7 +81,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
|
||||
PreferenceCategory debug = new PreferenceCategory(this);
|
||||
debug.setTitle(R.string.debugging_and_development);
|
||||
cat.addPreference(debug);
|
||||
category.addPreference(debug);
|
||||
|
||||
CheckBoxPreference dbg = createCheckBoxPreference(settings.DEBUG_RENDERING_INFO,
|
||||
R.string.trace_rendering, R.string.trace_rendering_descr);
|
||||
|
@ -126,10 +112,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
R.string.show_free_version_banner,
|
||||
R.string.show_free_version_banner_description));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pref = new Preference(this);
|
||||
pref.setTitle(R.string.test_voice_prompts);
|
||||
pref.setSummary(R.string.play_commands_of_currently_selected_voice);
|
||||
|
@ -141,7 +123,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
cat.addPreference(pref);
|
||||
category.addPreference(pref);
|
||||
|
||||
pref = new Preference(this);
|
||||
pref.setTitle(R.string.logcat_buffer);
|
||||
|
@ -154,11 +136,11 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
cat.addPreference(pref);
|
||||
category.addPreference(pref);
|
||||
|
||||
PreferenceCategory info = new PreferenceCategory(this);
|
||||
info.setTitle(R.string.info_button);
|
||||
cat.addPreference(info);
|
||||
category.addPreference(info);
|
||||
|
||||
pref = new Preference(this);
|
||||
pref.setTitle(R.string.global_app_allocated_memory);
|
||||
|
|
|
@ -43,8 +43,12 @@ public class OsmAndPreferencesDataStore extends PreferenceDataStore {
|
|||
|
||||
@Override
|
||||
public void putBoolean(String key, boolean value) {
|
||||
if (osmandSettings.DISABLE_COMPLEX_ROUTING.getId().equals(key)) {
|
||||
osmandSettings.setPreference(key, !value, appMode);
|
||||
} else {
|
||||
osmandSettings.setPreference(key, value, appMode);
|
||||
}
|
||||
}
|
||||
|
||||
public void putValue(String key, Object value) {
|
||||
osmandSettings.setPreference(key, value, appMode);
|
||||
|
@ -102,7 +106,11 @@ public class OsmAndPreferencesDataStore extends PreferenceDataStore {
|
|||
public boolean getBoolean(String key, boolean defValue) {
|
||||
OsmandPreference<?> preference = osmandSettings.getPreference(key);
|
||||
if (preference instanceof BooleanPreference) {
|
||||
return ((BooleanPreference) preference).getModeValue(appMode);
|
||||
BooleanPreference booleanPreference = (BooleanPreference) preference;
|
||||
if (osmandSettings.DISABLE_COMPLEX_ROUTING.getId().equals(booleanPreference.getId())) {
|
||||
return !booleanPreference.getModeValue(appMode);
|
||||
}
|
||||
return booleanPreference.getModeValue(appMode);
|
||||
}
|
||||
return defValue;
|
||||
}
|
||||
|
|
|
@ -716,7 +716,7 @@ public class OsmandSettings {
|
|||
public final CommonPreference<Long> MAPILLARY_FILTER_TO_DATE = new LongPreference(this, "mapillary_filter_to_date", 0).makeGlobal();
|
||||
public final CommonPreference<Boolean> MAPILLARY_FILTER_PANO = new BooleanPreference(this, "mapillary_filter_pano", false).makeGlobal();
|
||||
|
||||
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference(this, "use_fast_recalculation", true).makeGlobal().cache();
|
||||
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference(this, "use_fast_recalculation", true).makeProfile().cache();
|
||||
public final CommonPreference<Boolean> FORCE_PRIVATE_ACCESS_ROUTING_ASKED = new BooleanPreference(this, "force_private_access_routing", false).makeProfile().cache();
|
||||
|
||||
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference(this, "show_card_to_choose_drawer", false).makeGlobal();
|
||||
|
@ -1219,7 +1219,7 @@ public class OsmandSettings {
|
|||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> FAST_ROUTE_MODE = new BooleanPreference(this, "fast_route_mode", true).makeProfile();
|
||||
// dev version
|
||||
public final CommonPreference<Boolean> DISABLE_COMPLEX_ROUTING = new BooleanPreference(this, "disable_complex_routing", false).makeGlobal();
|
||||
public final CommonPreference<Boolean> DISABLE_COMPLEX_ROUTING = new BooleanPreference(this, "disable_complex_routing", false).makeProfile();
|
||||
public final CommonPreference<Boolean> ENABLE_TIME_CONDITIONAL_ROUTING = new BooleanPreference(this, "enable_time_conditional_routing", true).makeProfile();
|
||||
|
||||
public boolean simulateNavigation = false;
|
||||
|
@ -2604,9 +2604,9 @@ public class OsmandSettings {
|
|||
public final CommonPreference<Float> ROUTE_RECALCULATION_DISTANCE = new FloatPreference(this, "routing_recalc_distance", 0.f).makeProfile();
|
||||
public final CommonPreference<Float> ROUTE_STRAIGHT_ANGLE = new FloatPreference(this, "routing_straight_angle", 30.f).makeProfile();
|
||||
|
||||
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference(this, "enable_osmc_routing", true).makeGlobal();
|
||||
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference(this, "enable_osmc_routing", true).makeProfile();
|
||||
|
||||
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT = new BooleanPreference(this, "enable_osmc_public_transport", false).makeGlobal();
|
||||
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT = new BooleanPreference(this, "enable_osmc_public_transport", false).makeProfile();
|
||||
|
||||
public final OsmandPreference<Boolean> VOICE_MUTE = new BooleanPreference(this, "voice_mute", false).makeProfile().cache();
|
||||
|
||||
|
@ -2615,7 +2615,7 @@ public class OsmandSettings {
|
|||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> SAFE_MODE = new BooleanPreference(this, "safe_mode", false).makeGlobal();
|
||||
public final OsmandPreference<Boolean> PT_SAFE_MODE = new BooleanPreference(this, "pt_safe_mode", false).makeGlobal();
|
||||
public final OsmandPreference<Boolean> PT_SAFE_MODE = new BooleanPreference(this, "pt_safe_mode", false).makeProfile();
|
||||
public final OsmandPreference<Boolean> NATIVE_RENDERING_FAILED = new BooleanPreference(this, "native_rendering_failed_init", false).makeGlobal();
|
||||
|
||||
public final OsmandPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render",
|
||||
|
|
|
@ -25,18 +25,19 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.google.android.material.slider.Slider;
|
||||
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||
import net.osmand.plus.settings.backend.BooleanPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
||||
import net.osmand.plus.routing.RouteProvider;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.BooleanPreference;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||
import net.osmand.plus.settings.bottomsheets.RecalculateRouteInDeviationBottomSheet;
|
||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
|
||||
|
@ -155,6 +156,58 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
getPreferenceScreen().addPreference(timeConditionalRouting);
|
||||
}
|
||||
|
||||
private void setupOsmLiveForPublicTransportPref() {
|
||||
SwitchPreferenceEx useOsmLiveForPublicTransport = createSwitchPreferenceEx(settings.USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT.getId(),
|
||||
R.string.use_live_public_transport, R.layout.preference_with_descr_dialog_and_switch);
|
||||
useOsmLiveForPublicTransport.setDescription(getString(R.string.use_osm_live_public_transport_description));
|
||||
useOsmLiveForPublicTransport.setSummaryOn(R.string.shared_string_enabled);
|
||||
useOsmLiveForPublicTransport.setSummaryOff(R.string.shared_string_disabled);
|
||||
useOsmLiveForPublicTransport.setIconSpaceReserved(true);
|
||||
getPreferenceScreen().addPreference(useOsmLiveForPublicTransport);
|
||||
}
|
||||
|
||||
private void setupNativePublicTransport() {
|
||||
if (!Version.isBlackberry(app)) {
|
||||
SwitchPreferenceEx setupNativePublicTransport = createSwitchPreferenceEx(settings.PT_SAFE_MODE.getId(),
|
||||
R.string.use_native_pt, R.layout.preference_with_descr_dialog_and_switch);
|
||||
setupNativePublicTransport.setDescription(getString(R.string.use_native_pt_desc));
|
||||
setupNativePublicTransport.setSummaryOn(R.string.shared_string_enabled);
|
||||
setupNativePublicTransport.setSummaryOff(R.string.shared_string_disabled);
|
||||
setupNativePublicTransport.setIconSpaceReserved(true);
|
||||
getPreferenceScreen().addPreference(setupNativePublicTransport);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupOsmLiveForRoutingPref() {
|
||||
SwitchPreferenceEx useOsmLiveForRouting = createSwitchPreferenceEx(settings.USE_OSM_LIVE_FOR_ROUTING.getId(),
|
||||
R.string.use_live_routing, R.layout.preference_with_descr_dialog_and_switch);
|
||||
useOsmLiveForRouting.setDescription(getString(R.string.use_osm_live_routing_description));
|
||||
useOsmLiveForRouting.setSummaryOn(R.string.shared_string_enabled);
|
||||
useOsmLiveForRouting.setSummaryOff(R.string.shared_string_disabled);
|
||||
useOsmLiveForRouting.setIconSpaceReserved(true);
|
||||
getPreferenceScreen().addPreference(useOsmLiveForRouting);
|
||||
}
|
||||
|
||||
private void setupDisableComplexRoutingPref() {
|
||||
SwitchPreferenceEx disableComplexRouting = createSwitchPreferenceEx(settings.DISABLE_COMPLEX_ROUTING.getId(),
|
||||
R.string.use_complex_routing, R.layout.preference_with_descr_dialog_and_switch);
|
||||
disableComplexRouting.setDescription(getString(R.string.complex_routing_descr));
|
||||
disableComplexRouting.setSummaryOn(R.string.shared_string_enabled);
|
||||
disableComplexRouting.setSummaryOff(R.string.shared_string_disabled);
|
||||
disableComplexRouting.setIconSpaceReserved(true);
|
||||
getPreferenceScreen().addPreference(disableComplexRouting);
|
||||
}
|
||||
|
||||
private void setupFastRecalculationPref() {
|
||||
SwitchPreferenceEx useFastRecalculation = createSwitchPreferenceEx(settings.USE_FAST_RECALCULATION.getId(),
|
||||
R.string.use_fast_recalculation, R.layout.preference_with_descr_dialog_and_switch);
|
||||
useFastRecalculation.setDescription(getString(R.string.use_fast_recalculation_desc));
|
||||
useFastRecalculation.setSummaryOn(R.string.shared_string_enabled);
|
||||
useFastRecalculation.setSummaryOff(R.string.shared_string_disabled);
|
||||
useFastRecalculation.setIconSpaceReserved(true);
|
||||
getPreferenceScreen().addPreference(useFastRecalculation);
|
||||
}
|
||||
|
||||
private void setupRoutingPrefs() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app == null) {
|
||||
|
@ -274,6 +327,17 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
setupRouteRecalcHeader(screen);
|
||||
setupSelectRouteRecalcDistance(screen);
|
||||
setupReverseDirectionRecalculation(screen);
|
||||
addDivider(screen);
|
||||
setupDevelopmentCategoryHeader(screen);
|
||||
if (am.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT)) {
|
||||
setupOsmLiveForPublicTransportPref();
|
||||
setupNativePublicTransport();
|
||||
}
|
||||
if (am.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
setupOsmLiveForRoutingPref();
|
||||
setupDisableComplexRoutingPref();
|
||||
}
|
||||
setupFastRecalculationPref();
|
||||
}
|
||||
|
||||
private void addDivider(PreferenceScreen screen) {
|
||||
|
@ -301,6 +365,13 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
screen.addPreference(routingCategory);
|
||||
}
|
||||
|
||||
private void setupDevelopmentCategoryHeader(PreferenceScreen screen) {
|
||||
PreferenceCategory developmentCategory = new PreferenceCategory(requireContext());
|
||||
developmentCategory.setLayoutResource(R.layout.preference_category_with_descr);
|
||||
developmentCategory.setTitle(R.string.development);
|
||||
screen.addPreference(developmentCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (preference.getKey().equals(settings.ROUTE_STRAIGHT_ANGLE.getId())) {
|
||||
|
@ -446,6 +517,14 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (settings.DISABLE_COMPLEX_ROUTING.getId().equals(preference.getKey()) && newValue instanceof Boolean) {
|
||||
return onConfirmPreferenceChange(preference.getKey(), !(Boolean) newValue, getApplyQueryType()); // pref ui was inverted
|
||||
}
|
||||
return onConfirmPreferenceChange(preference.getKey(), newValue, getApplyQueryType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplyPreferenceChange(String prefId, boolean applyToAllProfiles, Object newValue) {
|
||||
if ((RELIEF_SMOOTHNESS_FACTOR.equals(prefId) || DRIVING_STYLE.equals(prefId)) && newValue instanceof String) {
|
||||
|
|
Loading…
Reference in a new issue