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; |
67 |
adapter.setTimetable(timetables); |
adapter.setTimetable(timetables); |
68 |
} |
} |
69 |
} |
} |
70 |
|
|
71 |
|
@Override |
72 |
|
protected void onDestroy() { |
73 |
|
super.onDestroy(); |
74 |
|
|
75 |
|
if (fetcher != null) { |
76 |
|
fetcher.cancel(true); |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
|
@Override |
81 |
@Override |
protected void onListItemClick(ListView l, View v, int position, long id) { |
82 |
|
super.onListItemClick(l, v, position, id); |
83 |
|
|
84 |
|
TimetableBean tt = timetables.get(position); |
85 |
|
|
86 |
|
StationBean station = new StationBean(); |
87 |
|
station.setName( tt.getStation() ); |
88 |
|
station.setId( tt.getStationId() ); |
89 |
|
station.setRegional(true); |
90 |
|
|
91 |
|
Intent intent = new Intent(this, DepartureList.class); |
92 |
|
intent.putExtra("stationbean", station); |
93 |
|
startActivity(intent); |
94 |
|
|
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
@Override |
100 |
public void onSaveInstanceState(Bundle outState) |
public void onSaveInstanceState(Bundle outState) |
101 |
{ |
{ |
102 |
dismissDialog(DLG_PROGRESS); |
dismissDialog(DLG_PROGRESS); |
145 |
|
|
146 |
|
|
147 |
if (success) { |
if (success) { |
148 |
|
TimetableList.this.getListView().invalidateViews(); |
149 |
adapter.setTimetable(timetables); |
adapter.setTimetable(timetables); |
150 |
if (timetables.size() == 0) { |
if (timetables.size() == 0) { |
151 |
MessageBox.showMessage(TimetableList.this, getString(timetablelist_nodata)); |
MessageBox.showMessage(TimetableList.this, getString(timetablelist_nodata), true); |
152 |
} |
} |
153 |
} else { // communication or parse error |
} else { // communication or parse error |
154 |
AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(TimetableList.this); |
164 |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
165 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
166 |
dialog.dismiss(); |
dialog.dismiss(); |
167 |
|
TimetableList.this.finish(); |
168 |
} |
} |
169 |
}); |
}); |
170 |
|
|