/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/StationList.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/StationList.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 844 by torben, Sun Jun 13 14:52:49 2010 UTC revision 948 by torben, Fri Jul 2 14:58:44 2010 UTC
# Line 48  public class StationList extends ListAct Line 48  public class StationList extends ListAct
48                    
49          public static final int OPTIONS_MAP = 2003;          public static final int OPTIONS_MAP = 2003;
50          public static final int OPTIONS_GPSINFO = 2004;          public static final int OPTIONS_GPSINFO = 2004;
   
           
   
51                    
52          public static final int DLG_PROGRESS = 3001;          public static final int DLG_PROGRESS = 3001;
53          public static final int DLG_STATIONNAME = 3002;          public static final int DLG_STATIONNAME = 3002;
54                    
55            
56            public static final int GPS_TIMEOUT_MS = 17500; //how long are we willing to wait for gps fix -in milliseconds
57            
58            
59          static enum LookupMethod {          static enum LookupMethod {
60                  ByLocation,                  ByLocation,
61                  ByName,                  ByName,
# Line 139  public class StationList extends ListAct Line 140  public class StationList extends ListAct
140                  }                  }
141                                    
142          }          }
143            
144    
145            @Override
146            protected void onDestroy() {
147                    super.onDestroy();
148                    
149                    if (findStationsTask != null) {
150                            findStationsTask.cancel(true);
151                    }
152                    if (locationLookup != null) {
153                            locationLookup.stopSearch();
154                    }
155                    isRunning = false;
156            }
157    
158            
159          protected void setTitle() {          protected void setTitle() {
160                  String dialogTitle = getResources().getString(app_name);                  String dialogTitle = getResources().getString(app_name);
161                  switch (listType) {                  switch (listType) {
# Line 258  public class StationList extends ListAct Line 275  public class StationList extends ListAct
275                                  message.append( getString(stationlist_nolocation) );                                  message.append( getString(stationlist_nolocation) );
276                          }                                                }                      
277                                                    
278                          MessageBox.showMessage(this, message.toString());                          MessageBox.showMessage(this, message.toString(), false);
279                          break;                          break;
280                  default:                  default:
281                          retval = super.onOptionsItemSelected(item);                          retval = super.onOptionsItemSelected(item);
# Line 379  public class StationList extends ListAct Line 396  public class StationList extends ListAct
396                  showDialogSafe(DLG_PROGRESS);                  showDialogSafe(DLG_PROGRESS);
397                                    
398                  locationLookup.locateStations();                  locationLookup.locateStations();
399                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, 20000);                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS);
400          }          }
401                    
402          void startNameSearch(String name) {          void startNameSearch(String name) {
# Line 437  public class StationList extends ListAct Line 454  public class StationList extends ListAct
454    
455                          case NOPROVIDER:                          case NOPROVIDER:
456                                  dismissDialogSafe(DLG_PROGRESS);                                  dismissDialogSafe(DLG_PROGRESS);
457                                  MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider) );                                  MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true );
458                                    //StationList.this.finish();
459                                  break;                                  break;
460                          case LOCATIONFIXTIMEOUT:                                                          case LOCATIONFIXTIMEOUT:                                
461                                  if (isRunning) {                                  if (isRunning) {
# Line 538  public class StationList extends ListAct Line 556  public class StationList extends ListAct
556                                          showMessageAndClose(getString(stationlist_nostations));                                          showMessageAndClose(getString(stationlist_nostations));
557                                  }                                  }
558                                  stations = stationProvider.getStations();                                  stations = stationProvider.getStations();
559    
560                                    StationList.this.getListView().invalidateViews();
561                                  adapter.setStations( stations );                                                                  adapter.setStations( stations );                                
562                                                                    
563                                    
564                          } else { //communication or parse errors                          } else { //communication or parse errors
565                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                
566                                  builder.setMessage(getString(stationlist_fetcherror));                                                            builder.setMessage(getString(stationlist_fetcherror));                          

Legend:
Removed from v.844  
changed lines
  Added in v.948

  ViewVC Help
Powered by ViewVC 1.1.20