Skip to content
Permalink
Browse files
Fix date edition
  • Loading branch information
vshcherb committed Oct 27, 2012
1 parent 0752a36 commit 5fda6db8aac2a08d8a6eb853b5895f366a0300e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
@@ -53,7 +53,8 @@ public void addToCache(BinaryMapIndexReader reader, File f) {
}

FileIndex.Builder fileIndex = OsmandIndex.FileIndex.newBuilder();
fileIndex.setDateModified(f.lastModified());
long d = reader.getDateCreated();
fileIndex.setDateModified(d== 0?f.lastModified() : d);
fileIndex.setSize(f.length());
fileIndex.setVersion(reader.getVersion());
fileIndex.setFileName(f.getName());
@@ -187,7 +188,7 @@ public BinaryMapIndexReader getReader(File f) throws IOException {
private BinaryMapIndexReader initFileIndex(FileIndex found, RandomAccessFile mf) throws IOException {
BinaryMapIndexReader reader = new BinaryMapIndexReader(mf, false);
reader.version = found.getVersion();
reader.dateCreated =found.getDateModified();
reader.dateCreated = found.getDateModified();

for(MapPart index : found.getMapIndexList()) {
MapIndex mi = new MapIndex();
@@ -58,14 +58,17 @@ public List<LocalIndexInfo> getAllLocalIndexData(LoadLocalIndexTask loadTask){
}

public String getInstalledDate(File f){
return app.getString(R.string.local_index_installed) + " : " + dateformat.format(new Object[]{new Date(f.lastModified())});
return getInstalledDate(f.lastModified());
}

public String getInstalledDate(long t){
return app.getString(R.string.local_index_installed) + " : " + dateformat.format(new Object[]{new Date(t)});
}

public void updateDescription(LocalIndexInfo info){
File f = new File(info.getPathToData());
if(info.getType() == LocalIndexType.MAP_DATA){
updateObfFileInformation(info, f);
info.setDescription(info.getDescription() + getInstalledDate(f));
} else if(info.getType() == LocalIndexType.POI_DATA){
checkPoiFileVersion(info, f);
info.setDescription(getInstalledDate(f));
@@ -397,6 +400,7 @@ private void updateObfFileInformation(LocalIndexInfo info, File mapFile) {
append(mi.getName()).append("\n");
}
}
builder.append(getInstalledDate(reader.getDateCreated()));
info.setDescription(builder.toString());
reader.close();
} catch (IOException e) {

0 comments on commit 5fda6db

Please sign in to comment.