diff --git a/OsmAnd/assets/bundled_assets.xml b/OsmAnd/assets/bundled_assets.xml
index 6ab2cc2f2a..99a6526868 100755
--- a/OsmAnd/assets/bundled_assets.xml
+++ b/OsmAnd/assets/bundled_assets.xml
@@ -5,6 +5,7 @@
+
@@ -30,14 +31,11 @@
-
-
-
-
+
diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java
index cdf682e8d9..6129da4358 100644
--- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java
@@ -325,7 +325,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
boolean running = task instanceof DownloadIndexesThread.DownloadIndexesAsyncTask;
((Button) findViewById(R.id.DownloadButton)).setEnabled(!running);
String text;
- int downloads = downloadListIndexThread. getDownloads();
+ int downloads = downloadListIndexThread.getDownloads();
if (!running) {
text = getString(R.string.download_files) + " (" + downloads + ")"; //$NON-NLS-1$
} else {
@@ -333,6 +333,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
}
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
if (Version.isFreeVersion(getMyApplication())) {
+ int countedDownloads = downloadListIndexThread.getDownloads();
int left = MAXIMUM_AVAILABLE_FREE_DOWNLOADS - settings.NUMBER_OF_FREE_DOWNLOADS.get() - downloads;
boolean excessLimit = left < 0;
if (left < 0)
@@ -482,7 +483,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
if (es.getBasename() != null && es.getBasename().contains("_wiki")) {
wiki = true;
break;
- } else if (DownloadActivityType.isCountedInDownloads(es.getType())) {
+ } else if (DownloadActivityType.isCountedInDownloads(es)) {
total++;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java
index 51bf7d267c..e28734c186 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java
@@ -3,7 +3,20 @@ package net.osmand.plus.download;
public enum DownloadActivityType {
NORMAL_FILE, ROADS_FILE, /*SRTM_FILE, */HILLSHADE_FILE, SRTM_COUNTRY_FILE;
- public static boolean isCountedInDownloads(DownloadActivityType tp) {
- return tp != HILLSHADE_FILE && tp != SRTM_COUNTRY_FILE;
+ public static boolean isCountedInDownloads(IndexItem es) {
+ DownloadActivityType tp = es.getType();
+ if(tp == HILLSHADE_FILE || tp == SRTM_COUNTRY_FILE || es.isVoiceItem()){
+ return false;
+ }
+ return true;
}
+
+ public static boolean isCountedInDownloads(DownloadActivityType tp) {
+ if(tp == HILLSHADE_FILE || tp == SRTM_COUNTRY_FILE){
+ return false;
+ }
+ return true;
+ }
+
+
}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadEntry.java b/OsmAnd/src/net/osmand/plus/download/DownloadEntry.java
index eca6c58c50..5be01790ae 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadEntry.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadEntry.java
@@ -23,13 +23,15 @@ public class DownloadEntry {
public List srtmFilesToDownload;
public DownloadEntry attachedEntry;
+ public IndexItem item;
- public DownloadEntry() {
- // default
+ public DownloadEntry(IndexItem item) {
+ this.item = item;
}
- public DownloadEntry(String assetName, String fileName, long dateModified) {
+ public DownloadEntry(IndexItem pr, String assetName, String fileName, long dateModified) {
this.dateModified = dateModified;
+ this.item = pr;
targetFile = new File(fileName);
this.assetName = assetName;
isAsset = true;
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
index b262ca3ab6..5540419c25 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java
@@ -18,7 +18,6 @@ import java.util.concurrent.ConcurrentHashMap;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast;
-import net.osmand.map.RegionCountry;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings.OsmandPreference;
@@ -230,7 +229,7 @@ public class DownloadIndexesThread {
boolean result = downloadFile(entry, filesToReindex, forceWifi);
success = result || success;
if (result) {
- if (DownloadActivityType.isCountedInDownloads(entry.type)) {
+ if (DownloadActivityType.isCountedInDownloads(entry.item)) {
downloads.set(downloads.get() + 1);
}
if (entry.existingBackupFile != null) {
@@ -265,7 +264,7 @@ public class DownloadIndexesThread {
private boolean exceedsFreelimit(DownloadEntry entry) {
return Version.isFreeVersion(app) &&
- DownloadActivityType.isCountedInDownloads(entry.type) && downloads.get() >= DownloadIndexActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
+ DownloadActivityType.isCountedInDownloads(entry.item) && downloads.get() >= DownloadIndexActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
}
private String reindexFiles(List filesToReindex) {
@@ -582,5 +581,18 @@ public class DownloadIndexesThread {
return i;
}
+ public int getCountedDownloads() {
+ int i = 0;
+ Collection> vs = getEntriesToDownload().values();
+ for (List v : vs) {
+ for(DownloadEntry e : v) {
+ if(DownloadActivityType.isCountedInDownloads(e.item)) {
+ i++;
+ }
+ }
+ }
+ return i;
+ }
+
}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java
index 0ea835ab0e..afb1762ca4 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java
@@ -216,7 +216,7 @@ public class DownloadOsmandIndexesHelper {
@Override
public List createDownloadEntry(ClientContext ctx, DownloadActivityType type, List res) {
- res.add(new DownloadEntry(assetName, destFile, dateModified));
+ res.add(new DownloadEntry(this, assetName, destFile, dateModified));
return res;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItem.java b/OsmAnd/src/net/osmand/plus/download/IndexItem.java
index 6b5011c8ed..941105a01f 100644
--- a/OsmAnd/src/net/osmand/plus/download/IndexItem.java
+++ b/OsmAnd/src/net/osmand/plus/download/IndexItem.java
@@ -74,6 +74,10 @@ public class IndexItem implements Comparable {
return s + getBasename().replace('_', ' ');
}
+ public boolean isVoiceItem() {
+ return fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP) || fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP);
+ }
+
public String getBasename() {
if (fileName.endsWith(IndexConstants.EXTRA_ZIP_EXT)) {
return fileName.substring(0, fileName.length() - IndexConstants.EXTRA_ZIP_EXT.length());
@@ -196,7 +200,7 @@ public class IndexItem implements Comparable {
if (parent == null || !parent.exists()) {
ctx.showToastMessage(R.string.sd_dir_not_accessible);
} else {
- entry = new DownloadEntry();
+ entry = new DownloadEntry(this);
entry.type = type;
entry.baseName = getBasename();
String url = "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/download?event=2&";