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