334 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
335 |
|
|
336 |
findStationsTask = new FindStationsTask(); |
findStationsTask = new FindStationsTask(); |
337 |
findStationsTask.searchByName(name, locationLookup.getLocation()); |
findStationsTask.searchByName(name); |
338 |
findStationsTask.execute(); |
findStationsTask.execute(); |
339 |
|
|
340 |
} |
} |
346 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
347 |
|
|
348 |
findStationsTask = new FindStationsTask(); |
findStationsTask = new FindStationsTask(); |
349 |
findStationsTask.searchByIds(favorites.toString(), locationLookup.getLocation()); |
findStationsTask.searchByIds( favorites.toString() ); |
350 |
findStationsTask.execute(); |
findStationsTask.execute(); |
351 |
} else { |
} else { |
352 |
showMessageAndClose( getString( stationlist_nofavorites ) ); |
showMessageAndClose( getString( stationlist_nofavorites ) ); |
428 |
Location loc; |
Location loc; |
429 |
String ids; |
String ids; |
430 |
|
|
431 |
public void searchByName(String n, Location l) { |
public void searchByName(String n) { |
432 |
|
|
433 |
method = LookupMethod.ByName; |
method = LookupMethod.ByName; |
|
loc = l; |
|
434 |
name = n; |
name = n; |
435 |
} |
} |
436 |
|
|
439 |
loc = l; |
loc = l; |
440 |
} |
} |
441 |
|
|
442 |
public void searchByIds(String id, Location l) { |
public void searchByIds(String id) { |
443 |
|
|
444 |
method = LookupMethod.ByList; |
method = LookupMethod.ByList; |
|
loc = l; |
|
445 |
ids = id; |
ids = id; |
446 |
} |
} |
447 |
|
|
471 |
} |
} |
472 |
|
|
473 |
|
|
|
Location dummy = new Location("gps"); |
|
|
List<StationBean> stations = stationProvider.getStations(); |
|
|
|
|
|
for (StationBean station : stations) { |
|
|
|
|
|
if (method.equals(LookupMethod.ByName) || method.equals(LookupMethod.ByList)) { |
|
|
if (loc != null) { //only do the distance calc if we have a location |
|
|
dummy.setLatitude(station.getLatitude()); |
|
|
dummy.setLongitude(station.getLongitude()); |
|
|
station.setDistance( (int)loc.distanceTo(dummy) ); |
|
|
} else { |
|
|
station.setDistance(0); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
474 |
return null; |
return null; |
475 |
} |
} |
476 |
|
|