/[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 1007 by torben, Mon Aug 2 23:18:53 2010 UTC revision 1008 by torben, Tue Aug 3 06:36:29 2010 UTC
# Line 123  public class StationList extends ListAct Line 123  public class StationList extends ListAct
123                                  startLookup();                                  startLookup();
124                                  break;                                  break;
125                          case ListSearch:                                                          case ListSearch:                                
126                                  showDialog(DLG_STATIONNAME); //TODO: this.showDialogSafe(DLG_STATIONNAME);                                  showDialog(DLG_STATIONNAME);
127                                  break;                                  break;
128                          case ListFavorites:                          case ListFavorites:
129                                  startFavoriteLookup();                                  startFavoriteLookup();
# Line 175  public class StationList extends ListAct Line 175  public class StationList extends ListAct
175                                    
176          }          }
177                    
           
         /* these 3 dialogs helper functions are very rude and ugly hack  
          * to remove these auto-reported exceptions  
          * - android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@436aaef8 is not valid; is your activity running?  
          * - java.lang.IllegalArgumentException: View not attached to window manager  
          */  
   
         /*  
         public void showDialogSafe(int id) {  
                 try {  
                         showDialog(id);  
                 } catch (Exception e) {  
                         Log.e("StationList", "showDialog failed", e);  
                 }  
         }  
           
         public void dismissDialogSafe(int id) {  
                 try {  
                         dismissDialog(id);  
                 } catch (Exception e) {  
                         Log.e("StationList", "dismissDialog failed", e);  
                 }  
         }  
         public void dismissDialogSafe(Dialog dlg) {  
                 try {  
                         dlg.dismiss();  
                 } catch (Exception e) {  
                         Log.e("StationList", "dismissDialog failed", e);  
                 }  
         }  
           
         public void builderShowSafe(AlertDialog.Builder builder) {  
                 try {  
                         builder.show();  
                 } catch (Exception e) {  
                         Log.e("StationList", "builder.show() failed", e);  
                 }  
178                                    
         }*/  
           
         /* EOF rude and ugly dialog hack */  
           
   
179    
180      @Override      @Override
181      public void onSaveInstanceState(Bundle outState)      public void onSaveInstanceState(Bundle outState)
# Line 394  public class StationList extends ListAct Line 352  public class StationList extends ListAct
352          public void startLookup() {          public void startLookup() {
353                  isRunning = true;                                isRunning = true;              
354                  dialogMessage = getString( stationlist_waitforlocation );                  dialogMessage = getString( stationlist_waitforlocation );
355                  showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);
356                                    
357                  locationLookup.locateStations();                  locationLookup.locateStations();
358                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS);                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS);
# Line 402  public class StationList extends ListAct Line 360  public class StationList extends ListAct
360                    
361          void startNameSearch(String name) {          void startNameSearch(String name) {
362                  dialogMessage = getString( stationlist_findbyname );                  dialogMessage = getString( stationlist_findbyname );
363                  showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);
364    
365                  findStationsTask = new FindStationsTask();                  findStationsTask = new FindStationsTask();
366                  findStationsTask.searchByName(name);                  findStationsTask.searchByName(name);
# Line 414  public class StationList extends ListAct Line 372  public class StationList extends ListAct
372                                    
373                  if (favorites.size() > 0) {                  if (favorites.size() > 0) {
374                          dialogMessage = getString( stationlist_loadfavorites );                          dialogMessage = getString( stationlist_loadfavorites );
375                          showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);                          showDialog(DLG_PROGRESS);
376    
377                          findStationsTask = new FindStationsTask();                          findStationsTask = new FindStationsTask();
378                          findStationsTask.searchByIds( favorites.toString() );                          findStationsTask.searchByIds( favorites.toString() );
# Line 429  public class StationList extends ListAct Line 387  public class StationList extends ListAct
387          void startLocatorTask()          void startLocatorTask()
388          {          {
389                  dialogMessage = getString( stationlist_findingnearby );                  dialogMessage = getString( stationlist_findingnearby );
390                  showDialog(DLG_PROGRESS);//TODO:showDialogSafe(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);
391                                    
392                  findStationsTask = new FindStationsTask();                  findStationsTask = new FindStationsTask();
393                  findStationsTask.searchByLocation( locationLookup.getLocation() );                  findStationsTask.searchByLocation( locationLookup.getLocation() );
# Line 446  public class StationList extends ListAct Line 404  public class StationList extends ListAct
404    
405                          switch (msg.what) {                          switch (msg.what) {
406                          case GOTLOCATION:                          case GOTLOCATION:
407                                  dismissDialog(DLG_PROGRESS);//TODO:dismissDialogSafe(DLG_PROGRESS);                                  dismissDialog(DLG_PROGRESS);
408                                                                    
409                                  startLocatorTask();                                  startLocatorTask();
410                                  location = GeoPair.fromLocation( locationLookup.getLocation() );                                  location = GeoPair.fromLocation( locationLookup.getLocation() );
# Line 454  public class StationList extends ListAct Line 412  public class StationList extends ListAct
412                                  break;                                  break;
413    
414                          case NOPROVIDER:                          case NOPROVIDER:
415                                  dismissDialog(DLG_PROGRESS);//TODO:dismissDialogSafe(DLG_PROGRESS);                                  dismissDialog(DLG_PROGRESS);
416                                  MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true );                                  MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true );
417                                  //StationList.this.finish();                                  //StationList.this.finish();
418                                  break;                                  break;
# Line 464  public class StationList extends ListAct Line 422  public class StationList extends ListAct
422                                          if (locationLookup.hasLocation()) {                                          if (locationLookup.hasLocation()) {
423                                                  stationsFetched.sendEmptyMessage( GOTLOCATION );                                                  stationsFetched.sendEmptyMessage( GOTLOCATION );
424                                          } else {                                                                                          } else {                                                
425                                                  dismissDialog(DLG_PROGRESS);//TODO:dismissDialogSafe(DLG_PROGRESS);                                                  dismissDialog(DLG_PROGRESS);
426                                                                                                    
427                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                
428                                                  builder.setMessage(  getString( stationlist_gpstimeout) );                                                  builder.setMessage(  getString( stationlist_gpstimeout) );
# Line 481  public class StationList extends ListAct Line 439  public class StationList extends ListAct
439                                                                  dialog.dismiss();                                                                  dialog.dismiss();
440                                                          }                                                                                                                }                                                      
441                                                  });                                                  });
442                                                  builder.show();//TODO:builderShowSafe(builder);                                                  builder.show();
443    
444                                          }                                          }
445                                  }                                  }
# Line 548  public class StationList extends ListAct Line 506  public class StationList extends ListAct
506                  @Override                  @Override
507                  protected void onPostExecute(Void result) {                  protected void onPostExecute(Void result) {
508                          super.onPostExecute(result);                          super.onPostExecute(result);
509                          dialog.dismiss();//TODO:dismissDialogSafe(dialog);                          dialog.dismiss();
510                                                    
511                                                    
512                          if (stations != null) {                                                  if (stations != null) {                        
# Line 606  public class StationList extends ListAct Line 564  public class StationList extends ListAct
564                                          }                                                                                                }                                                      
565                                  });                                  });
566                                                                    
567                                  builder.show();//TODO:builderShowSafe(builder);                                  builder.show();
568                          }                          }
569                  }                  }
570          }          }

Legend:
Removed from v.1007  
changed lines
  Added in v.1008

  ViewVC Help
Powered by ViewVC 1.1.20