82 |
IntSet favorites = new IntSet(); |
IntSet favorites = new IntSet(); |
83 |
|
|
84 |
boolean showingFavorites = false; |
boolean showingFavorites = false; |
85 |
|
String dialogTitle; |
86 |
SharedPreferences prefs; |
SharedPreferences prefs; |
87 |
|
|
88 |
/////////////////////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////////////////////// |
116 |
stations = (ArrayList<StationBean>) savedInstanceState.getSerializable("stations"); |
stations = (ArrayList<StationBean>) savedInstanceState.getSerializable("stations"); |
117 |
adapter.setStations(stations); |
adapter.setStations(stations); |
118 |
location = (GeoPair) savedInstanceState.getSerializable("location"); |
location = (GeoPair) savedInstanceState.getSerializable("location"); |
119 |
|
dialogTitle = savedInstanceState.getString("title"); |
120 |
|
setTitle(dialogTitle); |
121 |
} |
} |
122 |
} |
} |
123 |
|
|
129 |
dialog.dismiss(); |
dialog.dismiss(); |
130 |
outState.putSerializable("stations", (ArrayList<StationBean>) stations); |
outState.putSerializable("stations", (ArrayList<StationBean>) stations); |
131 |
outState.putSerializable("location", location); |
outState.putSerializable("location", location); |
132 |
|
outState.putString("title", dialogTitle); |
133 |
} |
} |
134 |
|
|
135 |
|
|
486 |
String addr = lookupAddress(station.getLatitude(), station.getLongitude()); |
String addr = lookupAddress(station.getLatitude(), station.getLongitude()); |
487 |
station.setAddress(addr); |
station.setAddress(addr); |
488 |
|
|
489 |
if (loc != null) { //only do the distance calc if we have a location |
|
490 |
if (method.equals(LookupMethod.ByName) || method.equals(LookupMethod.ByList)) { |
if (method.equals(LookupMethod.ByName) || method.equals(LookupMethod.ByList)) { |
491 |
|
if (loc != null) { //only do the distance calc if we have a location |
492 |
dummy.setLatitude(station.getLatitude()); |
dummy.setLatitude(station.getLatitude()); |
493 |
dummy.setLongitude(station.getLongitude()); |
dummy.setLongitude(station.getLongitude()); |
494 |
station.setDistance( (int)loc.distanceTo(dummy) ); |
station.setDistance( (int)loc.distanceTo(dummy) ); |
495 |
|
} else { |
496 |
|
station.setDistance(0); |
497 |
} |
} |
|
} else { |
|
|
station.setDistance(0); |
|
498 |
} |
} |
499 |
|
|
500 |
} |
} |
501 |
|
|
502 |
return null; |
return null; |
508 |
dialog.dismiss(); |
dialog.dismiss(); |
509 |
|
|
510 |
//set title |
//set title |
|
String title; |
|
511 |
switch (method) { |
switch (method) { |
512 |
case ByLocation: |
case ByLocation: |
513 |
title = "Traininfo DK - Nearby stations"; |
dialogTitle = "Traininfo DK - Nearby stations"; |
514 |
break; |
break; |
515 |
case ByName: |
case ByName: |
516 |
title = "Traininfo DK - Search"; |
dialogTitle = "Traininfo DK - Search"; |
517 |
break; |
break; |
518 |
case ByList: |
case ByList: |
519 |
title = "Traininfo DK - Favorites"; |
dialogTitle = "Traininfo DK - Favorites"; |
520 |
break; |
break; |
521 |
default: |
default: |
522 |
title = "";//not possible |
dialogTitle = "";//not possible |
523 |
} |
} |
524 |
|
|
525 |
StationList.this.setTitle(title); |
StationList.this.setTitle(dialogTitle); |
526 |
//set title end |
//set title end |
527 |
|
|
528 |
if (success) { |
if (success) { |