diff --git a/OsmAnd/src/net/osmand/Version.java b/OsmAnd/src/net/osmand/Version.java index efed7d815b..267d679106 100644 --- a/OsmAnd/src/net/osmand/Version.java +++ b/OsmAnd/src/net/osmand/Version.java @@ -10,6 +10,7 @@ public class Version { private final String appVersion; private final String appName; + private final static String FREE_VERSION_NAME = "net.osmand"; private Version(Context ctx) { appVersion = ctx.getString(R.string.app_version); @@ -52,6 +53,11 @@ public class Version { } } + public static boolean isFreeVersion(Context ctx){ + return ctx.getPackageName().equals(FREE_VERSION_NAME); + + } + public static String getVersionForTracker(Context ctx) { String v = Version.getAppName(ctx); if(Version.isProductionVersion(ctx)){ diff --git a/OsmAnd/src/net/osmand/plus/ResourceManager.java b/OsmAnd/src/net/osmand/plus/ResourceManager.java index 6f1e6bbdf8..5bdceec651 100644 --- a/OsmAnd/src/net/osmand/plus/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/ResourceManager.java @@ -508,7 +508,7 @@ public class ResourceManager { progress.startTask(context.getString(R.string.indexing_map) + " " + f.getName(), -1); //$NON-NLS-1$ try { BinaryMapIndexReader index = renderer.initializeNewResource(progress, f); - if (index == null) { + if (index == null || (Version.isFreeVersion(context) && f.getName().contains("_wiki"))) { warnings.add(MessageFormat.format(context.getString(R.string.version_index_is_not_supported), f.getName())); //$NON-NLS-1$ } else { if(index.isBasemap()) { diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java index 7d29668d3f..b35c179d83 100644 --- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java @@ -24,6 +24,7 @@ import java.util.TreeSet; import net.osmand.Algoritms; import net.osmand.IProgress; +import net.osmand.Version; import net.osmand.access.AccessibleToast; import net.osmand.data.IndexConstants; import net.osmand.plus.DownloadOsmandIndexesHelper; @@ -89,7 +90,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { private Map indexActivatedFileNames = null; private TreeMap entriesToDownload = new TreeMap(); - private String FREE_VERSION_NAME = "net.osmand"; private int MAXIMUM_AVAILABLE_FREE_DOWNLOADS = 8; @@ -158,7 +158,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { } else { downloadIndexList(); } - if(getPackageName().equals(FREE_VERSION_NAME) && settings.checkFreeDownloadsNumberZero()){ + if(Version.isFreeVersion(this) && settings.checkFreeDownloadsNumberZero()){ Builder msg = new AlertDialog.Builder(this); msg.setTitle(R.string.free_version_title); msg.setMessage(getString(R.string.free_version_message, MAXIMUM_AVAILABLE_FREE_DOWNLOADS+"", "")); @@ -449,7 +449,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { } protected void downloadFilesCheckFreeVersion() { - if (getPackageName().equals(FREE_VERSION_NAME)) { + if (Version.isFreeVersion(this)) { int total = settings.NUMBER_OF_FREE_DOWNLOADS.get() + entriesToDownload.size(); boolean wiki = false; for (DownloadEntry es : entriesToDownload.values()) {