aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-01-06 11:42:24 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-01-06 11:42:24 +0000
commit762926b29c11459a6c4f4519343565c2258ac11c (patch)
tree9f33093fff88022e721e52ef2f344d41e289262c /src
parent9c08b26fd465583db317cc68dde9c2d95f8d8733 (diff)
downloadsouthamptonuniversitymap-762926b29c11459a6c4f4519343565c2258ac11c.tar
southamptonuniversitymap-762926b29c11459a6c4f4519343565c2258ac11c.tar.gz
Fixed two bugs relating to device rotation.
Diffstat (limited to 'src')
-rw-r--r--src/net/cbaines/suma/SouthamptonUniversityMapActivity.java91
1 files changed, 45 insertions, 46 deletions
diff --git a/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java b/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java
index 4811ba0..7321142 100644
--- a/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java
+++ b/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java
@@ -460,6 +460,10 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
} else {
if (pastOverlays != null && (routeOverlay = (PathOverlay) pastOverlays.get("Bus Routes:" + route.code)) != null) {
Log.v(TAG, "Restored " + route.code + " route overlay");
+ if (route.code.equals("U1")) {
+ PathOverlay routeOverlayU1E = (PathOverlay) pastOverlays.get("Bus Routes:U1E");
+ overlays.put("Bus Routes:U1E", routeOverlayU1E);
+ }
} else {
InputStream resource = null;
int colour = 0;
@@ -583,66 +587,61 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
if (residentialBuildingOverlay != null) {
} else {
- try {
- Log.v(TAG, "Begining the creation of the building overlays");
+ if (pastOverlays != null && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get("Buildings:Residential")) != null) {
+ nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get("Buildings:Non-Residential");
- if (pastOverlays != null) {
- residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get("Buildings:Residential");
- nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get("Buildings:Non-Residential");
- if (residentialBuildingOverlay != null && nonResidentialBuildingOverlay != null) {
- overlays.put("Buildings:Residential", residentialBuildingOverlay);
- overlays.put("Buildings:-Non-Residential", nonResidentialBuildingOverlay);
+ Log.i(TAG, "Restored building overlays");
+ } else {
+ try {
- Log.i(TAG, "Restored building overlays");
- return;
- }
- }
+ Log.v(TAG, "Begining the creation of the building overlays");
- ArrayList<Building> residentialBuildings = new ArrayList<Building>();
- ArrayList<Building> nonResidentialBuildings = new ArrayList<Building>();
+ ArrayList<Building> residentialBuildings = new ArrayList<Building>();
+ ArrayList<Building> nonResidentialBuildings = new ArrayList<Building>();
- Dao<Building, String> buildingDao;
+ Dao<Building, String> buildingDao;
- buildingDao = getHelper().getBuildingDao();
+ buildingDao = getHelper().getBuildingDao();
- for (Building building : buildingDao) {
- // Log.v(TAG, "Looking at building " + building.id);
- if (building.residential == true) {
- // Log.v(TAG, "Its residential");
- if (building.favourite) {
- // Log.v(TAG, "Its residential and a favourite");
- residentialBuildings.add(building);
+ for (Building building : buildingDao) {
+ // Log.v(TAG, "Looking at building " + building.id);
+ if (building.residential == true) {
+ // Log.v(TAG, "Its residential");
+ if (building.favourite) {
+ // Log.v(TAG, "Its residential and a favourite");
+ residentialBuildings.add(building);
+ } else {
+ // Log.v(TAG, "Its residential and not a favourite");
+ residentialBuildings.add(0, building);
+ }
} else {
- // Log.v(TAG, "Its residential and not a favourite");
- residentialBuildings.add(0, building);
- }
- } else {
- if (building.favourite) {
- // Log.v(TAG, "Its not residential and a favourite");
- nonResidentialBuildings.add(building);
- } else {
- // Log.v(TAG, "Its not residential and not a favourite");
- nonResidentialBuildings.add(0, building);
+ if (building.favourite) {
+ // Log.v(TAG, "Its not residential and a favourite");
+ nonResidentialBuildings.add(building);
+ } else {
+ // Log.v(TAG, "Its not residential and not a favourite");
+ nonResidentialBuildings.add(0, building);
+ }
}
}
- }
- residentialBuildingOverlay = new BuildingNumOverlay(instance, residentialBuildings);
- nonResidentialBuildingOverlay = new BuildingNumOverlay(instance, nonResidentialBuildings);
+ residentialBuildingOverlay = new BuildingNumOverlay(instance, residentialBuildings);
+ nonResidentialBuildingOverlay = new BuildingNumOverlay(instance, nonResidentialBuildings);
- overlays.put("Buildings:Residential", residentialBuildingOverlay);
- overlays.put("Buildings:Non-Residential", nonResidentialBuildingOverlay);
+ Log.v(TAG, "Applyed the site overlay, now sorting them");
- Log.v(TAG, "Applyed the site overlay, now sorting them");
-
- synchronized (mapView.getOverlays()) {
- mapView.getOverlays().add(residentialBuildingOverlay);
- mapView.getOverlays().add(nonResidentialBuildingOverlay);
- Collections.sort(mapView.getOverlays(), comparator);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
+ }
- } catch (SQLException e) {
- e.printStackTrace();
+ overlays.put("Buildings:Residential", residentialBuildingOverlay);
+ overlays.put("Buildings:Non-Residential", nonResidentialBuildingOverlay);
+
+ synchronized (mapView.getOverlays()) {
+ mapView.getOverlays().add(residentialBuildingOverlay);
+ mapView.getOverlays().add(nonResidentialBuildingOverlay);
+ Collections.sort(mapView.getOverlays(), comparator);
}
}