From 043e24b8a3e51218ad949d70b34aa9e8fe4b8315 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 16 Apr 2020 19:08:16 +0300 Subject: [PATCH] Add custom sqlite downloads --- OsmAnd/src/net/osmand/plus/SettingsHelper.java | 4 +++- .../osmand/plus/download/DownloadActivityType.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index 7a73012f5a..f4a98c162d 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -464,6 +464,7 @@ public class SettingsHelper { @Override protected void init() { + super.init(); items = new ArrayList<>(); } @@ -573,6 +574,7 @@ public class SettingsHelper { @Override protected void init() { + super.init(); items = new ArrayList<>(); } @@ -785,8 +787,8 @@ public class SettingsHelper { headers.put(localeKey, name); } } - String headerButton = object.optString("header-button", null); + String headerŠ”olor = object.optString("header-color", null); JSONArray downloadItemsArray = object.optJSONArray("items"); if (downloadItemsArray != null) { diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java index 953d0c8e14..7bde53b277 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java @@ -53,6 +53,8 @@ public class DownloadActivityType { new DownloadActivityType(R.string.download_live_updates, "live_updates", 70); public static final DownloadActivityType GPX_FILE = new DownloadActivityType(R.string.shared_string_gpx_tracks, R.drawable.ic_action_polygom_dark, "gpx", 75); + public static final DownloadActivityType SQLITE_FILE = + new DownloadActivityType(R.string.shared_string_online_maps, "sqlite", 80); private final int stringResource; private final int iconResource; @@ -141,6 +143,8 @@ public class DownloadActivityType { return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION)); } else if (GPX_FILE == this) { return fileName.endsWith(IndexConstants.GPX_FILE_EXT); + } else if (SQLITE_FILE == this) { + return fileName.endsWith(IndexConstants.GPX_FILE_EXT); } return false; } @@ -173,12 +177,14 @@ public class DownloadActivityType { return ctx.getAppPath(IndexConstants.MAPS_PATH); } else if (GPX_FILE == this) { return ctx.getAppPath(IndexConstants.GPX_INDEX_DIR); + } else if (SQLITE_FILE == this) { + return ctx.getAppPath(IndexConstants.TILES_INDEX_DIR); } throw new UnsupportedOperationException(); } public boolean isZipStream(OsmandApplication ctx, IndexItem indexItem) { - return HILLSHADE_FILE != this && SLOPE_FILE != this && WIKIVOYAGE_FILE != this && GPX_FILE != this; + return HILLSHADE_FILE != this && SLOPE_FILE != this && SQLITE_FILE != this && WIKIVOYAGE_FILE != this && GPX_FILE != this; } public boolean isZipFolder(OsmandApplication ctx, IndexItem indexItem) { @@ -220,6 +226,8 @@ public class DownloadActivityType { return IndexConstants.SQLITE_EXT; } else if (SLOPE_FILE == this) { return IndexConstants.SQLITE_EXT; + } else if (SQLITE_FILE == this) { + return IndexConstants.SQLITE_EXT; } else if (DEPTH_CONTOUR_FILE == this) { return BINARY_MAP_INDEX_EXT; } else if (GPX_FILE == this) { @@ -383,6 +391,8 @@ public class DownloadActivityType { return fileName.replace('_', ' '); } else if (this == SLOPE_FILE) { return fileName.replace('_', ' '); + } else if (this == SQLITE_FILE) { + return fileName.replace('_', ' '); } else if (this == LIVE_UPDATES_FILE) { int l = fileName.lastIndexOf('.'); if (l == -1) {