From f4a0ff5fe440997d8ce970929d1c5cfdc46322b0 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 26 Apr 2012 23:45:50 +0200 Subject: [PATCH] Set native rendering as default --- OsmAnd/src/net/osmand/plus/OsmandApplication.java | 12 +++++++++--- OsmAnd/src/net/osmand/plus/OsmandSettings.java | 4 +++- .../net/osmand/plus/activities/SettingsActivity.java | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index c47dfb2e08..83212425cf 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -364,18 +364,24 @@ public class OsmandApplication extends Application { } private void startApplicationBackground() { - List warnings = null; + List warnings = new ArrayList(); try { - if (osmandSettings.NATIVE_RENDERING.get()) { + if(osmandSettings.NATIVE_RENDERING_FAILED.get()){ + osmandSettings.NATIVE_RENDERING.set(false); + osmandSettings.NATIVE_RENDERING_FAILED.set(false); + warnings.add(getString(R.string.native_library_not_supported)); + } else if (osmandSettings.NATIVE_RENDERING.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); } } - warnings = manager.reloadIndexes(startDialog); + warnings.addAll(manager.reloadIndexes(startDialog)); player = null; SavingTrackHelper helper = new SavingTrackHelper(OsmandApplication.this); if (helper.hasDataToSave()) { diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 5ad47947bf..de9882df38 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1095,7 +1095,9 @@ public class OsmandSettings { public final OsmandPreference TEST_ANIMATE_ROUTING = new BooleanPreference("animate_routing", false, true); // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference NATIVE_RENDERING = new BooleanPreference("native_rendering", false, true); + public final OsmandPreference NATIVE_RENDERING = new BooleanPreference("native_rendering", true, true); + + public final OsmandPreference NATIVE_RENDERING_FAILED = new BooleanPreference("native_rendering_failed_init", false, true); // this value string is synchronized with settings_pref.xml preference name diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index a6f4be19f1..7e2a88eed9 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -203,7 +203,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference registerBooleanPreference(osmandSettings.SHOW_RULER,screen); CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen); //disable the checkbox if the library cannot be used - if (NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) { + if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || + osmandSettings.NATIVE_RENDERING_FAILED.get()) { nativeCheckbox.setEnabled(false); }