Exclude altitude from paid packages & fix update required
This commit is contained in:
parent
6379cf64fc
commit
d1c2505dcc
5 changed files with 14 additions and 11 deletions
|
@ -153,7 +153,7 @@ public class BaseDownloadActivity extends SherlockFragmentActivity {
|
||||||
if (es.getBasename() != null && es.getBasename().contains("_wiki")) {
|
if (es.getBasename() != null && es.getBasename().contains("_wiki")) {
|
||||||
wiki = true;
|
wiki = true;
|
||||||
break;
|
break;
|
||||||
} else if (DownloadActivityType.isCountedInDownloads(es.getType())) {
|
} else if (DownloadActivityType.isCountedInDownloads(es)) {
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.map.OsmandRegions;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -323,7 +322,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
boolean excessLimit = left < 0;
|
boolean excessLimit = left < 0;
|
||||||
if (left < 0)
|
if (left < 0)
|
||||||
left = 0;
|
left = 0;
|
||||||
if (DownloadActivityType.isCountedInDownloads(getDownloadType())) {
|
if (getDownloadType() == DownloadActivityType.NORMAL_FILE || getDownloadType() == DownloadActivityType.ROADS_FILE) {
|
||||||
text += " (" + (excessLimit ? "! " : "") + getString(R.string.files_limit, left).toLowerCase() + ")";
|
text += " (" + (excessLimit ? "! " : "") + getString(R.string.files_limit, left).toLowerCase() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,14 @@ public class DownloadActivityType {
|
||||||
return tags[0];
|
return tags[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCountedInDownloads(DownloadActivityType tp) {
|
|
||||||
|
public static boolean isCountedInDownloads(IndexItem es) {
|
||||||
|
DownloadActivityType tp = es.getType();
|
||||||
if(tp == NORMAL_FILE || tp == ROADS_FILE){
|
if(tp == NORMAL_FILE || tp == ROADS_FILE){
|
||||||
|
if (!es.extra) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +183,7 @@ public class DownloadActivityType {
|
||||||
long timestamp = Algorithms.parseLongSilently(
|
long timestamp = Algorithms.parseLongSilently(
|
||||||
parser.getAttributeValue(null, "timestamp"), 0);
|
parser.getAttributeValue(null, "timestamp"), 0);
|
||||||
IndexItem it = new IndexItem(name, description, timestamp, size, contentSize, containerSize, this);
|
IndexItem it = new IndexItem(name, description, timestamp, size, contentSize, containerSize, this);
|
||||||
|
it.extra = FileNameTranslationHelper.getStandardMapName(ctx, it.getBasename()) != null;
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class DownloadIndexesThread {
|
||||||
boolean result = downloadFile(entry, filesToReindex, forceWifi);
|
boolean result = downloadFile(entry, filesToReindex, forceWifi);
|
||||||
success = result || success;
|
success = result || success;
|
||||||
if (result) {
|
if (result) {
|
||||||
if (DownloadActivityType.isCountedInDownloads(entry.item.getType())) {
|
if (DownloadActivityType.isCountedInDownloads(entry.item)) {
|
||||||
downloads.set(downloads.get() + 1);
|
downloads.set(downloads.get() + 1);
|
||||||
}
|
}
|
||||||
if (entry.existingBackupFile != null) {
|
if (entry.existingBackupFile != null) {
|
||||||
|
@ -288,7 +288,7 @@ public class DownloadIndexesThread {
|
||||||
|
|
||||||
private boolean exceedsFreelimit(DownloadEntry entry) {
|
private boolean exceedsFreelimit(DownloadEntry entry) {
|
||||||
return Version.isFreeVersion(app) &&
|
return Version.isFreeVersion(app) &&
|
||||||
DownloadActivityType.isCountedInDownloads(entry.item.getType()) && downloads.get() >= DownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
|
DownloadActivityType.isCountedInDownloads(entry.item) && downloads.get() >= DownloadActivity.MAXIMUM_AVAILABLE_FREE_DOWNLOADS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String reindexFiles(List<File> filesToReindex) {
|
private String reindexFiles(List<File> filesToReindex) {
|
||||||
|
@ -551,7 +551,7 @@ public class DownloadIndexesThread {
|
||||||
!date.equals(indexactivateddate) &&
|
!date.equals(indexactivateddate) &&
|
||||||
!date.equals(indexfilesdate) &&
|
!date.equals(indexfilesdate) &&
|
||||||
indexActivatedFileNames.containsKey(sfName)) {
|
indexActivatedFileNames.containsKey(sfName)) {
|
||||||
if (item.getType() == DownloadActivityType.NORMAL_FILE ||
|
if ((item.getType() == DownloadActivityType.NORMAL_FILE && !item.extra) ||
|
||||||
item.getType() == DownloadActivityType.ROADS_FILE ||
|
item.getType() == DownloadActivityType.ROADS_FILE ||
|
||||||
item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE){
|
item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE){
|
||||||
itemsToUpdate.add(item);
|
itemsToUpdate.add(item);
|
||||||
|
@ -649,7 +649,7 @@ public class DownloadIndexesThread {
|
||||||
Collection<List<DownloadEntry>> vs = getEntriesToDownload().values();
|
Collection<List<DownloadEntry>> vs = getEntriesToDownload().values();
|
||||||
for (List<DownloadEntry> v : vs) {
|
for (List<DownloadEntry> v : vs) {
|
||||||
for(DownloadEntry e : v) {
|
for(DownloadEntry e : v) {
|
||||||
if(DownloadActivityType.isCountedInDownloads(e.item.getType())) {
|
if(DownloadActivityType.isCountedInDownloads(e.item)) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.download;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -16,7 +15,6 @@ import net.osmand.plus.R;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.format.DateFormat;
|
|
||||||
|
|
||||||
public class IndexItem implements Comparable<IndexItem> {
|
public class IndexItem implements Comparable<IndexItem> {
|
||||||
private static final Log log = PlatformUtil.getLog(IndexItem.class);
|
private static final Log log = PlatformUtil.getLog(IndexItem.class);
|
||||||
|
@ -28,6 +26,7 @@ public class IndexItem implements Comparable<IndexItem> {
|
||||||
long contentSize;
|
long contentSize;
|
||||||
long containerSize;
|
long containerSize;
|
||||||
DownloadActivityType type;
|
DownloadActivityType type;
|
||||||
|
boolean extra;
|
||||||
|
|
||||||
|
|
||||||
public IndexItem(String fileName, String description, long timestamp, String size, long contentSize,
|
public IndexItem(String fileName, String description, long timestamp, String size, long contentSize,
|
||||||
|
|
Loading…
Reference in a new issue