/[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 982 by torben, Fri Jul 2 14:58:44 2010 UTC revision 983 by torben, Sun Jul 11 15:15:04 2010 UTC
# Line 123  public class StationList extends ListAct Line 123  public class StationList extends ListAct
123                          case ListNearest:                          case ListNearest:
124                                  startLookup();                                  startLookup();
125                                  break;                                  break;
126                          case ListSearch:                          case ListSearch:                                
127                                  this.showDialogSafe(DLG_STATIONNAME);                                  showDialog(DLG_STATIONNAME); //TODO: this.showDialogSafe(DLG_STATIONNAME);
128                                  break;                                  break;
129                          case ListFavorites:                          case ListFavorites:
130                                  startFavoriteLookup();                                  startFavoriteLookup();
# Line 182  public class StationList extends ListAct Line 182  public class StationList extends ListAct
182           * - android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@436aaef8 is not valid; is your activity running?           * - android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@436aaef8 is not valid; is your activity running?
183           * - java.lang.IllegalArgumentException: View not attached to window manager           * - java.lang.IllegalArgumentException: View not attached to window manager
184           */           */
185            
186            /*
187          public void showDialogSafe(int id) {          public void showDialogSafe(int id) {
188                  try {                  try {
189                          showDialog(id);                          showDialog(id);
# Line 213  public class StationList extends ListAct Line 214  public class StationList extends ListAct
214                          Log.e("StationList", "builder.show() failed", e);                          Log.e("StationList", "builder.show() failed", e);
215                  }                  }
216                                    
217          }          }*/
218            
219          /* EOF rude and ugly dialog hack */          /* EOF rude and ugly dialog hack */
220                    
221    
# Line 393  public class StationList extends ListAct Line 395  public class StationList extends ListAct
395          public void startLookup() {          public void startLookup() {
396                  isRunning = true;                                isRunning = true;              
397                  dialogMessage = getString( stationlist_waitforlocation );                  dialogMessage = getString( stationlist_waitforlocation );
398                  showDialogSafe(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);
399                                    
400                  locationLookup.locateStations();                  locationLookup.locateStations();
401                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS);                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS);
# Line 401  public class StationList extends ListAct Line 403  public class StationList extends ListAct
403                    
404          void startNameSearch(String name) {          void startNameSearch(String name) {
405                  dialogMessage = getString( stationlist_findbyname );                  dialogMessage = getString( stationlist_findbyname );
406                  showDialogSafe(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);
407    
408                  findStationsTask = new FindStationsTask();                  findStationsTask = new FindStationsTask();
409                  findStationsTask.searchByName(name);                  findStationsTask.searchByName(name);
# Line 413  public class StationList extends ListAct Line 415  public class StationList extends ListAct
415                                    
416                  if (favorites.size() > 0) {                  if (favorites.size() > 0) {
417                          dialogMessage = getString( stationlist_loadfavorites );                          dialogMessage = getString( stationlist_loadfavorites );
418                          showDialogSafe(DLG_PROGRESS);                          showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);
419    
420                          findStationsTask = new FindStationsTask();                          findStationsTask = new FindStationsTask();
421                          findStationsTask.searchByIds( favorites.toString() );                          findStationsTask.searchByIds( favorites.toString() );
# Line 428  public class StationList extends ListAct Line 430  public class StationList extends ListAct
430          void startLocatorTask()          void startLocatorTask()
431          {          {
432                  dialogMessage = getString( stationlist_findingnearby );                  dialogMessage = getString( stationlist_findingnearby );
433                  showDialogSafe(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);
434                                    
435                  findStationsTask = new FindStationsTask();                  findStationsTask = new FindStationsTask();
436                  findStationsTask.searchByLocation( locationLookup.getLocation() );                  findStationsTask.searchByLocation( locationLookup.getLocation() );
# Line 445  public class StationList extends ListAct Line 447  public class StationList extends ListAct
447    
448                          switch (msg.what) {                          switch (msg.what) {
449                          case GOTLOCATION:                          case GOTLOCATION:
450                                  dismissDialogSafe(DLG_PROGRESS);                                  dismissDialog(DLG_PROGRESS);//TODO:dismissDialogSafe(DLG_PROGRESS);
451                                                                    
452                                  startLocatorTask();                                  startLocatorTask();
453                                  location = GeoPair.fromLocation( locationLookup.getLocation() );                                  location = GeoPair.fromLocation( locationLookup.getLocation() );
# Line 453  public class StationList extends ListAct Line 455  public class StationList extends ListAct
455                                  break;                                  break;
456    
457                          case NOPROVIDER:                          case NOPROVIDER:
458                                  dismissDialogSafe(DLG_PROGRESS);                                  dismissDialog(DLG_PROGRESS);//TODO:dismissDialogSafe(DLG_PROGRESS);
459                                  MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true );                                  MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true );
460                                  //StationList.this.finish();                                  //StationList.this.finish();
461                                  break;                                  break;
# Line 463  public class StationList extends ListAct Line 465  public class StationList extends ListAct
465                                          if (locationLookup.hasLocation()) {                                          if (locationLookup.hasLocation()) {
466                                                  stationsFetched.sendEmptyMessage( GOTLOCATION );                                                  stationsFetched.sendEmptyMessage( GOTLOCATION );
467                                          } else {                                                                                          } else {                                                
468                                                  dismissDialogSafe(DLG_PROGRESS);                                                  dismissDialog(DLG_PROGRESS);//TODO:dismissDialogSafe(DLG_PROGRESS);
469                                                                                                    
470                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                
471                                                  builder.setMessage(  getString( stationlist_gpstimeout) );                                                  builder.setMessage(  getString( stationlist_gpstimeout) );
# Line 480  public class StationList extends ListAct Line 482  public class StationList extends ListAct
482                                                                  dialog.dismiss();                                                                  dialog.dismiss();
483                                                          }                                                                                                                }                                                      
484                                                  });                                                  });
485                                                  builderShowSafe(builder); // builder.show()                                                  builder.show();//TODO:builderShowSafe(builder);
486    
487                                          }                                          }
488                                  }                                  }
# Line 548  public class StationList extends ListAct Line 550  public class StationList extends ListAct
550                  @Override                  @Override
551                  protected void onPostExecute(Void result) {                  protected void onPostExecute(Void result) {
552                          super.onPostExecute(result);                          super.onPostExecute(result);
553                          dismissDialogSafe(dialog);                          dialog.dismiss();//TODO:dismissDialogSafe(dialog);
554                                                    
555                                                    
556                          if (success) {                                                    if (success) {                          
# Line 607  public class StationList extends ListAct Line 609  public class StationList extends ListAct
609                                          }                                                                                                }                                                      
610                                  });                                  });
611                                                                    
612                                  builderShowSafe(builder); // builder.show()                                  builder.show();//TODO:builderShowSafe(builder);
613                          }                          }
614                  }                  }
615          }          }

Legend:
Removed from v.982  
changed lines
  Added in v.983

  ViewVC Help
Powered by ViewVC 1.1.20