27 |
import android.widget.TableLayout; |
import android.widget.TableLayout; |
28 |
import android.widget.TableRow; |
import android.widget.TableRow; |
29 |
import android.widget.TextView; |
import android.widget.TextView; |
30 |
|
import dk.thoerup.android.traininfo.common.DepartureBean; |
31 |
|
import dk.thoerup.android.traininfo.common.DepartureEntry; |
32 |
|
import dk.thoerup.android.traininfo.common.MetroBean; |
33 |
|
import dk.thoerup.android.traininfo.common.MetroBean.MetroEntry; |
34 |
|
import dk.thoerup.android.traininfo.common.StationBean.StationEntry; |
35 |
import dk.thoerup.traininfo.provider.DepartureProvider; |
import dk.thoerup.traininfo.provider.DepartureProvider; |
36 |
import dk.thoerup.traininfo.provider.MetroProvider; |
import dk.thoerup.traininfo.provider.MetroProvider; |
37 |
import dk.thoerup.traininfo.provider.ProviderFactory; |
import dk.thoerup.traininfo.provider.ProviderFactory; |
|
import dk.thoerup.traininfo.provider.MetroProvider.MetroBean; |
|
|
import dk.thoerup.traininfo.provider.MetroProvider.MetroEntry; |
|
38 |
import dk.thoerup.traininfo.util.MessageBox; |
import dk.thoerup.traininfo.util.MessageBox; |
39 |
|
|
40 |
public class DepartureList extends ListActivity { |
public class DepartureList extends ListActivity { |
60 |
DepartureFetcher fetcher; |
DepartureFetcher fetcher; |
61 |
MetroFetcher metroFetcher; |
MetroFetcher metroFetcher; |
62 |
|
|
63 |
StationBean station; |
StationEntry station; |
64 |
|
|
65 |
boolean arrival = false; |
boolean arrival = false; |
66 |
|
|
76 |
|
|
77 |
Intent launchedBy = getIntent(); |
Intent launchedBy = getIntent(); |
78 |
|
|
79 |
station = (StationBean) launchedBy.getSerializableExtra("stationbean"); |
station = (StationEntry) launchedBy.getSerializableExtra("stationbean"); |
80 |
|
|
81 |
((TextView) findViewById(R.id.stationName)).setText( station.getName() ); |
((TextView) findViewById(R.id.stationName)).setText( station.getName() ); |
82 |
|
|
134 |
|
|
135 |
// findViewById(R.id.header).setOnClickListener( mapLauncher ); |
// findViewById(R.id.header).setOnClickListener( mapLauncher ); |
136 |
|
|
137 |
int distance = station.getDistance(); |
int distance = station.getCalcdist(); |
138 |
if (distance != 0) { |
if (distance != 0) { |
139 |
NumberFormat format = NumberFormat.getNumberInstance(); |
NumberFormat format = NumberFormat.getNumberInstance(); |
140 |
format.setMaximumFractionDigits(1); |
format.setMaximumFractionDigits(1); |
155 |
|
|
156 |
metro = ProviderFactory.getMetroProvider(); |
metro = ProviderFactory.getMetroProvider(); |
157 |
|
|
158 |
if (station.isRegional() == false && station.isSTrain() == false) { |
if (station.isRegional() == false && station.isStrain() == false) { |
159 |
getListView().setVisibility( View.GONE ); |
getListView().setVisibility( View.GONE ); |
160 |
metroView.setVisibility( View.VISIBLE ); |
metroView.setVisibility( View.VISIBLE ); |
161 |
|
|
424 |
|
|
425 |
TextView h1 = new TextView(this); |
TextView h1 = new TextView(this); |
426 |
h1.setText("Metro"); |
h1.setText("Metro"); |
427 |
|
h1.setTextSize(16); |
428 |
h1.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
h1.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
429 |
|
|
430 |
|
|
435 |
|
|
436 |
|
|
437 |
TextView h2 = new TextView(this); |
TextView h2 = new TextView(this); |
438 |
|
h2.setTextSize(16); |
439 |
h2.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
h2.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
440 |
h2.setText("Om minutter"); |
h2.setText("Om minutter"); |
441 |
|
|
442 |
|
params = new TableRow.LayoutParams(); |
443 |
|
params.weight = 2; |
444 |
head.addView(h2,params); |
head.addView(h2,params); |
445 |
|
|
446 |
|
|
453 |
Log.e("Test", "" + entry.destination); |
Log.e("Test", "" + entry.destination); |
454 |
|
|
455 |
TextView v1 = new TextView(this); |
TextView v1 = new TextView(this); |
456 |
v1.setText( entry.metro ); |
v1.setTextSize(16); |
457 |
|
v1.setText( entry.metro ); |
458 |
row.addView(v1); |
row.addView(v1); |
459 |
|
|
460 |
TextView v2 = new TextView(this); |
TextView v2 = new TextView(this); |
461 |
|
v2.setTextSize(16); |
462 |
v2.setText( entry.destination ); |
v2.setText( entry.destination ); |
463 |
row.addView(v2); |
row.addView(v2); |
464 |
|
|
465 |
TextView v3 = new TextView(this); |
TextView v3 = new TextView(this); |
466 |
|
v3.setTextSize(16); |
467 |
v3.setText( entry.minutes ); |
v3.setText( entry.minutes ); |
468 |
row.addView(v3); |
row.addView(v3); |
469 |
|
|