diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 68f5dc31eb..9cc7f8b6fe 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,9 @@ 1. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Run the application in the safe mode (using Android code instead of native). + Safe mode + The application is running in the safe mode (disable it in the Settings). Background service is still running. Do you want to cancel it? Changes in 1.0 : \n\t* Improved routing faster and more precise (up to 250 km) diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 697d0d6268..2c520f9978 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -429,19 +429,20 @@ public class OsmandApplication extends Application { try { if (!Version.isBlackberry(this)) { if (osmandSettings.NATIVE_RENDERING_FAILED.get()) { - osmandSettings.NATIVE_RENDERING.set(false); + osmandSettings.SAFE_MODE.set(true); osmandSettings.NATIVE_RENDERING_FAILED.set(false); warnings.add(getString(R.string.native_library_not_supported)); - } else if (osmandSettings.NATIVE_RENDERING.get()) { + } else if (!osmandSettings.SAFE_MODE.get()) { osmandSettings.NATIVE_RENDERING_FAILED.set(true); startDialog.startTask(getString(R.string.init_native_library), -1); RenderingRulesStorage storage = rendererRegistry.getCurrentSelectedRenderer(); boolean initialized = NativeOsmandLibrary.getLibrary(storage) != null; osmandSettings.NATIVE_RENDERING_FAILED.set(false); if (!initialized) { - LOG.info("Native library could not loaded!"); - osmandSettings.NATIVE_RENDERING.set(false); + LOG.info("Native library could not be loaded!"); } + } else { + warnings.add(getString(R.string.native_library_not_running)); } } warnings.addAll(manager.reloadIndexes(startDialog)); diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 465e72b243..ea7a132c4f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1336,7 +1336,7 @@ public class OsmandSettings { public final OsmandPreference MAP_ACTIVITY_ENABLED = new BooleanPreference("map_activity_enabled", false).makeGlobal(); // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference NATIVE_RENDERING = new BooleanPreference("native_rendering", true).makeGlobal(); + public final OsmandPreference SAFE_MODE = new BooleanPreference("safe_mode", false).makeGlobal(); public final OsmandPreference NATIVE_RENDERING_FAILED = new BooleanPreference("native_rendering_failed_init", false).makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/ResourceManager.java b/OsmAnd/src/net/osmand/plus/ResourceManager.java index bf4eb0ef6f..8000003617 100644 --- a/OsmAnd/src/net/osmand/plus/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/ResourceManager.java @@ -535,8 +535,7 @@ public class ResourceManager { if(indCache.exists()) { try { cachedOsmandIndexes.readFromFile(indCache, CachedOsmandIndexes.VERSION); - NativeOsmandLibrary nativeLib = context.getSettings().NATIVE_RENDERING.get() ? NativeOsmandLibrary.getLoadedLibrary() - : null; + NativeOsmandLibrary nativeLib = NativeOsmandLibrary.getLoadedLibrary(); if(nativeLib != null) { nativeLib.initCacheMapFile(indCache.getAbsolutePath()); } diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index ddf51439d4..3b1571d3a8 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -268,11 +268,12 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference PreferenceCategory cat = (PreferenceCategory) screen.findPreference("global_app_settings"); if (!Version.isBlackberry(this)) { - CheckBoxPreference nativeCheckbox = createCheckBoxPreference(osmandSettings.NATIVE_RENDERING, R.string.native_rendering, - R.string.vector_maps_may_display_faster_on_some_devices); + CheckBoxPreference nativeCheckbox = createCheckBoxPreference(osmandSettings.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()) || osmandSettings.NATIVE_RENDERING_FAILED.get()) { nativeCheckbox.setEnabled(false); + nativeCheckbox.setChecked(true); } cat.addPreference(nativeCheckbox); @@ -480,7 +481,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference OsmandPreference editPref = editTextPreferences.get(preference.getKey()); if (boolPref != null) { boolPref.set((Boolean) newValue); - if (boolPref.getId().equals(osmandSettings.NATIVE_RENDERING.getId())) { + if (boolPref.getId().equals(osmandSettings.SAFE_MODE.getId())) { if (((Boolean) newValue).booleanValue()) { loadNativeLibrary(); } diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 46772dc560..97b7c4412c 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -107,7 +107,7 @@ public class MapRenderRepositories { } files.put(file.getAbsolutePath(), reader); - NativeOsmandLibrary nativeLib = prefs.NATIVE_RENDERING.get() ? NativeOsmandLibrary.getLoadedLibrary() : null; + NativeOsmandLibrary nativeLib = NativeOsmandLibrary.getLoadedLibrary(); if (nativeLib != null) { if (!nativeLib.initMapFile(file.getAbsolutePath())) { log.error("Initializing native db " + file.getAbsolutePath() + " failed!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -472,7 +472,7 @@ public class MapRenderRepositories { } } renderingReq.saveState(); - NativeOsmandLibrary nativeLib = prefs.NATIVE_RENDERING.get() ? NativeOsmandLibrary.getLibrary(storage) : null; + NativeOsmandLibrary nativeLib = !prefs.SAFE_MODE.get() ? NativeOsmandLibrary.getLibrary(storage) : null; // prevent editing requestedBox = new RotatedTileBox(tileRect);