Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f504756c12
7 changed files with 46 additions and 16 deletions
|
@ -5,6 +5,7 @@
|
|||
<!-- alwaysCopyOnFirstInstall - Copies file on first install, always -->
|
||||
<!-- alwaysOverwriteOrCopy - Copies or overwrites file unconditionally -->
|
||||
<!-- copyOnlyIfDoesNotExist - Copies file only this file is not present on target system -->
|
||||
<asset source="voice/be/ttsconfig.p" destination="voice/be-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/cs/ttsconfig.p" destination="voice/cs-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/da/ttsconfig.p" destination="voice/da-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/de/ttsconfig.p" destination="voice/de-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
|
||||
|
@ -30,14 +31,11 @@
|
|||
<asset source="voice/sw/ttsconfig.p" destination="voice/sw-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/zh/ttsconfig.p" destination="voice/zh-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
|
||||
<!-- TODO user need to redownload voice en-ov -->
|
||||
<asset source="voice/en/config.p" destination="voice/en/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<!-- <asset source="voice/en/config.p" destination="voice/en-m/_config.p" mode="overwriteOnlyIfExists" /> -->
|
||||
<asset source="voice/ru/config.p" destination="voice/ru/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<!-- <asset source="voice/ru/config.p" destination="voice/ru-m/_config.p" mode="overwriteOnlyIfExists" /> -->
|
||||
<asset source="voice/es/config.p" destination="voice/es/_config.p" mode="overwriteOnlyIfExists" />
|
||||
|
||||
<!-- TODO name conflict could be soon -->
|
||||
<!-- TODO delete deprecated -->
|
||||
<asset source="voice/fr-ov/config.p" destination="voice/fr/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/he-ov/config.p" destination="voice/he/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<!-- Could be deleted later after release -->
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -23,13 +23,15 @@ public class DownloadEntry {
|
|||
|
||||
public List<String> 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;
|
||||
|
|
|
@ -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<File> filesToReindex) {
|
||||
|
@ -582,5 +581,18 @@ public class DownloadIndexesThread {
|
|||
return i;
|
||||
}
|
||||
|
||||
public int getCountedDownloads() {
|
||||
int i = 0;
|
||||
Collection<List<DownloadEntry>> vs = getEntriesToDownload().values();
|
||||
for (List<DownloadEntry> v : vs) {
|
||||
for(DownloadEntry e : v) {
|
||||
if(DownloadActivityType.isCountedInDownloads(e.item)) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -216,7 +216,7 @@ public class DownloadOsmandIndexesHelper {
|
|||
|
||||
@Override
|
||||
public List<DownloadEntry> createDownloadEntry(ClientContext ctx, DownloadActivityType type, List<DownloadEntry> res) {
|
||||
res.add(new DownloadEntry(assetName, destFile, dateModified));
|
||||
res.add(new DownloadEntry(this, assetName, destFile, dateModified));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,10 @@ public class IndexItem implements Comparable<IndexItem> {
|
|||
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<IndexItem> {
|
|||
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&";
|
||||
|
|
Loading…
Reference in a new issue