From c8d76dc85c5cd7c9afdb12f7599d6e50830d68df Mon Sep 17 00:00:00 2001 From: veliymolfar Date: Mon, 10 Feb 2020 17:34:19 +0200 Subject: [PATCH] corrections --- .../java/net/osmand/map/TileSourceManager.java | 14 -------------- OsmAnd/src/net/osmand/plus/SQLiteTileSource.java | 2 +- OsmAnd/src/net/osmand/plus/SettingsHelper.java | 4 ++++ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java b/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java index 38e8307abb..79ee4e7e34 100644 --- a/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java +++ b/OsmAnd-java/src/main/java/net/osmand/map/TileSourceManager.java @@ -1,7 +1,5 @@ package net.osmand.map; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; import net.osmand.PlatformUtil; import net.osmand.osm.io.NetworkUtils; @@ -20,7 +18,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.lang.reflect.Type; import java.net.URLConnection; import java.text.MessageFormat; import java.util.ArrayList; @@ -707,15 +704,4 @@ public class TileSourceManager { templ.setRandoms(randoms); return templ; } - - public String templatesListToString(List templates) { - return new Gson().toJson(templates); - } - - public List parseTemplatesList(String json) { - Type type = new TypeToken>() { - }.getType(); - ArrayList templates = new Gson().fromJson(json, type); - return templates != null ? templates : new ArrayList(); - } } diff --git a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java index 23553bede7..391ccfa48a 100644 --- a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java +++ b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java @@ -167,7 +167,7 @@ public class SQLiteTileSource implements ITileSource { return this.urlTemplate; } else { SQLiteConnection db = getDatabase(); - if (db == null || db.isReadOnly() || urlTemplate == null) { + if (db == null || urlTemplate == null) { return null; } else { return this.urlTemplate; diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index 289662c66d..40177988b1 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -64,8 +64,10 @@ import static net.osmand.IndexConstants.TILES_INDEX_DIR; /* Usage: + SettingsHelper helper = app.getSettingsHelper(); File file = new File(app.getAppPath(null), "settings.zip"); + List items = new ArrayList<>(); items.add(new GlobalSettingsItem(app.getSettings())); items.add(new ProfileSettingsItem(app.getSettings(), ApplicationMode.DEFAULT)); @@ -77,7 +79,9 @@ import static net.osmand.IndexConstants.TILES_INDEX_DIR; items.add(new FileSettingsItem(app, new File(app.getAppPath(RENDERERS_DIR), "default.render.xml"))); items.add(new DataSettingsItem(new byte[] {'t', 'e', 's', 't', '1'}, "data1")); items.add(new DataSettingsItem(new byte[] {'t', 'e', 's', 't', '2'}, "data2")); + helper.exportSettings(file, items); + helper.importSettings(file); */