48 |
|
|
49 |
public static final int OPTIONS_MAP = 2003; |
public static final int OPTIONS_MAP = 2003; |
50 |
public static final int OPTIONS_GPSINFO = 2004; |
public static final int OPTIONS_GPSINFO = 2004; |
|
|
|
|
|
|
|
|
|
51 |
|
|
52 |
public static final int DLG_PROGRESS = 3001; |
public static final int DLG_PROGRESS = 3001; |
53 |
public static final int DLG_STATIONNAME = 3002; |
public static final int DLG_STATIONNAME = 3002; |
54 |
|
|
55 |
|
|
56 |
|
public static final int GPS_TIMEOUT_MS = 17500; //how long are we willing to wait for gps fix -in milliseconds |
57 |
|
|
58 |
|
|
59 |
static enum LookupMethod { |
static enum LookupMethod { |
60 |
ByLocation, |
ByLocation, |
61 |
ByName, |
ByName, |
140 |
} |
} |
141 |
|
|
142 |
} |
} |
143 |
|
|
144 |
|
|
145 |
|
@Override |
146 |
|
protected void onDestroy() { |
147 |
|
super.onDestroy(); |
148 |
|
|
149 |
|
if (findStationsTask != null) { |
150 |
|
findStationsTask.cancel(true); |
151 |
|
} |
152 |
|
if (locationLookup != null) { |
153 |
|
locationLookup.stopSearch(); |
154 |
|
} |
155 |
|
isRunning = false; |
156 |
|
} |
157 |
|
|
158 |
|
|
159 |
protected void setTitle() { |
protected void setTitle() { |
160 |
String dialogTitle = getResources().getString(app_name); |
String dialogTitle = getResources().getString(app_name); |
161 |
switch (listType) { |
switch (listType) { |
275 |
message.append( getString(stationlist_nolocation) ); |
message.append( getString(stationlist_nolocation) ); |
276 |
} |
} |
277 |
|
|
278 |
MessageBox.showMessage(this, message.toString()); |
MessageBox.showMessage(this, message.toString(), false); |
279 |
break; |
break; |
280 |
default: |
default: |
281 |
retval = super.onOptionsItemSelected(item); |
retval = super.onOptionsItemSelected(item); |
396 |
showDialogSafe(DLG_PROGRESS); |
showDialogSafe(DLG_PROGRESS); |
397 |
|
|
398 |
locationLookup.locateStations(); |
locationLookup.locateStations(); |
399 |
stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, 20000); |
stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, GPS_TIMEOUT_MS); |
400 |
} |
} |
401 |
|
|
402 |
void startNameSearch(String name) { |
void startNameSearch(String name) { |
454 |
|
|
455 |
case NOPROVIDER: |
case NOPROVIDER: |
456 |
dismissDialogSafe(DLG_PROGRESS); |
dismissDialogSafe(DLG_PROGRESS); |
457 |
MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider) ); |
MessageBox.showMessage(StationList.this, getString(stationlist_nolocationprovider), true ); |
458 |
|
//StationList.this.finish(); |
459 |
break; |
break; |
460 |
case LOCATIONFIXTIMEOUT: |
case LOCATIONFIXTIMEOUT: |
461 |
if (isRunning) { |
if (isRunning) { |
556 |
showMessageAndClose(getString(stationlist_nostations)); |
showMessageAndClose(getString(stationlist_nostations)); |
557 |
} |
} |
558 |
stations = stationProvider.getStations(); |
stations = stationProvider.getStations(); |
559 |
|
|
560 |
|
StationList.this.getListView().invalidateViews(); |
561 |
adapter.setStations( stations ); |
adapter.setStations( stations ); |
562 |
|
|
563 |
|
|
564 |
} else { //communication or parse errors |
} else { //communication or parse errors |
565 |
AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this); |
AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this); |
566 |
builder.setMessage(getString(stationlist_nearbyerror)); |
builder.setMessage(getString(stationlist_fetcherror)); |
567 |
builder.setCancelable(true); |
builder.setCancelable(true); |
568 |
builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() { |
builder.setPositiveButton(getString(generic_retry), new DialogInterface.OnClickListener() { |
569 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
603 |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
builder.setNegativeButton(getString(generic_cancel), new DialogInterface.OnClickListener() { |
604 |
public void onClick(DialogInterface dialog, int id) { |
public void onClick(DialogInterface dialog, int id) { |
605 |
dialog.dismiss(); |
dialog.dismiss(); |
606 |
|
StationList.this.finish(); |
607 |
} |
} |
608 |
}); |
}); |
609 |
|
|