62 |
|
|
63 |
StationEntry station; |
StationEntry station; |
64 |
|
|
65 |
|
String trainType = "REGIONAL"; |
66 |
|
|
67 |
boolean arrival = false; |
boolean arrival = false; |
68 |
|
|
69 |
int commFailCounter = 0; |
int commFailCounter = 0; |
88 |
final Button departureBtn = (Button) findViewById(R.id.departurebtn); |
final Button departureBtn = (Button) findViewById(R.id.departurebtn); |
89 |
final Button arrivalBtn = (Button) findViewById(R.id.arrivalbtn); |
final Button arrivalBtn = (Button) findViewById(R.id.arrivalbtn); |
90 |
final Button metroBtn = (Button) findViewById(R.id.metrobtn); |
final Button metroBtn = (Button) findViewById(R.id.metrobtn); |
91 |
|
final Button regionalBtn = (Button) findViewById(R.id.regionalbtn); |
92 |
|
final Button stogBtn = (Button) findViewById(R.id.stogbtn); |
93 |
|
|
94 |
final View metroView = findViewById(R.id.metroonly); |
final View metroView = findViewById(R.id.metroonly); |
95 |
|
|
120 |
} |
} |
121 |
}); |
}); |
122 |
|
|
123 |
|
regionalBtn.setOnClickListener( new OnClickListener() { |
124 |
|
@Override |
125 |
|
public void onClick(View arg0) { |
126 |
|
regionalBtn.setBackgroundResource(R.drawable.custom_button_hilight); |
127 |
|
stogBtn.setBackgroundResource(R.drawable.custom_button); |
128 |
|
metroBtn.setBackgroundResource(R.drawable.custom_button); |
129 |
|
|
130 |
|
departureBtn.setVisibility( View.VISIBLE ); |
131 |
|
arrivalBtn.setVisibility( View.VISIBLE ); |
132 |
|
|
133 |
|
getListView().setVisibility( View.VISIBLE ); |
134 |
|
metroView.setVisibility( View.GONE ); |
135 |
|
trainType = "REGIONAL"; |
136 |
|
startDepartureFetcher(); |
137 |
|
} |
138 |
|
}); |
139 |
|
stogBtn.setOnClickListener( new OnClickListener() { |
140 |
|
@Override |
141 |
|
public void onClick(View arg0) { |
142 |
|
regionalBtn.setBackgroundResource(R.drawable.custom_button); |
143 |
|
stogBtn.setBackgroundResource(R.drawable.custom_button_hilight); |
144 |
|
metroBtn.setBackgroundResource(R.drawable.custom_button); |
145 |
|
|
146 |
|
|
147 |
|
departureBtn.setVisibility( View.VISIBLE ); |
148 |
|
arrivalBtn.setVisibility( View.VISIBLE ); |
149 |
|
|
150 |
|
getListView().setVisibility( View.VISIBLE ); |
151 |
|
metroView.setVisibility( View.GONE ); |
152 |
|
trainType = "STOG"; |
153 |
|
startDepartureFetcher(); |
154 |
|
} |
155 |
|
}); |
156 |
|
|
157 |
|
|
158 |
|
|
159 |
metroBtn.setOnClickListener( new OnClickListener() { |
metroBtn.setOnClickListener( new OnClickListener() { |
160 |
@Override |
@Override |
161 |
public void onClick(View v) { |
public void onClick(View v) { |
162 |
arrivalBtn.setBackgroundResource(R.drawable.custom_button); |
regionalBtn.setBackgroundResource(R.drawable.custom_button); |
163 |
departureBtn.setBackgroundResource(R.drawable.custom_button); |
stogBtn.setBackgroundResource(R.drawable.custom_button); |
164 |
metroBtn.setBackgroundResource(R.drawable.custom_button_hilight); |
metroBtn.setBackgroundResource(R.drawable.custom_button_hilight); |
165 |
|
|
166 |
|
departureBtn.setVisibility( View.GONE ); |
167 |
|
arrivalBtn.setVisibility( View.GONE ); |
168 |
|
|
169 |
getListView().setVisibility( View.GONE ); |
getListView().setVisibility( View.GONE ); |
170 |
metroView.setVisibility( View.VISIBLE ); |
metroView.setVisibility( View.VISIBLE ); |
171 |
startMetroFetcher(); |
startMetroFetcher(); |
198 |
|
|
199 |
metro = ProviderFactory.getMetroProvider(); |
metro = ProviderFactory.getMetroProvider(); |
200 |
|
|
201 |
|
if (station.isRegional() == false ) { |
202 |
|
regionalBtn.setVisibility(View.GONE); |
203 |
|
} |
204 |
|
|
205 |
|
if (station.isStrain() == false ) { |
206 |
|
stogBtn.setVisibility(View.GONE); |
207 |
|
} |
208 |
|
|
209 |
|
if (station.isRegional() == true && station.isStrain() == false ) { |
210 |
|
if ( station.isMetro() == false ) |
211 |
|
regionalBtn.setVisibility(View.GONE); |
212 |
|
trainType = "REGIONAL"; |
213 |
|
} |
214 |
|
|
215 |
|
if (station.isRegional() == false && station.isStrain() == true) { |
216 |
|
if (station.isMetro() == false) |
217 |
|
stogBtn.setVisibility(View.GONE); |
218 |
|
|
219 |
|
stogBtn.setBackgroundResource(R.drawable.custom_button_hilight); |
220 |
|
trainType = "STOG"; |
221 |
|
|
222 |
|
} |
223 |
|
|
224 |
|
|
225 |
if (station.isRegional() == false && station.isStrain() == false) { |
if (station.isRegional() == false && station.isStrain() == false) { |
226 |
getListView().setVisibility( View.GONE ); |
getListView().setVisibility( View.GONE ); |
227 |
metroView.setVisibility( View.VISIBLE ); |
metroView.setVisibility( View.VISIBLE ); |
228 |
|
|
229 |
departureBtn.setVisibility( View.GONE ); |
departureBtn.setVisibility( View.GONE ); |
230 |
arrivalBtn.setVisibility(View.GONE); |
arrivalBtn.setVisibility(View.GONE); |
231 |
metroBtn.setVisibility( View.GONE ); |
metroBtn.setVisibility( View.GONE ); |
232 |
|
|
233 |
|
|
234 |
|
|
235 |
if (savedInstanceState == null) { |
if (savedInstanceState == null) { |
236 |
startMetroFetcher(); |
startMetroFetcher(); |
364 |
boolean res; |
boolean res; |
365 |
switch(item.getItemId()) { |
switch(item.getItemId()) { |
366 |
case MENU_MAP: |
case MENU_MAP: |
367 |
Uri uri = Uri.parse("geo:" + station.getLatitude() + "," + station.getLongitude()); |
Uri uri = Uri.parse("geo:" + station.getLatitude() + "," + station.getLongitude() + "?z=16"); |
368 |
startActivity( new Intent(Intent.ACTION_VIEW, uri)); |
startActivity( new Intent(Intent.ACTION_VIEW, uri)); |
369 |
res = true; |
res = true; |
370 |
break; |
break; |
475 |
|
|
476 |
@Override |
@Override |
477 |
protected Void doInBackground(Integer... params) { |
protected Void doInBackground(Integer... params) { |
478 |
departures = provider.lookupDepartures(params[0], DepartureList.this.arrival); |
departures = provider.lookupDepartures(params[0], DepartureList.this.arrival, trainType); |
479 |
return null; |
return null; |
480 |
} |
} |
481 |
|
|
493 |
|
|
494 |
TextView h1 = new TextView(this); |
TextView h1 = new TextView(this); |
495 |
h1.setText("Metro"); |
h1.setText("Metro"); |
496 |
|
h1.setTextSize(16); |
497 |
h1.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
h1.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
498 |
|
|
499 |
|
|
504 |
|
|
505 |
|
|
506 |
TextView h2 = new TextView(this); |
TextView h2 = new TextView(this); |
507 |
|
h2.setTextSize(16); |
508 |
h2.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
h2.setTypeface( Typeface.defaultFromStyle(Typeface.BOLD)); |
509 |
h2.setText("Om minutter"); |
h2.setText("Om minutter"); |
510 |
|
|
511 |
|
params = new TableRow.LayoutParams(); |
512 |
|
params.weight = 2; |
513 |
head.addView(h2,params); |
head.addView(h2,params); |
514 |
|
|
515 |
|
|
522 |
Log.e("Test", "" + entry.destination); |
Log.e("Test", "" + entry.destination); |
523 |
|
|
524 |
TextView v1 = new TextView(this); |
TextView v1 = new TextView(this); |
525 |
v1.setText( entry.metro ); |
v1.setTextSize(16); |
526 |
|
v1.setText( entry.metro ); |
527 |
row.addView(v1); |
row.addView(v1); |
528 |
|
|
529 |
TextView v2 = new TextView(this); |
TextView v2 = new TextView(this); |
530 |
|
v2.setTextSize(16); |
531 |
v2.setText( entry.destination ); |
v2.setText( entry.destination ); |
532 |
row.addView(v2); |
row.addView(v2); |
533 |
|
|
534 |
TextView v3 = new TextView(this); |
TextView v3 = new TextView(this); |
535 |
|
v3.setTextSize(16); |
536 |
v3.setText( entry.minutes ); |
v3.setText( entry.minutes ); |
537 |
row.addView(v3); |
row.addView(v3); |
538 |
|
|