Set native rendering as default

This commit is contained in:
Victor Shcherb 2012-04-26 23:45:50 +02:00
parent f7ad7fd703
commit f4a0ff5fe4
3 changed files with 14 additions and 5 deletions

View file

@ -364,18 +364,24 @@ public class OsmandApplication extends Application {
} }
private void startApplicationBackground() { private void startApplicationBackground() {
List<String> warnings = null; List<String> warnings = new ArrayList<String>();
try { 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); startDialog.startTask(getString(R.string.init_native_library), -1);
RenderingRulesStorage storage = rendererRegistry.getCurrentSelectedRenderer(); RenderingRulesStorage storage = rendererRegistry.getCurrentSelectedRenderer();
boolean initialized = NativeOsmandLibrary.getLibrary(storage) != null; boolean initialized = NativeOsmandLibrary.getLibrary(storage) != null;
osmandSettings.NATIVE_RENDERING_FAILED.set(false);
if (!initialized) { if (!initialized) {
LOG.info("Native library could not loaded!"); LOG.info("Native library could not loaded!");
osmandSettings.NATIVE_RENDERING.set(false); osmandSettings.NATIVE_RENDERING.set(false);
} }
} }
warnings = manager.reloadIndexes(startDialog); warnings.addAll(manager.reloadIndexes(startDialog));
player = null; player = null;
SavingTrackHelper helper = new SavingTrackHelper(OsmandApplication.this); SavingTrackHelper helper = new SavingTrackHelper(OsmandApplication.this);
if (helper.hasDataToSave()) { if (helper.hasDataToSave()) {

View file

@ -1095,7 +1095,9 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> TEST_ANIMATE_ROUTING = new BooleanPreference("animate_routing", false, true); public final OsmandPreference<Boolean> TEST_ANIMATE_ROUTING = new BooleanPreference("animate_routing", false, true);
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> NATIVE_RENDERING = new BooleanPreference("native_rendering", false, true); public final OsmandPreference<Boolean> NATIVE_RENDERING = new BooleanPreference("native_rendering", true, true);
public final OsmandPreference<Boolean> NATIVE_RENDERING_FAILED = new BooleanPreference("native_rendering_failed_init", false, true);
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name

View file

@ -203,7 +203,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
registerBooleanPreference(osmandSettings.SHOW_RULER,screen); registerBooleanPreference(osmandSettings.SHOW_RULER,screen);
CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen); CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen);
//disable the checkbox if the library cannot be used //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); nativeCheckbox.setEnabled(false);
} }