diff options
Diffstat (limited to 'src/net/cbaines/suma/SouthamptonUniversityMapActivity.java')
-rw-r--r-- | src/net/cbaines/suma/SouthamptonUniversityMapActivity.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java b/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java index f624a43..323c7db 100644 --- a/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java +++ b/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java @@ -114,7 +114,7 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa // Uni-Link Bus Stop Overlay private BusStopOverlay nonUniLinkBusStopOverlay; - private static final boolean NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = true; + private static final boolean NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = false; // Site Overlays private HashMap<Site, PathOverlay> siteOverlays = new HashMap<Site, PathOverlay>(21); @@ -696,6 +696,34 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa } } + if (nonUniLinkBusStopOverlay == null && activityPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS, NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { + if (pastOverlays != null && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays.get("NonUniLinkBusStops")) != null) { + Log.i(TAG, "Restored bus stop overlays"); + } else { + try { + List<BusStop> busStops; + Log.v(TAG, "Begin fetching BusStops at " + (System.currentTimeMillis() - startTime)); + + busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, false); + + Log.v(TAG, "Finished fetching BusStops at " + (System.currentTimeMillis() - startTime)); + + nonUniLinkBusStopOverlay = new BusStopOverlay(instance, busStops); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + overlays.put("BusStops", nonUniLinkBusStopOverlay); + + Log.v(TAG, "Applyed the site overlay, now sorting them"); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(nonUniLinkBusStopOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } + } + uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean("Bus Stops:U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean("Bus Stops:U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean("Bus Stops:U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); |