3 |
import java.text.NumberFormat; |
import java.text.NumberFormat; |
4 |
import java.util.ArrayList; |
import java.util.ArrayList; |
5 |
import java.util.List; |
import java.util.List; |
6 |
|
import java.util.Locale; |
7 |
|
|
8 |
import android.app.Dialog; |
import android.app.Dialog; |
9 |
import android.app.ListActivity; |
import android.app.ListActivity; |
10 |
import android.app.ProgressDialog; |
import android.app.ProgressDialog; |
11 |
import android.content.Intent; |
import android.content.Intent; |
12 |
|
import android.location.Address; |
13 |
|
import android.location.Geocoder; |
14 |
import android.net.Uri; |
import android.net.Uri; |
15 |
import android.os.AsyncTask; |
import android.os.AsyncTask; |
16 |
import android.os.Bundle; |
import android.os.Bundle; |
17 |
|
import android.util.Log; |
18 |
import android.view.View; |
import android.view.View; |
19 |
import android.widget.ListView; |
import android.widget.ListView; |
20 |
import android.widget.TextView; |
import android.widget.TextView; |
56 |
|
|
57 |
String name = launchedBy.getStringExtra("name"); |
String name = launchedBy.getStringExtra("name"); |
58 |
((TextView) findViewById(R.id.stationName)).setText( name ); |
((TextView) findViewById(R.id.stationName)).setText( name ); |
59 |
|
|
60 |
|
String address = launchedBy.getStringExtra("address"); |
61 |
|
((TextView) findViewById(R.id.stationAddr)).setText( address ); |
62 |
|
|
63 |
String addr = launchedBy.getStringExtra("address"); |
int stationId = launchedBy.getIntExtra("stationid", -1); |
|
((TextView) findViewById(R.id.stationAddr)).setText( addr ); |
|
64 |
|
|
65 |
findViewById(R.id.header).setOnClickListener( mapLauncher ); |
findViewById(R.id.header).setOnClickListener( mapLauncher ); |
66 |
|
|
76 |
fetcher = new DepartureFetcher(); |
fetcher = new DepartureFetcher(); |
77 |
if (savedInstanceState == null) { |
if (savedInstanceState == null) { |
78 |
showDialog(DLG_PROGRESS); |
showDialog(DLG_PROGRESS); |
79 |
fetcher.execute(name); |
fetcher.execute(stationId); |
80 |
} else { |
} else { |
81 |
departures = (List<DepartureBean>) savedInstanceState.getSerializable("departures"); |
departures = (List<DepartureBean>) savedInstanceState.getSerializable("departures"); |
82 |
adapter.setDepartures(departures); |
adapter.setDepartures(departures); |
157 |
return super.onCreateDialog(id); |
return super.onCreateDialog(id); |
158 |
} |
} |
159 |
} |
} |
160 |
|
|
161 |
class DialogDismisser implements View.OnClickListener { |
class DialogDismisser implements View.OnClickListener { |
162 |
|
|
163 |
Dialog dlg; |
Dialog dlg; |
181 |
}; |
}; |
182 |
|
|
183 |
|
|
184 |
class DepartureFetcher extends AsyncTask<String, Void, Void> { |
class DepartureFetcher extends AsyncTask<Integer, Void, Void> { |
185 |
|
|
186 |
|
String addr; |
187 |
@Override |
@Override |
188 |
protected void onPostExecute(Void result) { |
protected void onPostExecute(Void result) { |
189 |
super.onPostExecute(result); |
super.onPostExecute(result); |
196 |
} |
} |
197 |
|
|
198 |
@Override |
@Override |
199 |
protected Void doInBackground(String... params) { |
protected Void doInBackground(Integer... params) { |
200 |
provider.lookupDepartures(params[0]); |
provider.lookupDepartures(params[0]); |
201 |
departures = provider.getDepartures(); |
departures = provider.getDepartures(); |
202 |
return null; |
return null; |