--- android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2009/10/11 07:07:29 439 +++ android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2009/10/11 07:18:56 440 @@ -55,11 +55,18 @@ public static final int DLG_PROGRESS = 3001; public static final int DLG_STATIONNAME = 3002; - /** Called when the activity is first created. */ + static enum LookupMethod { + ByLocation, + ByName, + ByList, + MethodNone + } + + String dialogMessage = ""; ProgressDialog dialog; LocationLookup locator = null; - LocatorTask locatorTask; + FindStationsTask findStationsTask; StationsFetchedHandler stationsFetched = new StationsFetchedHandler(); GeoPair location = new GeoPair(); @@ -74,12 +81,7 @@ FavoritesMenu contextMenu = new FavoritesMenu(); IntSet favorites = new IntSet(); - static enum LookupMethod { - ByLocation, - ByName, - ByList, - MethodNone - } + SharedPreferences prefs; @@ -307,21 +309,21 @@ dialogMessage = "Finding stations by name"; showDialog(DLG_PROGRESS); - locatorTask = new LocatorTask(); - locatorTask.searchByName(name, locator.getLocation()); - locatorTask.execute(); + findStationsTask = new FindStationsTask(); + findStationsTask.searchByName(name, locator.getLocation()); + findStationsTask.execute(); } public void startFavoriteLookup() { - if (favorites.toString().length() > 0) { + if (favorites.size() > 0) { dialogMessage = "Loading favorites"; showDialog(DLG_PROGRESS); - locatorTask = new LocatorTask(); - locatorTask.searchByIds(favorites.toString(), locator.getLocation()); - locatorTask.execute(); + findStationsTask = new FindStationsTask(); + findStationsTask.searchByIds(favorites.toString(), locator.getLocation()); + findStationsTask.execute(); } else { MessageBox.showMessage(this, "Favorite list is empty"); } @@ -334,9 +336,9 @@ dialogMessage = "Finding nearby stations"; showDialog(DLG_PROGRESS); - locatorTask = new LocatorTask(); - locatorTask.searchByLocation( locator.getLocation() ); - locatorTask.execute(); + findStationsTask = new FindStationsTask(); + findStationsTask.searchByLocation( locator.getLocation() ); + findStationsTask.execute(); } @@ -421,7 +423,7 @@ }; - class LocatorTask extends AsyncTask { + class FindStationsTask extends AsyncTask { LookupMethod method = LookupMethod.MethodNone; boolean success;