19 |
import android.os.AsyncTask; |
import android.os.AsyncTask; |
20 |
import android.os.Bundle; |
import android.os.Bundle; |
21 |
import android.util.Log; |
import android.util.Log; |
22 |
|
import android.view.View; |
23 |
|
import android.widget.ListView; |
24 |
import android.widget.TextView; |
import android.widget.TextView; |
25 |
|
import android.widget.Toast; |
26 |
import dk.thoerup.traininfo.provider.ProviderFactory; |
import dk.thoerup.traininfo.provider.ProviderFactory; |
27 |
import dk.thoerup.traininfo.provider.TimetableProvider; |
import dk.thoerup.traininfo.provider.TimetableProvider; |
28 |
import dk.thoerup.traininfo.util.MessageBox; |
import dk.thoerup.traininfo.util.MessageBox; |
69 |
} |
} |
70 |
|
|
71 |
|
|
72 |
@Override |
@Override |
73 |
|
protected void onListItemClick(ListView l, View v, int position, long id) { |
74 |
|
super.onListItemClick(l, v, position, id); |
75 |
|
|
76 |
|
TimetableBean tt = timetables.get(position); |
77 |
|
|
78 |
|
StationBean station = new StationBean(); |
79 |
|
station.setName( tt.getStation() ); |
80 |
|
station.setId( tt.getStationId() ); |
81 |
|
station.setRegional(true); |
82 |
|
|
83 |
|
Intent intent = new Intent(this, DepartureList.class); |
84 |
|
intent.putExtra("stationbean", station); |
85 |
|
startActivity(intent); |
86 |
|
|
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
@Override |
92 |
public void onSaveInstanceState(Bundle outState) |
public void onSaveInstanceState(Bundle outState) |
93 |
{ |
{ |
94 |
dismissDialog(DLG_PROGRESS); |
dismissDialog(DLG_PROGRESS); |
139 |
if (success) { |
if (success) { |
140 |
adapter.setTimetable(timetables); |
adapter.setTimetable(timetables); |
141 |
if (timetables.size() == 0) { |
if (timetables.size() == 0) { |
142 |
MessageBox.showMessage(TimetableList.this, getString(timetablelist_nodata)); |
MessageBox.showMessage(TimetableList.this, getString(timetablelist_nodata), true); |
143 |
} |
} |
144 |
} else { // communication or parse error |
} else { // communication or parse error |
145 |
AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this); |
155 |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
156 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
157 |
dialog.dismiss(); |
dialog.dismiss(); |
158 |
|
TimetableList.this.finish(); |
159 |
} |
} |
160 |
}); |
}); |
161 |
|
|