--- android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/01/28 09:16:33 564
+++ android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/02/02 08:52:45 579
@@ -334,7 +334,7 @@
showDialog(DLG_PROGRESS);
findStationsTask = new FindStationsTask();
- findStationsTask.searchByName(name, locationLookup.getLocation());
+ findStationsTask.searchByName(name);
findStationsTask.execute();
}
@@ -346,7 +346,7 @@
showDialog(DLG_PROGRESS);
findStationsTask = new FindStationsTask();
- findStationsTask.searchByIds(favorites.toString(), locationLookup.getLocation());
+ findStationsTask.searchByIds( favorites.toString() );
findStationsTask.execute();
} else {
showMessageAndClose( getString( stationlist_nofavorites ) );
@@ -364,35 +364,7 @@
findStationsTask.searchByLocation( locationLookup.getLocation() );
findStationsTask.execute();
}
-
-
- /* TODO: Remove this no longer needed function
- String lookupAddress(double latitude, double longitude) {
-
- Geocoder coder = new Geocoder(this, new Locale("da"));
- StringBuilder sb = new StringBuilder();
- Log.i("lookupaddr", "" + latitude + "/" + longitude);
- try {
- List
addressList = coder.getFromLocation(latitude, longitude, 1);
- Address addr = addressList.get(0);
-
-
- int max = addr.getMaxAddressLineIndex();
- for (int i=0; i0)
- sb.append(", ");
-
- sb.append(addr.getAddressLine(i));
- }
-
-
- } catch (Exception e) {
- Log.e("DepartureList", "geocoder failed", e);
- }
- return sb.toString();
- }*/
-
////////////////////////////////////////////////////////////////////////////
// Inner classes
@@ -456,10 +428,9 @@
Location loc;
String ids;
- public void searchByName(String n, Location l) {
+ public void searchByName(String n) {
method = LookupMethod.ByName;
- loc = l;
name = n;
}
@@ -468,10 +439,9 @@
loc = l;
}
- public void searchByIds(String id, Location l) {
+ public void searchByIds(String id) {
method = LookupMethod.ByList;
- loc = l;
ids = id;
}
@@ -501,23 +471,6 @@
}
- Location dummy = new Location("gps");
- List 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);
- }
- }
-
- }
-
return null;
}
@@ -528,8 +481,9 @@
if (success) {
- if (stationProvider.getStations().size() == 0)
- MessageBox.showMessage(StationList.this, getString(stationlist_nostations) ); // this should not be possible !?!
+ if (stationProvider.getStations().size() == 0) {
+ showMessageAndClose(getString(stationlist_nostations));
+ }
stations = stationProvider.getStations();
adapter.setStations( stations );