495 |
class FindStationsTask extends AsyncTask<Void,Void,Void> { |
class FindStationsTask extends AsyncTask<Void,Void,Void> { |
496 |
|
|
497 |
LookupMethod method = LookupMethod.MethodNone; |
LookupMethod method = LookupMethod.MethodNone; |
|
boolean success; |
|
498 |
String name; |
String name; |
499 |
Location loc; |
Location loc; |
500 |
String ids; |
String ids; |
529 |
|
|
530 |
switch (method) { |
switch (method) { |
531 |
case ByLocation: |
case ByLocation: |
532 |
success = stationProvider.lookupStations(loc); |
stations = stationProvider.lookupStations(loc); |
533 |
break; |
break; |
534 |
case ByName: |
case ByName: |
535 |
success = stationProvider.lookupStationsByName(name); |
stations = stationProvider.lookupStationsByName(name); |
536 |
break; |
break; |
537 |
case ByList: |
case ByList: |
538 |
success = stationProvider.lookupStationsByIds(ids); |
stations = stationProvider.lookupStationsByIds(ids); |
539 |
break; |
break; |
540 |
default: |
default: |
541 |
success = false; // not possible |
stations = null; // not possible |
542 |
} |
} |
543 |
|
|
544 |
|
|
551 |
dialog.dismiss();//TODO:dismissDialogSafe(dialog); |
dialog.dismiss();//TODO:dismissDialogSafe(dialog); |
552 |
|
|
553 |
|
|
554 |
if (success) { |
if (stations != null) { |
555 |
if (stationProvider.getStations().size() == 0) { |
if (stations.size() == 0) { |
556 |
showMessageAndClose(getString(stationlist_nostations)); |
showMessageAndClose(getString(stationlist_nostations)); |
557 |
} |
} |
|
stations = stationProvider.getStations(); |
|
558 |
|
|
559 |
StationList.this.getListView().invalidateViews(); |
StationList.this.getListView().invalidateViews(); |
560 |
adapter.setStations( stations ); |
adapter.setStations( stations ); |