Fix date edition

This commit is contained in:
Victor Shcherb 2012-10-27 22:20:15 +02:00
parent 0752a36dfa
commit 5fda6db8aa
2 changed files with 9 additions and 4 deletions

View file

@ -53,7 +53,8 @@ public class CachedOsmandIndexes {
} }
FileIndex.Builder fileIndex = OsmandIndex.FileIndex.newBuilder(); 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.setSize(f.length());
fileIndex.setVersion(reader.getVersion()); fileIndex.setVersion(reader.getVersion());
fileIndex.setFileName(f.getName()); fileIndex.setFileName(f.getName());
@ -187,7 +188,7 @@ public class CachedOsmandIndexes {
private BinaryMapIndexReader initFileIndex(FileIndex found, RandomAccessFile mf) throws IOException { private BinaryMapIndexReader initFileIndex(FileIndex found, RandomAccessFile mf) throws IOException {
BinaryMapIndexReader reader = new BinaryMapIndexReader(mf, false); BinaryMapIndexReader reader = new BinaryMapIndexReader(mf, false);
reader.version = found.getVersion(); reader.version = found.getVersion();
reader.dateCreated =found.getDateModified(); reader.dateCreated = found.getDateModified();
for(MapPart index : found.getMapIndexList()) { for(MapPart index : found.getMapIndexList()) {
MapIndex mi = new MapIndex(); MapIndex mi = new MapIndex();

View file

@ -58,14 +58,17 @@ public class LocalIndexHelper {
} }
public String getInstalledDate(File f){ 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){ public void updateDescription(LocalIndexInfo info){
File f = new File(info.getPathToData()); File f = new File(info.getPathToData());
if(info.getType() == LocalIndexType.MAP_DATA){ if(info.getType() == LocalIndexType.MAP_DATA){
updateObfFileInformation(info, f); updateObfFileInformation(info, f);
info.setDescription(info.getDescription() + getInstalledDate(f));
} else if(info.getType() == LocalIndexType.POI_DATA){ } else if(info.getType() == LocalIndexType.POI_DATA){
checkPoiFileVersion(info, f); checkPoiFileVersion(info, f);
info.setDescription(getInstalledDate(f)); info.setDescription(getInstalledDate(f));
@ -397,6 +400,7 @@ public class LocalIndexHelper {
append(mi.getName()).append("\n"); append(mi.getName()).append("\n");
} }
} }
builder.append(getInstalledDate(reader.getDateCreated()));
info.setDescription(builder.toString()); info.setDescription(builder.toString());
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {