aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines')
-rw-r--r--src/net/cbaines/suma/BuildingNumOverlay.java3
-rw-r--r--src/net/cbaines/suma/MapActivity.java178
2 files changed, 73 insertions, 108 deletions
diff --git a/src/net/cbaines/suma/BuildingNumOverlay.java b/src/net/cbaines/suma/BuildingNumOverlay.java
index c2a9d7c..f11a166 100644
--- a/src/net/cbaines/suma/BuildingNumOverlay.java
+++ b/src/net/cbaines/suma/BuildingNumOverlay.java
@@ -228,6 +228,9 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
}
public boolean onDoubleTap(final MotionEvent event, final MapView mapView) {
+ if (!this.isEnabled())
+ return false;
+
Building building = getSelectedItem(event, mapView);
if (building == null) {
diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java
index 9dd927a..01e8ec6 100644
--- a/src/net/cbaines/suma/MapActivity.java
+++ b/src/net/cbaines/suma/MapActivity.java
@@ -73,8 +73,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
OnItemClickListener, OnItemLongClickListener, OnSharedPreferenceChangeListener, Preferences {
/**
- * Enable to use the database in the assets folder, if its not enabled, the
- * database is built from the csv files in the assets folder
+ * Enable to use the database in the assets folder, if its not enabled, the database is built from the csv files in the assets
+ * folder
*/
private boolean useBundledDatabase = true;
@@ -124,11 +124,10 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
private static final int NON_UNI_LINK_BUS_STOP_OVERLAY_RANK = 4;
// -- Site Overlays
- static final String[] SITE_NAMES = { "Highfield Campus", "Boldrewood Campus", "Avenue Campus",
- "Winchester School of Art", "The University of Southampton Science Park",
- "National Oceanography Centre Campus", "Boat House", "Southampton General Hospital",
- "Royal South Hants Hospital", "Belgrave Industrial Site", "Highfield Hall", "Glen Eyre Hall",
- "South Hill Hall", "Chamberlain Hall", "Hartley Grove", "Bencraft Hall", "Connaught Hall",
+ static final String[] SITE_NAMES = { "Highfield Campus", "Boldrewood Campus", "Avenue Campus", "Winchester School of Art",
+ "The University of Southampton Science Park", "National Oceanography Centre Campus", "Boat House",
+ "Southampton General Hospital", "Royal South Hants Hospital", "Belgrave Industrial Site", "Highfield Hall",
+ "Glen Eyre Hall", "South Hill Hall", "Chamberlain Hall", "Hartley Grove", "Bencraft Hall", "Connaught Hall",
"Montefiore Hall", "Stoneham Hall", "Erasmus Park" };
private static final String SITE_OVERLAYS = "siteOverlays:";
@@ -166,8 +165,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
// Uni-Link routes
static final String[] UNI_LINK_ROUTES = { "U1", "U1N", "U2", "U6", "U9" };
- static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS,
- SITE_OVERLAYS, OTHER_OVERLAYS };
+ static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS, SITE_OVERLAYS,
+ OTHER_OVERLAYS };
static final String[][] PREFERENCES_CHILDREN = { UNI_LINK_ROUTES, UNI_LINK_ROUTES, BUILDING_TYPES, SITE_NAMES,
OTHER_OVERLAY_NAMES };
@@ -199,10 +198,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
pastOverlays = (HashMap<String, Overlay>) getLastNonConfigurationInstance();
/*
- * SensorManager mSensorManager = (SensorManager)
- * getSystemService(Context.SENSOR_SERVICE); This code in the following
- * constructor causes problems in some emulators, disable sensors to
- * fix.
+ * SensorManager mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); This code in the following
+ * constructor causes problems in some emulators, disable sensors to fix.
*/
Log.i(TAG, "Starting creating myLocationOverlay");
myLocationOverlay = new MyLocationOverlay(instance, mapView);
@@ -516,8 +513,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
if (scaleBarOverlay != null) {
Log.v(TAG, "ScaleBarOverlay is already created");
} else {
- if (pastOverlays != null
- && (scaleBarOverlay = (ScaleBarOverlay) pastOverlays.get(SCALE_BAR_OVERLAY)) != null) {
+ if (pastOverlays != null && (scaleBarOverlay = (ScaleBarOverlay) pastOverlays.get(SCALE_BAR_OVERLAY)) != null) {
Log.i(TAG, "Finished restoring utility overlays " + (System.currentTimeMillis() - startTime));
} else {
scaleBarOverlay = new ScaleBarOverlay(instance);
@@ -546,8 +542,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
private void showRouteOverlay(final BusRoute route) {
new Thread(new Runnable() {
public void run() {
- Log.i(TAG, "Begining showing route " + route.code + " overlay at "
- + (System.currentTimeMillis() - startTime));
+ Log.i(TAG, "Begining showing route " + route.code + " overlay at " + (System.currentTimeMillis() - startTime));
final SharedPreferences activityPrefs = getPreferences(0);
final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0));
@@ -572,8 +567,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
// TODO Is this a route like U1N or, something else,
// this hack works somewhat for now?
- PathOverlay routeOverlayU1E = DataManager.getRoutePath(
- getResources().openRawResource(R.raw.u1e), colour, mResourceProxy);
+ PathOverlay routeOverlayU1E = DataManager.getRoutePath(getResources().openRawResource(R.raw.u1e),
+ colour, mResourceProxy);
routeOverlayU1E.getPaint().setAntiAlias(true);
routeOverlayU1E.getPaint().setAlpha(145);
routeOverlayU1E.getPaint().setStrokeWidth(12);
@@ -628,8 +623,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
mapView.postInvalidate();
- Log.i(TAG, "Finished showing route " + route.code + " overlay at "
- + (System.currentTimeMillis() - startTime));
+ Log.i(TAG, "Finished showing route " + route.code + " overlay at " + (System.currentTimeMillis() - startTime));
}
}).start();
}
@@ -638,8 +632,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
new Thread(new Runnable() {
public void run() {
- Log.i(TAG, "Begining showing site " + site.name + " overlay at "
- + (System.currentTimeMillis() - startTime));
+ Log.i(TAG, "Begining showing site " + site.name + " overlay at " + (System.currentTimeMillis() - startTime));
final SharedPreferences activityPrefs = getPreferences(0);
final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0));
@@ -648,8 +641,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
if ((siteOverlay = siteOverlays.get(site)) != null) {
} else {
- if (pastOverlays != null
- && (siteOverlay = (PathOverlay) pastOverlays.get(SITE_OVERLAYS + site.name)) != null) {
+ if (pastOverlays != null && (siteOverlay = (PathOverlay) pastOverlays.get(SITE_OVERLAYS + site.name)) != null) {
Log.i(TAG, "Restored " + site.name + " site overlay");
} else {
@@ -675,13 +667,11 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
}
}
- siteOverlay.setEnabled(activityPrefs.getBoolean(SITE_OVERLAYS + site.name,
- SITE_OVERLAYS_ENABLED_BY_DEFAULT));
+ siteOverlay.setEnabled(activityPrefs.getBoolean(SITE_OVERLAYS + site.name, SITE_OVERLAYS_ENABLED_BY_DEFAULT));
mapView.postInvalidate();
- Log.i(TAG, "Finished showing site " + site.name + " overlay at "
- + (System.currentTimeMillis() - startTime));
+ Log.i(TAG, "Finished showing site " + site.name + " overlay at " + (System.currentTimeMillis() - startTime));
}
}).start();
}
@@ -698,10 +688,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
} else {
if (pastOverlays != null
- && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays
- .get(RESIDENTIAL_BUILDING_OVERLAY)) != null) {
- nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays
- .get(NON_RESIDENTIAL_BUILDING_OVERLAY);
+ && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get(RESIDENTIAL_BUILDING_OVERLAY)) != null) {
+ nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get(NON_RESIDENTIAL_BUILDING_OVERLAY);
Log.i(TAG, "Restored building overlays");
} else {
@@ -716,8 +704,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
buildingDao = getHelper().getBuildingDao();
- final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES,
- MODE_PRIVATE);
+ final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, MODE_PRIVATE);
for (Building building : buildingDao) {
if (building.residential == true) {
@@ -755,8 +742,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
}
}
- residentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS
- + RESIDENTIAL_BUILDING_OVERLAY, RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT));
+ residentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS + RESIDENTIAL_BUILDING_OVERLAY,
+ RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT));
nonResidentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS
+ NON_RESIDENTIAL_BUILDING_OVERLAY, NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT));
@@ -776,16 +763,11 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0));
if (uniLinkBusStopOverlay != null) {
- if (!activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) {
+ if (!activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) {
Log.i(TAG, "Uni-Link bus stop overlay not needed");
overlays.remove(UNI_LINK_BUS_STOP_OVERLAY);
@@ -796,31 +778,25 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
uniLinkBusStopOverlay = null;
} else {
- uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(0,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(1,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(2,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(3,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(4,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
}
} else {
- if (activityPrefs
- .getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
- || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) {
+ if (activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)
+ || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) {
if (pastOverlays != null
- && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays
- .get(UNI_LINK_BUS_STOP_OVERLAY)) != null) {
+ && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays.get(UNI_LINK_BUS_STOP_OVERLAY)) != null) {
Log.i(TAG, "Restored Uni-Link bus stop overlay");
} else {
@@ -838,16 +814,16 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
}
}
- uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9",
- UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(0,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(1,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(2,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(3,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(4,
+ activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
overlays.put(UNI_LINK_BUS_STOP_OVERLAY, uniLinkBusStopOverlay);
@@ -870,8 +846,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
private void showNonUniLinkBusStopOverlay() {
new Thread(new Runnable() {
public void run() {
- Log.i(TAG, "Begining showing non uni link bus stop overlays at "
- + (System.currentTimeMillis() - startTime));
+ Log.i(TAG, "Begining showing non uni link bus stop overlays at " + (System.currentTimeMillis() - startTime));
// final SharedPreferences activityPrefs = getPreferences(0);
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance);
@@ -888,14 +863,12 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
} else if (sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY,
NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) {
if (pastOverlays != null
- && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays
- .get(NON_UNI_LINK_BUS_STOPS_OVERLAY)) != null) {
+ && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays.get(NON_UNI_LINK_BUS_STOPS_OVERLAY)) != null) {
Log.i(TAG, "Restored non Uni-Link bus stop overlays");
} else {
try {
List<BusStop> busStops;
- Log.v(TAG, "Begin fetching non Uni-Link BusStops at "
- + (System.currentTimeMillis() - startTime));
+ Log.v(TAG, "Begin fetching non Uni-Link BusStops at " + (System.currentTimeMillis() - startTime));
busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, false);
@@ -925,8 +898,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
mapView.postInvalidate();
- Log.i(TAG, "Finished showing non Uni-Link bus stop overlays at "
- + (System.currentTimeMillis() - startTime));
+ Log.i(TAG, "Finished showing non Uni-Link bus stop overlays at " + (System.currentTimeMillis() - startTime));
}
}).start();
}
@@ -952,15 +924,11 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
return true;
case R.id.menu_find_my_location:
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+ final SharedPreferences activityPrefs = getPreferences(0);
if (sharedPrefs.getBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT)) {
- myLocationOverlay.enableMyLocation();
- GeoPoint userLocation = myLocationOverlay.getMyLocation();
- sharedPrefs.edit().putBoolean(MY_LOCATION_OVERLAY, true).commit();
- if (userLocation != null) {
- Log.i(TAG, "Found user location, scrolling to " + userLocation);
- mapController.animateTo(userLocation);
- myLocationOverlay.enableFollowLocation();
- }
+ activityPrefs.edit().putBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY, true).commit();
+ myLocationOverlay.enableFollowLocation();
+ mapController.setZoom(18);
} else {
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
@@ -970,15 +938,9 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
editor.putBoolean(GPS_ENABLED, true);
editor.commit();
- myLocationOverlay.enableMyLocation();
- GeoPoint userLocation = myLocationOverlay.getMyLocation();
- sharedPrefs.edit().putBoolean(MY_LOCATION_OVERLAY, true).commit();
- if (userLocation != null) {
- Log.i(TAG, "Found user location, scrolling to " + userLocation);
- mapController.animateTo(userLocation);
- myLocationOverlay.enableFollowLocation();
- }
- break;
+ activityPrefs.edit().putBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY, true).commit();
+ myLocationOverlay.enableFollowLocation();
+ mapController.setZoom(18);
case DialogInterface.BUTTON_NEGATIVE:
// No button clicked
@@ -988,9 +950,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("GPS is not enabled, do you wish to enable it?")
- .setPositiveButton("Yes", dialogClickListener).setNegativeButton("No", dialogClickListener)
- .show();
+ builder.setMessage("GPS is not enabled, do you wish to enable it?").setPositiveButton("Yes", dialogClickListener)
+ .setNegativeButton("No", dialogClickListener).show();
}
return true;
@@ -1338,10 +1299,11 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
if (prefs.getBoolean(key, MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT)
&& sharedPrefs.getBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT)) {
myLocationOverlay.enableMyLocation();
+ myLocationOverlay.setDrawAccuracyEnabled(true);
} else {
myLocationOverlay.disableMyLocation();
+ myLocationOverlay.setDrawAccuracyEnabled(false);
}
- mapView.invalidate();
} else {
Log.e(TAG, "Unhandled preference key " + key);
}