Merge pull request #9353 from osmandapp/auto_update_voices

compare by date preferred then size
This commit is contained in:
vshcherb 2020-06-30 13:33:44 +02:00 committed by GitHub
commit f87138af63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -187,10 +187,11 @@ public class DownloadResources extends DownloadResourceGroup {
outdated = true;
}
} else {
long itemSize = item.getContentSize();
long oldItemSize = 0;
if (item.getType() == DownloadActivityType.VOICE_FILE) {
if (parsed && item.getTimestamp() > item.getLocalTimestamp()) {
outdated = true;
} else if (item.getType() == DownloadActivityType.VOICE_FILE) {
if (item instanceof AssetIndexItem) {
File file = new File(((AssetIndexItem) item).getDestFile());
oldItemSize = file.length();
@ -213,7 +214,7 @@ public class DownloadResources extends DownloadResourceGroup {
} else {
oldItemSize = app.getAppPath(item.getTargetFileName()).length();
}
if (itemSize != oldItemSize) {
if (!parsed && itemSize != oldItemSize) {
outdated = true;
}
}

View file

@ -202,8 +202,11 @@ public class IndexItem implements Comparable<IndexItem> {
public void setLocalTimestamp(long localTimestamp) {
this.localTimestamp = localTimestamp;
}
public long getLocalTimestamp() {
return localTimestamp;
}
public boolean isDownloaded() {
return downloaded;
}