Move development settings

Preview
This commit is contained in:
sergosm 2020-10-06 16:51:45 +03:00
parent dd09d64538
commit ba5b407cea
6 changed files with 111 additions and 111 deletions

View file

@ -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="disable_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="start_finish_icons">Start/finish icons</string>
<string name="sort_name_ascending">Name: A Z</string>
<string name="sort_name_descending">Name: Z A</string>
@ -2463,7 +2471,6 @@
<string name="speech_rate_descr">Specify the speech rate for text-to-speech.</string>
<string name="speech_rate">Speech Rate</string>
<string name="complex_route_calculation_failed">Fast route calculation failed (%s), fallback to slow calculation.</string>
<string name="disable_complex_routing_descr">Disable two-phase routing for car navigation.</string>
<string name="disable_complex_routing">Disable complex routing</string>
<string name="amenity_type_seamark">Seamark</string>
<string name="app_modes_choose_descr">Select shown profiles.</string>
@ -3657,7 +3664,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>

View file

@ -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"

View file

@ -11,6 +11,7 @@ import net.osmand.plus.Version;
import net.osmand.plus.render.NativeOsmandLibrary;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import net.osmand.plus.views.corenative.NativeCoreContext;
import net.osmand.util.SunriseSunset;
import java.text.SimpleDateFormat;
@ -35,12 +36,7 @@ public class DevelopmentSettingsFragment extends BaseSettingsFragment {
setupOpenglRenderPref();
setupSafeModePref();
setupPTSafeMode();
setupDisableComplexRoutingPref();
setupFastRecalculationPref();
setupOsmLiveForRoutingPref();
setupOsmLiveForPublicTransportPref();
setupSimulateYourLocationPref();
Preference debuggingAndDevelopment = findPreference("debugging_and_development");
@ -62,13 +58,19 @@ 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 (app.getSettings().USE_OPENGL_RENDER.get() && NativeCoreContext.isInit()) {
assert useOpenglRender != null;
useOpenglRender.setDescription(getString(R.string.use_opengl_render_descr));
useOpenglRender.setIconSpaceReserved(false);
} else {
assert useOpenglRender != null;
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 +84,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);

View file

@ -19,6 +19,7 @@ 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.views.corenative.NativeCoreContext;
import net.osmand.util.SunriseSunset;
import java.text.SimpleDateFormat;
@ -34,41 +35,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,
R.string.use_opengl_render, R.string.use_opengl_render_descr));
if (app.getSettings().USE_OPENGL_RENDER.get() && NativeCoreContext.isInit()) {
CheckBoxPreference useOpenglRender = createCheckBoxPreference(settings.USE_OPENGL_RENDER, R.string.use_opengl_render, R.string.use_opengl_render_descr);
category.addPreference(useOpenglRender);
}
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 +82,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);
@ -141,7 +128,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 +141,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);

View file

@ -1600,7 +1600,7 @@ public class OsmandSettings {
public final CommonPreference<Long> MAPILLARY_FILTER_TO_DATE = new LongPreference("mapillary_filter_to_date", 0).makeGlobal();
public final CommonPreference<Boolean> MAPILLARY_FILTER_PANO = new BooleanPreference("mapillary_filter_pano", false).makeGlobal();
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeProfile().cache();
public final CommonPreference<Boolean> FORCE_PRIVATE_ACCESS_ROUTING_ASKED = new BooleanPreference("force_private_access_routing", false).makeProfile().cache();
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", false).makeGlobal();
@ -2117,7 +2117,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile();
// dev version
public final CommonPreference<Boolean> DISABLE_COMPLEX_ROUTING = new BooleanPreference("disable_complex_routing", false).makeGlobal();
public final CommonPreference<Boolean> DISABLE_COMPLEX_ROUTING = new BooleanPreference("disable_complex_routing", false).makeProfile();
public final CommonPreference<Boolean> ENABLE_TIME_CONDITIONAL_ROUTING = new BooleanPreference("enable_time_conditional_routing", true).makeProfile();
public boolean simulateNavigation = false;
@ -3852,9 +3852,9 @@ public class OsmandSettings {
public final CommonPreference<Float> ROUTE_RECALCULATION_DISTANCE = new FloatPreference("routing_recalc_distance", 0.f).makeProfile();
public final CommonPreference<Float> ROUTE_STRAIGHT_ANGLE = new FloatPreference("routing_straight_angle", 30.f).makeProfile();
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference("enable_osmc_routing", true).makeGlobal();
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference("enable_osmc_routing", true).makeProfile();
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT = new BooleanPreference("enable_osmc_public_transport", false).makeGlobal();
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_PUBLIC_TRANSPORT = new BooleanPreference("enable_osmc_public_transport", false).makeProfile();
public final OsmandPreference<Boolean> VOICE_MUTE = new BooleanPreference("voice_mute", false).makeProfile().cache();
@ -3863,7 +3863,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> SAFE_MODE = new BooleanPreference("safe_mode", false).makeGlobal();
public final OsmandPreference<Boolean> PT_SAFE_MODE = new BooleanPreference("pt_safe_mode", false).makeGlobal();
public final OsmandPreference<Boolean> PT_SAFE_MODE = new BooleanPreference("pt_safe_mode", false).makeProfile();
public final OsmandPreference<Boolean> NATIVE_RENDERING_FAILED = new BooleanPreference("native_rendering_failed_init", false).makeGlobal();
public final OsmandPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference("use_opengl_render",

View file

@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -25,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.slider.Slider;
import net.osmand.StateChangedListener;
import net.osmand.plus.Version;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
@ -155,6 +157,60 @@ 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() {
SwitchPreferenceEx setupNativePublicTransport = createSwitchPreferenceEx(settings.PT_SAFE_MODE.getId(),
R.string.use_native_pt, R.layout.preference_with_descr_dialog_and_switch);
if (!Version.isBlackberry(app)) {
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);
} else {
setupNativePublicTransport.setVisible(false);
}
}
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.disable_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) {
@ -170,7 +226,7 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
fastRoute.setSummaryOn(R.string.shared_string_on);
fastRoute.setSummaryOff(R.string.shared_string_off);
if (am.getRouteService() == RouteProvider.RouteService.OSMAND){
if (am.getRouteService() == RouteProvider.RouteService.OSMAND) {
GeneralRouter router = app.getRouter(am);
clearParameters();
if (router != null) {
@ -273,6 +329,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) {
@ -300,6 +367,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())) {