/[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 1265 by torben, Tue Apr 5 13:00:34 2011 UTC revision 1416 by torben, Mon May 2 16:08:01 2011 UTC
# Line 22  import android.view.View; Line 22  import android.view.View;
22  import android.widget.ListView;  import android.widget.ListView;
23  import android.widget.TextView;  import android.widget.TextView;
24  import dk.thoerup.android.traininfo.common.DepartureEntry;  import dk.thoerup.android.traininfo.common.DepartureEntry;
25  import dk.thoerup.android.traininfo.common.StationBean.StationEntry;  import dk.thoerup.android.traininfo.common.StationEntry;
26  import dk.thoerup.android.traininfo.common.TimetableBean;  import dk.thoerup.android.traininfo.common.TimetableBean;
27  import dk.thoerup.android.traininfo.common.TimetableEntry;  import dk.thoerup.android.traininfo.common.TimetableEntry;
28  import dk.thoerup.traininfo.provider.ProviderFactory;  import dk.thoerup.traininfo.provider.ProviderFactory;
# Line 72  public class TimetableList extends ListA Line 72  public class TimetableList extends ListA
72                  note = note.replace("Erstattet af", this.getString(R.string.timetablelist_replacedby) );                  note = note.replace("Erstattet af", this.getString(R.string.timetablelist_replacedby) );
73                  note = note.replace("Eksterne forhold", this.getString(R.string.timetablelist_externalconditions) );                  note = note.replace("Eksterne forhold", this.getString(R.string.timetablelist_externalconditions) );
74                  note = note.replace("Teknisk fejl på et signal", this.getString(R.string.timetablelist_technicalerroronsignal) );                  note = note.replace("Teknisk fejl på et signal", this.getString(R.string.timetablelist_technicalerroronsignal) );
75                  note = note.replace("Materielforhold", this.getString(R.string.timetablelist_equipmentcircumstances) );                  note = note.replace("Materielforhold", this.getString(R.string.timetablelist_equipmentrelated) );
76                    note = note.replace("Passagerforhold", this.getString(R.string.timetablelist_passengerrelated) );
77                    note = note.replace("Forventet rettidig afgang", this.getString(R.string.timetablelist_expectedtimelydeparture) );
78                                    
79                  // TODO: missing translations:  
                 // * Forventet rettidig afgang fra <station>  
                 // * Forventet rettidig afgang.  
80                                    
81                  ((TextView)findViewById(R.id.Status)).setText(status);                  ((TextView)findViewById(R.id.Status)).setText(status);
82                  ((TextView)findViewById(R.id.Note)).setText(note);                  ((TextView)findViewById(R.id.Note)).setText(note);
# Line 106  public class TimetableList extends ListA Line 106  public class TimetableList extends ListA
106                  super.onListItemClick(l, v, position, id);                  super.onListItemClick(l, v, position, id);
107    
108                  TimetableEntry tt = timetables.entries.get(position);                  TimetableEntry tt = timetables.entries.get(position);
109                                                                    
                 StationEntry station = new StationEntry();  
                 station.setName( tt.getStation() );  
                 station.setId( tt.getStationId() );  
                 station.setIsRegional(true);  
                   
110                                    
111                  Intent intent = new Intent(this, DepartureList.class);                  Intent intent = new Intent(this, DepartureList.class);
112                  intent.putExtra("stationbean", station);                  intent.putExtra("stationbean", tt.getStationEntry() );
113                  startActivity(intent);                  startActivity(intent);
114                                    
115          }          }
# Line 187  public class TimetableList extends ListA Line 182  public class TimetableList extends ListA
182                          dismissDialog(DLG_PROGRESS);                          dismissDialog(DLG_PROGRESS);
183                    
184                          //TODO: differentiate between a communication error and a downed bane.dk site                            //TODO: differentiate between a communication error and a downed bane.dk site  
185                          if (timetables != null) {                          if (timetables != null && timetables.errorCode == null) {
186                                  commFailCounter = 0;                                  commFailCounter = 0;
187                                  TimetableList.this.getListView().invalidateViews();                                  TimetableList.this.getListView().invalidateViews();
188                                  adapter.setTimetable(timetables);                                  adapter.setTimetable(timetables);
# Line 197  public class TimetableList extends ListA Line 192  public class TimetableList extends ListA
192                          } else { // communication or parse error                          } else { // communication or parse error
193                                  commFailCounter++;                                  commFailCounter++;
194                                  AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this);                                                                                AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this);                                              
195                                  builder.setMessage(getString(timetablelist_fetcherror));                                  
196                                    
197                                    if (timetables != null && timetables.errorCode != null ) { //got an error xml back
198                                            commFailCounter = 10;                                  
199                                            builder.setMessage( getString(R.string.no_backend) );
200                                    } else {
201                                            builder.setMessage(getString(timetablelist_fetcherror));        
202                                    }
203                                    
204                                  builder.setCancelable(true);                                  builder.setCancelable(true);
205                                  if (commFailCounter < 3) {                                  if (commFailCounter < 3) {
206                                          builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() {                                          builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() {

Legend:
Removed from v.1265  
changed lines
  Added in v.1416

  ViewVC Help
Powered by ViewVC 1.1.20