diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-03-15 23:11:36 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-03-15 23:11:36 +0000 |
commit | f80e4dc8d1a08c41f1f892a606865d2507ceb978 (patch) | |
tree | d91604ce1d7c8b928c287f7cda7237fa2abcec4f /src/net/cbaines/suma/MapActivity.java | |
parent | b64d1a19c68a703526460bec8e9a0ea22448b1b5 (diff) | |
download | southamptonuniversitymap-f80e4dc8d1a08c41f1f892a606865d2507ceb978.tar southamptonuniversitymap-f80e4dc8d1a08c41f1f892a606865d2507ceb978.tar.gz |
Possible change to implement the U1E as a route, and not just a hack.
Diffstat (limited to 'src/net/cbaines/suma/MapActivity.java')
-rw-r--r-- | src/net/cbaines/suma/MapActivity.java | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 58c7918..6f712e5 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -573,34 +573,19 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants if (pastOverlays != null && (routeOverlay = (PathOverlay) pastOverlays.get(BUS_ROUTE_OVERLAYS + route.code)) != null) { Log.v(TAG, "Restored " + route.code + " route overlay"); - if (route.code.equals("U1")) { - PathOverlay routeOverlayU1E = (PathOverlay) pastOverlays.get(BUS_ROUTE_OVERLAYS + "U1E"); - overlays.put(BUS_ROUTE_OVERLAYS + "U1E", routeOverlayU1E); - } + } else { InputStream resource = null; int colour = 0; if (route.code.equals("U1")) { resource = getResources().openRawResource(R.raw.u1); colour = U1; - - // 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); - routeOverlayU1E.getPaint().setAntiAlias(true); - routeOverlayU1E.getPaint().setAlpha(145); - routeOverlayU1E.getPaint().setStrokeWidth(12); - routeOverlayU1E.getPaint().setPathEffect(new DashPathEffect(new float[] { 20, 16 }, 0)); - - busRouteOverlays.put(new BusRoute(1000, "U1E", "U1E Route Label", true), routeOverlayU1E); - overlays.put(BUS_ROUTE_OVERLAYS + "U1E", routeOverlayU1E); - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(routeOverlayU1E); - } } else if (route.code.equals("U1N")) { resource = getResources().openRawResource(R.raw.u1n); colour = U1N; + } else if (route.code.equals("U1E")) { + resource = getResources().openRawResource(R.raw.u1e); + colour = U1E; } else if (route.code.equals("U2")) { resource = getResources().openRawResource(R.raw.u2); colour = U2; @@ -616,6 +601,10 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants routeOverlay = DataManager.getRoutePath(resource, colour, mResourceProxy); + if (route.code.equals("U1E")) { + routeOverlay.getPaint().setPathEffect(new DashPathEffect(new float[] { 20, 16 }, 0)); + } + Log.v(TAG, "Path overlay has " + routeOverlay.getNumberOfPoints() + " points"); routeOverlay.getPaint().setAntiAlias(true); @@ -635,10 +624,6 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants routeOverlay.setEnabled(activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + route.code, BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); - if (route.code.equals("U1")) { - overlays.get(BUS_ROUTE_OVERLAYS + "U1E").setEnabled( - activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + "U1", BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); - } mapView.postInvalidate(); |