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

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

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

revision 398 by torben, Tue Oct 6 09:42:10 2009 UTC revision 578 by torben, Tue Feb 2 08:44:35 2010 UTC
# Line 17  import android.widget.TextView; Line 17  import android.widget.TextView;
17  import dk.thoerup.traininfo.provider.ProviderFactory;  import dk.thoerup.traininfo.provider.ProviderFactory;
18  import dk.thoerup.traininfo.provider.TimetableProvider;  import dk.thoerup.traininfo.provider.TimetableProvider;
19  import dk.thoerup.traininfo.util.MessageBox;  import dk.thoerup.traininfo.util.MessageBox;
20    import static dk.thoerup.traininfo.R.string.*;
21    
22  public class TimetableList extends Activity {  public class TimetableList extends Activity {
23                    
# Line 49  public class TimetableList extends Activ Line 50  public class TimetableList extends Activ
50                  ((TextView)findViewById(R.id.Status)).setText(departure.getStatus());                  ((TextView)findViewById(R.id.Status)).setText(departure.getStatus());
51                  ((TextView)findViewById(R.id.Location)).setText(departure.getLocation());                  ((TextView)findViewById(R.id.Location)).setText(departure.getLocation());
52                  ((TextView)findViewById(R.id.Note)).setText(departure.getNote());                  ((TextView)findViewById(R.id.Note)).setText(departure.getNote());
53                  ((TextView)findViewById(R.id.Updated)).setText(departure.getLastUpdateString());                  ((TextView)findViewById(R.id.Updated)).setText(departure.getLastUpdateString(this));
54                                                                                                    
55                                    
56                  if (savedInstanceState == null) {                  if (savedInstanceState == null) {
# Line 67  public class TimetableList extends Activ Line 68  public class TimetableList extends Activ
68          outState.putSerializable("timetables", (ArrayList<TimetableBean>) timetables);          outState.putSerializable("timetables", (ArrayList<TimetableBean>) timetables);
69      }      }
70    
 /*              case DLG_DETAILS:  
                         DepartureBean currentDeparture = departures.get(selectedItemId);  
                         ((TextView)dialog.findViewById(R.id.Time)).setText(currentDeparture.getTime());  
                         ((TextView)dialog.findViewById(R.id.Train)).setText(currentDeparture.getTrainNumber());  
                         ((TextView)dialog.findViewById(R.id.Destination)).setText( currentDeparture.getDestination());  
                         ((TextView)dialog.findViewById(R.id.Origin)).setText(currentDeparture.getOrigin());  
                         ((TextView)dialog.findViewById(R.id.Location)).setText(currentDeparture.getLocation());  
                         ((TextView)dialog.findViewById(R.id.Updated)).setText(currentDeparture.getLastUpdateString());  
                         ((TextView)dialog.findViewById(R.id.Status)).setText(currentDeparture.getStatus());  
                         ((TextView)dialog.findViewById(R.id.Note)).setText(currentDeparture.getNote());  
                         detailsDialog = dialog;  
                         break;  
   
  */  
71                    
72          @Override          @Override
73          protected void onPrepareDialog(int id, Dialog dialog) {          protected void onPrepareDialog(int id, Dialog dialog) {
# Line 97  public class TimetableList extends Activ Line 84  public class TimetableList extends Activ
84          protected Dialog onCreateDialog(int id) {          protected Dialog onCreateDialog(int id) {
85                  switch (id) {                  switch (id) {
86                  case DLG_PROGRESS:                  case DLG_PROGRESS:
87                          ProgressDialog dlg = new ProgressDialog(this);                          ProgressDialog dlg = new ProgressDialog(this);                  
88                          dlg.setMessage("Fetch timetable data");                          dlg.setMessage( getString(timetablelist_fetchdata) );
89                          dlg.setCancelable(true);                          dlg.setCancelable(true);
90                          return dlg;                                              return dlg;                    
91                  default:                  default:
# Line 125  public class TimetableList extends Activ Line 112  public class TimetableList extends Activ
112                          if (success) {                          if (success) {
113                                  adapter.setTimetable(timetables);                                  adapter.setTimetable(timetables);
114                                  if (timetables.size() == 0) {                                  if (timetables.size() == 0) {
115                                          MessageBox.showMessage(TimetableList.this, "No timetable found");                                          MessageBox.showMessage(TimetableList.this, getString(timetablelist_nodata));
116                                  }                                  }
117                          } else { // communication or parse error                          } else { // communication or parse error
118                                  AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this);                                                                                AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this);                                              
119                                  builder.setMessage("Error finding departures");                                  builder.setMessage(getString(timetablelist_fetcherror));
120                                  builder.setCancelable(true);                                  builder.setCancelable(true);
121                                  builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {                                  builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() {
122                                          public void onClick(DialogInterface dialog, int id) {                                          public void onClick(DialogInterface dialog, int id) {
123                                                  dialog.dismiss();                                                  dialog.dismiss();
124                                                  startTimetableFetcher();                                                  startTimetableFetcher();
125                                                                                                    
126                                          }                                          }
127                                  });                                  });
128                                  builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {                                  builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() {
129                                          public void onClick(DialogInterface dialog, int id) {                                          public void onClick(DialogInterface dialog, int id) {
130                                                  dialog.dismiss();                                                  dialog.dismiss();
131                                          }                                                                                                }                                                      

Legend:
Removed from v.398  
changed lines
  Added in v.578

  ViewVC Help
Powered by ViewVC 1.1.20