86 |
|
|
87 |
byte data[] = HttpUtil.getContent(XmlUtil.SERVICE_BASE + "/LocateStations?dump=1", 5000); |
byte data[] = HttpUtil.getContent(XmlUtil.SERVICE_BASE + "/LocateStations?dump=1", 5000); |
88 |
Serializer serializer = new Persister(); |
Serializer serializer = new Persister(); |
89 |
stations = serializer.read(StationBean.class, new String(data, "ISO-8859-1") ); |
StationBean tmpStations = serializer.read(StationBean.class, new String(data, "ISO-8859-1") ); |
90 |
|
|
91 |
|
|
92 |
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream(stationsFile) ); |
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream(stationsFile) ); |
93 |
Log.e("OFFLINE", "data size" + data.length); |
Log.e("OFFLINE", "data size" + data.length); |
94 |
|
|
95 |
out.writeInt( stations.entries.size() ); //start with writing the length of the dataset |
out.writeInt( tmpStations.entries.size() ); //start with writing the length of the dataset |
96 |
|
|
97 |
for (StationEntry entry : stations.entries) { |
for (StationEntry entry : tmpStations.entries) { |
98 |
updateSearchStrings( entry ); //prepare name fields for byName search |
updateSearchStrings( entry ); //prepare name fields for byName search |
99 |
out.writeObject(entry); |
out.writeObject(entry); |
100 |
} |
} |
101 |
|
|
102 |
out.close(); |
out.close(); |
103 |
|
|
104 |
|
stations = tmpStations; // når alt er ok skifter vi over til ny udgave |
105 |
} |
} |
106 |
|
|
107 |
|
|
156 |
Collections.sort( entries, distanceComparator); |
Collections.sort( entries, distanceComparator); |
157 |
|
|
158 |
StationBean tmpStations = new StationBean(); |
StationBean tmpStations = new StationBean(); |
159 |
for (int i = 0; i<8; i++) { |
for (int i = 0; i<8 && i<entries.size(); i++) { |
160 |
tmpStations.entries.add( entries.get(i) ); |
tmpStations.entries.add( entries.get(i) ); |
161 |
} |
} |
162 |
|
|