private void navigateDetailsPage(Location loc) { if (loc.getId() <= 0) throw new RuntimeException("Bad Location ID"); Intent i; switch (loc.getlType()) { case RESTAURANTS: i = new Intent(this, FoodInfo.class); break; case SHUTTLES: i = new Intent(this, ShuttleInfo.class); break; case ESCORTS: i = new Intent(this, EscortInfo.class); break; case ROOMS: i = new Intent(this, RoomInfo.class); break; case SERVICES: i = new Intent(this, OtherInfo.class); break; default: i = new Intent(this, BakerInfo.class); } i.putExtra("lID", loc.getId()); this.startActivity(i); }
private void buildSearchComponents() { ArrayList<Location> locs; DBAdapter adp = new DBAdapter(this); try { adp.createDataBase(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } adp.openDataBase(); locs = adp.getAllLocations(); adp.close(); AC_PLACES = new String[locs.size()]; int i = 0; for (Location l : locs) { AC_PLACES[i] = l.getName(); i++; } }
private void buildSubCategories() { DBAdapter adp = new DBAdapter(this); try { adp.createDataBase(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } adp.openDataBase(); int i = 0; /*for(Building b: adp.getBuildings()){ if(i>= 3) break; SUBPLACES[0][i] = b.getName(); LOCATIONS[0][i] = b; i++; }*/ Building b = adp.getBuilding(1); SUBPLACES[0][0] = b.getName(); LOCATIONS[0][0] = b; b = adp.getBuilding(6); SUBPLACES[0][1] = b.getName(); LOCATIONS[0][1] = b; b = adp.getBuilding(2); SUBPLACES[0][2] = b.getName(); LOCATIONS[0][2] = b; SUBPLACES[0][3] = "More..."; /* i=0; for(Restaurant r:adp.getRestaurants()){ if(i>= 3) break; SUBPLACES[1][i] = r.getName(); LOCATIONS[1][i] = r; i++; } */ Restaurant r = adp.getRestaurant(37); SUBPLACES[1][0] = r.getName(); LOCATIONS[1][0] = r; r = adp.getRestaurant(25); SUBPLACES[1][1] = r.getName(); LOCATIONS[1][1] = r; r = adp.getRestaurant(39); SUBPLACES[1][2] = r.getName(); LOCATIONS[1][2] = r; SUBPLACES[1][3] = "More..."; /* i=0; for(Room h:adp.getRooms()){ if(i>= 3) break; SUBPLACES[2][i] = h.getName(); LOCATIONS[2][i] = h; i++; } */ Room h = adp.getRoom(126); SUBPLACES[2][0] = h.getName(); LOCATIONS[2][0] = h; h = adp.getRoom(114); SUBPLACES[2][1] = h.getName(); LOCATIONS[2][1] = h; h = adp.getRoom(120); SUBPLACES[2][2] = h.getName(); LOCATIONS[2][2] = h; SUBPLACES[2][3] = "More..."; i = 0; for (Service s : adp.getServices()) { if (i >= 3) break; SUBPLACES[3][i] = s.getName(); LOCATIONS[3][i] = s; i++; } SUBPLACES[3][i] = "More..."; i = 0; for (Location e : adp.getOther()) { if (i >= 3) break; SUBPLACES[4][i] = e.getName(); LOCATIONS[4][i] = e; i++; } SUBPLACES[4][i] = "More..."; adp.close(); }