57 |
StationEntry e = null; |
StationEntry e = null; |
58 |
while ( (o=in.readObject()) != null ) { |
while ( (o=in.readObject()) != null ) { |
59 |
e = (StationEntry) o; |
e = (StationEntry) o; |
60 |
e.updateSearch(); |
updateSearchStrings(e); |
61 |
stations.entries.add( e ); |
stations.entries.add( e ); |
62 |
} |
} |
63 |
in.close(); |
in.close(); |
69 |
logElapsedTime(start, "loadStations"); |
logElapsedTime(start, "loadStations"); |
70 |
|
|
71 |
return true; |
return true; |
72 |
} |
} |
73 |
|
|
74 |
|
public void updateSearchStrings(StationEntry entry) { |
75 |
|
entry.nameLower = entry.getName().toLowerCase(); |
76 |
|
entry.nameInternational = entry.nameLower.replace("æ", "ae").replace("ø", "oe").replace("å", "aa"); |
77 |
|
} |
78 |
|
|
79 |
public void downloadStations(Context context) throws Exception { |
public void downloadStations(Context context) throws Exception { |
80 |
File parent = context.getFilesDir(); |
File parent = context.getFilesDir(); |
90 |
Log.e("OFFLINE", "data size" + data.length); |
Log.e("OFFLINE", "data size" + data.length); |
91 |
|
|
92 |
for (StationEntry entry : stations.entries) { |
for (StationEntry entry : stations.entries) { |
93 |
entry.updateSearch(); //prepare name fields for byName search |
updateSearchStrings( entry ); //prepare name fields for byName search |
94 |
out.writeObject(entry); |
out.writeObject(entry); |
95 |
} |
} |
96 |
|
|