--- android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2009/10/29 11:38:58 484 +++ android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/01/27 06:07:27 555 @@ -2,7 +2,7 @@ import java.util.ArrayList; import java.util.List; -import java.util.Locale; + import android.app.AlertDialog; import android.app.Dialog; @@ -12,14 +12,12 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; -import android.location.Address; -import android.location.Geocoder; import android.location.Location; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.util.Log; + import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.Menu; @@ -190,7 +188,6 @@ case OPTIONS_MAP: Intent intent = new Intent(this,StationMapView.class); - intent.putExtra("userlocation", location ); ArrayList stationPoints = new ArrayList(); for (StationBean st : stations ) { @@ -205,9 +202,15 @@ Location loc = locationLookup.getLocation(); StringBuffer message = new StringBuffer(); message.append("Location info:\n"); - message.append("-Obtained by: ").append(loc != null ? loc.getProvider() : "-").append("\n"); - message.append("-Accuracy: ").append(loc != null ? (int)loc.getAccuracy() : "-").append("m\n"); - + if (loc != null) { + message.append("-Obtained by: ").append( loc.getProvider() ).append("\n"); + message.append("-Accuracy: ").append( (int)loc.getAccuracy()).append("m\n"); + message.append("-Latitude: ").append( loc.getLatitude()).append("\n"); + message.append("-Longitude: ").append( loc.getLongitude() ).append("\n"); + } else { + message.append(" - No location data!"); + } + MessageBox.showMessage(this, message.toString()); break; default: @@ -262,6 +265,7 @@ builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); + StationList.this.finish(); // Close this Activity } }); return builder.create(); @@ -305,6 +309,9 @@ intent.putExtra("longitude", longitude); intent.putExtra("stationid", station.getId()); intent.putExtra("address", station.getAddress()); + intent.putExtra("isregional", station.isRegional()); + intent.putExtra("isstrain", station.isSTrain()); + intent.putExtra("ismetro", station.isMetro()); startActivity(intent); } @@ -357,6 +364,7 @@ } + /* TODO: Remove this no longer needed function String lookupAddress(double latitude, double longitude) { Geocoder coder = new Geocoder(this, new Locale("da")); @@ -381,7 +389,7 @@ } return sb.toString(); - } + }*/ //////////////////////////////////////////////////////////////////////////// @@ -495,10 +503,7 @@ List stations = stationProvider.getStations(); for (StationBean station : stations) { - String addr = lookupAddress(station.getLatitude(), station.getLongitude()); - station.setAddress(addr); - - + if (method.equals(LookupMethod.ByName) || method.equals(LookupMethod.ByList)) { if (loc != null) { //only do the distance calc if we have a location dummy.setLatitude(station.getLatitude());