From 5fda6db8aac2a08d8a6eb853b5895f366a0300e5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 27 Oct 2012 22:20:15 +0200 Subject: [PATCH] Fix date edition --- .../src/net/osmand/binary/CachedOsmandIndexes.java | 5 +++-- .../src/net/osmand/plus/activities/LocalIndexHelper.java | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/binary/CachedOsmandIndexes.java b/DataExtractionOSM/src/net/osmand/binary/CachedOsmandIndexes.java index 4d7df93adc..cb5d777658 100644 --- a/DataExtractionOSM/src/net/osmand/binary/CachedOsmandIndexes.java +++ b/DataExtractionOSM/src/net/osmand/binary/CachedOsmandIndexes.java @@ -53,7 +53,8 @@ public class CachedOsmandIndexes { } 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 class CachedOsmandIndexes { 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(); diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java index 65d8335b9e..49c2736e96 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java @@ -58,14 +58,17 @@ public class LocalIndexHelper { } 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 @@ public class LocalIndexHelper { append(mi.getName()).append("\n"); } } + builder.append(getInstalledDate(reader.getDateCreated())); info.setDescription(builder.toString()); reader.close(); } catch (IOException e) {