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

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

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

revision 1250 by torben, Thu Mar 31 18:20:42 2011 UTC revision 1263 by torben, Tue Apr 5 05:46:55 2011 UTC
# Line 429  public class DepartureList extends ListA Line 429  public class DepartureList extends ListA
429                                                    
430                                                    
431                          pgDialog.dismiss();                          pgDialog.dismiss();
432                                                    //TODO: differentiate whether it was a communication error with my backend
433                            //or that the backend failed because bane.dk was unavailable
434                          if (departures != null) {                          if (departures != null) {
435                                  commFailCounter = 0;                                  commFailCounter = 0;
436                                  DepartureList.this.getListView().setVisibility(View.GONE); //Experimental, inspired by http://osdir.com/ml/Android-Developers/2010-04/msg01198.html                                  DepartureList.this.getListView().setVisibility(View.GONE); //Experimental, inspired by http://osdir.com/ml/Android-Developers/2010-04/msg01198.html
# Line 437  public class DepartureList extends ListA Line 438  public class DepartureList extends ListA
438                                  DepartureList.this.getListView().setVisibility(View.VISIBLE);                                  DepartureList.this.getListView().setVisibility(View.VISIBLE);
439                                                                    
440                                                                    
441                                    // handle notification icon.                                                            
442                                  if ( hasNotifications() ) {                                  if ( hasNotifications() ) {
443                                          findViewById(R.id.notifIcon).setVisibility(View.VISIBLE);                                          View notifIcon = findViewById(R.id.notifIcon);
444                                  }                                          notifIcon.setVisibility(View.VISIBLE);
445                                            notifIcon.setClickable(true);
446                                            notifIcon.setOnClickListener( new View.OnClickListener() {                                              
447                                                    @Override
448                                                    public void onClick(View v) {
449                                                            Intent i = new Intent(DepartureList.this, dk.thoerup.traininfo.NotificationList.class);
450                                                            i.putExtra(NotificationList.EXTRA_NOTIFICATIONS, departures.notifications);
451                                                            startActivity(i);                                                      
452                                                    }
453                                            });
454                                    }                              
455                                                                    
456                                  if (departures.entries.size() == 0) {                                  if (departures.entries.size() != 0) {
457                                          MessageBox.showMessage(DepartureList.this, "No departures found", true);                                          int msgId = (arrival==false) ? R.string.departurelist_nodepartures : R.string.departurelist_noarrivals;
458                                            MessageBox.showMessage(DepartureList.this, getString(msgId), false);
459                                  }                                  }
460                          } else { // communication or parse error                          } else { // communication or parse error
461                                  commFailCounter++;                                  commFailCounter++;
# Line 465  public class DepartureList extends ListA Line 478  public class DepartureList extends ListA
478                                          }                                                                                                }                                                      
479                                  });                                  });
480                                                                    
481                                  try {                                  try { //TODO: is this still necessary after the 0.9.4.1 fix ?
482                                          builder.show();                                          builder.show();
483                                  } catch (android.view.WindowManager.BadTokenException e) {                                                                        } catch (android.view.WindowManager.BadTokenException e) {                                      
484                                          Log.i("DepartureList", "BadTokenException"); // this can happen if the user switched away from this activity, while doInBackground was running                                          Log.i("DepartureList", "BadTokenException"); // this can happen if the user switched away from this activity, while doInBackground was running
# Line 571  public class DepartureList extends ListA Line 584  public class DepartureList extends ListA
584                                  builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() {                                  builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() {
585                                          public void onClick(DialogInterface dialog, int id) {                                          public void onClick(DialogInterface dialog, int id) {
586                                                  dialog.dismiss();                                                  dialog.dismiss();
587                                                  DepartureList.this.finish();                                                  DepartureList.this.finish(); //TODO: should we really close the activity ??
588                                          }                                                                                                }                                                      
589                                  });                                  });
590                                                                    
591                                  try {                                  try { //TODO: is this still necessary after the 0.9.4.1 fix ?
592                                          builder.show();                                          builder.show();
593                                  } catch (android.view.WindowManager.BadTokenException e) {                                                                        } catch (android.view.WindowManager.BadTokenException e) {                                      
594                                          Log.i("DepartureList", "BadTokenException"); // this can happen if the user switched away from this activity, while doInBackground was running                                          Log.i("DepartureList", "BadTokenException"); // this can happen if the user switched away from this activity, while doInBackground was running

Legend:
Removed from v.1250  
changed lines
  Added in v.1263

  ViewVC Help
Powered by ViewVC 1.1.20