diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 0fb33917d6..fe45a464ee 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,7 @@ Thx - Hardy --> + Revert Track saved File name is empty Used to estimate arrival time for unknown type of roads and to limit speed for all roads (could change the route) diff --git a/OsmAnd/res/xml/general_profile_settings.xml b/OsmAnd/res/xml/general_profile_settings.xml index c6d681bb55..d081965fc6 100644 --- a/OsmAnd/res/xml/general_profile_settings.xml +++ b/OsmAnd/res/xml/general_profile_settings.xml @@ -107,4 +107,11 @@ android:layout="@layout/preference_with_descr_dialog_and_switch" android:title="@string/external_input_device" /> + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index df9134d894..3e91afa37b 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1368,7 +1368,7 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference USE_TRACKBALL_FOR_MOVEMENTS = - new BooleanPreference("use_trackball_for_movements", true).makeGlobal(); + new BooleanPreference("use_trackball_for_movements", true).makeProfile().makeGeneral(); // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference ACCESSIBILITY_SMART_AUTOANNOUNCE = diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index be36276183..882f2d0df7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -796,7 +796,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { } }); builder.setNegativeButton(R.string.shared_string_cancel, null); - builder.setNeutralButton("Revert", new OnClickListener() { + builder.setNeutralButton(R.string.shared_string_revert, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mode.resetDefaultSpeed(app); diff --git a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java index 7d23b399df..4ec23cfbd4 100644 --- a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java @@ -16,6 +16,7 @@ import net.osmand.plus.OsmAndLocationSimulation; import net.osmand.plus.OsmandApplication; import net.osmand.plus.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.util.SunriseSunset; @@ -29,23 +30,25 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { @SuppressLint("SimpleDateFormat") @Override public void onCreate(Bundle savedInstanceState) { - ((OsmandApplication) getApplication()).applyTheme(this); + OsmandApplication app = getMyApplication(); + app.applyTheme(this); super.onCreate(savedInstanceState); getToolbar().setTitle(R.string.debugging_and_development); PreferenceScreen cat = getPreferenceScreen(); Preference pref; cat.addPreference(createCheckBoxPreference(settings.USE_OPENGL_RENDER, - R.string.use_opengl_render,R.string.use_opengl_render_descr)); + R.string.use_opengl_render, R.string.use_opengl_render_descr)); - CheckBoxPreference nativeCheckbox = createCheckBoxPreference(settings.SAFE_MODE, R.string.safe_mode, - R.string.safe_mode_description); - // 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); + if (!Version.isBlackberry(app)) { + CheckBoxPreference nativeCheckbox = createCheckBoxPreference(settings.SAFE_MODE, R.string.safe_mode, R.string.safe_mode_description); + // 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(nativeCheckbox); PreferenceCategory navigation = new PreferenceCategory(this); navigation.setTitle(R.string.routing_settings); diff --git a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java index a72c88e01c..e5bb17f270 100644 --- a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java @@ -26,10 +26,10 @@ import android.support.v7.preference.Preference.OnPreferenceClickListener; import android.support.v7.preference.PreferenceFragmentCompat; import android.support.v7.preference.PreferenceGroup; import android.support.v7.preference.PreferenceGroupAdapter; +import android.support.v7.preference.PreferenceManager; import android.support.v7.preference.PreferenceScreen; import android.support.v7.preference.PreferenceViewHolder; import android.support.v7.preference.SwitchPreferenceCompat; -import android.support.v7.view.ContextThemeWrapper; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; @@ -123,6 +123,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } @Override + @SuppressLint("RestrictedApi") public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { nightMode = !settings.isLightContent(); themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; @@ -130,7 +131,16 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl View view = super.onCreateView(inflater, container, savedInstanceState); if (view != null) { AndroidUtils.addStatusBarPadding21v(getContext(), view); - updateAllSettings(); + if (getPreferenceScreen() != null) { + PreferenceManager prefManager = getPreferenceManager(); + PreferenceScreen preferenceScreen = prefManager.inflateFromResource(prefManager.getContext(), currentScreenType.preferencesResId, null); + if (prefManager.setPreferences(preferenceScreen)) { + setupPreferences(); + registerPreferences(preferenceScreen); + } + } else { + updateAllSettings(); + } createToolbar(inflater, view); setDivider(null); view.setBackgroundColor(ContextCompat.getColor(app, getBackgroundColorRes())); diff --git a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java index 9db9a02747..fdaa8da7eb 100644 --- a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java @@ -3,6 +3,7 @@ package net.osmand.plus.settings; import android.content.Context; import android.content.DialogInterface; import android.content.pm.ActivityInfo; +import android.content.res.Configuration; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.v4.app.FragmentManager; @@ -28,6 +29,7 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; +import net.osmand.plus.Version; import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet; @@ -61,6 +63,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme setupMagneticFieldSensorPref(); setupMapEmptyStateAllowedPref(); setupExternalInputDevicePref(); + setupTrackballForMovementsPref(); } @Override @@ -277,6 +280,20 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme ); } + private void setupTrackballForMovementsPref() { + SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.USE_TRACKBALL_FOR_MOVEMENTS.getId()); + mapEmptyStateAllowedPref.setTitle(getString(R.string.use_trackball)); + mapEmptyStateAllowedPref.setDescription(getString(R.string.use_trackball_descr)); + + boolean visible = false; + if (!Version.isBlackberry(app)) { + int nav = getResources().getConfiguration().navigation; + visible = nav == Configuration.NAVIGATION_DPAD || nav == Configuration.NAVIGATION_TRACKBALL || + nav == Configuration.NAVIGATION_WHEEL || nav == Configuration.NAVIGATION_UNDEFINED; + } + mapEmptyStateAllowedPref.setVisible(visible); + } + private void showDrivingRegionDialog() { Context themedContext = UiUtilities.getThemedContext(getActivity(), isNightMode()); AlertDialog.Builder b = new AlertDialog.Builder(themedContext); diff --git a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java index b2de0d6a8c..834e98ffa9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java @@ -286,6 +286,8 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP } recalculateRoute(); return true; + } else if ("prouting_short_way".equals(key) && newValue instanceof Boolean) { + return app.getSettings().FAST_ROUTE_MODE.setModeValue(getSelectedAppMode(), !(Boolean) newValue); } return super.onPreferenceChange(preference, newValue);