Change description in the settings to safe mode

This commit is contained in:
Victor Shcherb 2012-11-12 01:00:07 +01:00
parent 4d653825d6
commit a5339eabdf
6 changed files with 16 additions and 12 deletions

View file

@ -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
-->
<string name="safe_mode_description">Run the application in the safe mode (using Android code instead of native).</string>
<string name="safe_mode">Safe mode</string>
<string name="native_library_not_running">The application is running in the safe mode (disable it in the Settings).</string>
<string name="background_service_is_enabled_question">Background service is still running. Do you want to cancel it?</string>
<string name="tip_recent_changes_1_0_0_t">Changes in 1.0 :
\n\t* Improved routing faster and more precise (up to 250 km)

View file

@ -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));

View file

@ -1336,7 +1336,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> MAP_ACTIVITY_ENABLED = new BooleanPreference("map_activity_enabled", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> NATIVE_RENDERING = new BooleanPreference("native_rendering", true).makeGlobal();
public final OsmandPreference<Boolean> SAFE_MODE = new BooleanPreference("safe_mode", false).makeGlobal();
public final OsmandPreference<Boolean> NATIVE_RENDERING_FAILED = new BooleanPreference("native_rendering_failed_init", false).makeGlobal();

View file

@ -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());
}

View file

@ -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<String> 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();
}

View file

@ -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);