From 762926b29c11459a6c4f4519343565c2258ac11c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 6 Jan 2012 11:42:24 +0000 Subject: Fixed two bugs relating to device rotation. --- .../suma/SouthamptonUniversityMapActivity.java | 91 +++++++++++----------- 1 file 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 residentialBuildings = new ArrayList(); - ArrayList nonResidentialBuildings = new ArrayList(); + ArrayList residentialBuildings = new ArrayList(); + ArrayList nonResidentialBuildings = new ArrayList(); - Dao buildingDao; + Dao 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); } } -- cgit v1.2.3