14 |
import android.widget.ListView; |
import android.widget.ListView; |
15 |
import android.widget.TextView; |
import android.widget.TextView; |
16 |
import android.widget.Toast; |
import android.widget.Toast; |
17 |
import dk.thoerup.traininfo.provider.DepartureFactory; |
import dk.thoerup.traininfo.provider.ProviderFactory; |
18 |
import dk.thoerup.traininfo.provider.DepartureProvider; |
import dk.thoerup.traininfo.provider.DepartureProvider; |
19 |
|
import dk.thoerup.traininfo.util.MessageBox; |
20 |
|
|
21 |
public class DepartureList extends ListActivity { |
public class DepartureList extends ListActivity { |
22 |
|
|
65 |
|
|
66 |
|
|
67 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
68 |
provider = DepartureFactory.getProvider(); |
provider = ProviderFactory.getDepartureProvider(); |
69 |
|
|
70 |
fetcher = new DepartureFetcher(); |
fetcher = new DepartureFetcher(); |
71 |
fetcher.execute(name); |
fetcher.execute(name); |
72 |
} |
} |
73 |
|
|
74 |
|
@Override |
75 |
|
public void onSaveInstanceState(Bundle outState) |
76 |
|
{ |
77 |
|
if (pgDialog.isShowing()) |
78 |
|
pgDialog.dismiss(); |
79 |
|
} |
80 |
|
|
81 |
@Override |
@Override |
82 |
protected void onListItemClick(ListView l, View v, int position, long id) { |
protected void onListItemClick(ListView l, View v, int position, long id) { |
83 |
super.onListItemClick(l, v, position, id); |
super.onListItemClick(l, v, position, id); |
94 |
switch (id) { |
switch (id) { |
95 |
case DLG_DETAILS: |
case DLG_DETAILS: |
96 |
((TextView)dialog.findViewById(R.id.Time)).setText(currentDeparture.getTime()); |
((TextView)dialog.findViewById(R.id.Time)).setText(currentDeparture.getTime()); |
97 |
|
((TextView)dialog.findViewById(R.id.Train)).setText(currentDeparture.getTrainNumber()); |
98 |
((TextView)dialog.findViewById(R.id.Destination)).setText( currentDeparture.getDestination()); |
((TextView)dialog.findViewById(R.id.Destination)).setText( currentDeparture.getDestination()); |
99 |
((TextView)dialog.findViewById(R.id.Origin)).setText(currentDeparture.getOrigin()); |
((TextView)dialog.findViewById(R.id.Origin)).setText(currentDeparture.getOrigin()); |
100 |
((TextView)dialog.findViewById(R.id.Location)).setText(currentDeparture.getLocation()); |
((TextView)dialog.findViewById(R.id.Location)).setText(currentDeparture.getLocation()); |
165 |
pgDialog.dismiss(); |
pgDialog.dismiss(); |
166 |
|
|
167 |
if (departures.size() == 0) |
if (departures.size() == 0) |
168 |
Toast.makeText(DepartureList.this, "No departures found", Toast.LENGTH_LONG); |
MessageBox.showMessage(DepartureList.this, "No departures found"); |
169 |
} |
} |
170 |
|
|
171 |
@Override |
@Override |