From 6955ef0b093fe64ea8365af402effe4be03cc5f8 Mon Sep 17 00:00:00 2001 From: bspeice Date: Mon, 28 Oct 2013 14:20:22 -0400 Subject: [PATCH] Add code to grab parking lot locations from the server Hindsight being what it is, this would have been just as easy to write client-side. May end up doing that. --- .../uncc/gameday/parking/ParkingClient.java | 16 +++++++++++ .../uncc/gameday/parking/ParkingLocation.java | 27 +++++++++++++++++++ src/com/uncc/gameday/rest/GamedayService.java | 4 +++ 3 files changed, 47 insertions(+) create mode 100644 src/com/uncc/gameday/parking/ParkingLocation.java diff --git a/src/com/uncc/gameday/parking/ParkingClient.java b/src/com/uncc/gameday/parking/ParkingClient.java index d25e217..8f34745 100644 --- a/src/com/uncc/gameday/parking/ParkingClient.java +++ b/src/com/uncc/gameday/parking/ParkingClient.java @@ -1,6 +1,8 @@ package com.uncc.gameday.parking; +import java.util.HashMap; import java.util.List; +import java.util.Map; import retrofit.RestAdapter; import android.content.Context; @@ -41,4 +43,18 @@ public class ParkingClient { public void rateLot(ParkingRating rating) { gds.rateLot(rating, new ParkingLotCallback()); } + + public Map listLotLocation(ParkingLot p){ + HashMap mMap = new HashMap(); + mMap.put(p, gds.listLotLocation(p.getLocation().getValue())); + return mMap; + } + + public Map listLotLocation(ParkingChoices c) { + HashMap mMap = new HashMap(); + ParkingLot mParkingLot = new ParkingLot(); + mParkingLot.setLocation(c); + mMap.put(mParkingLot, gds.listLotLocation(c.getValue())); + return mMap; + } } diff --git a/src/com/uncc/gameday/parking/ParkingLocation.java b/src/com/uncc/gameday/parking/ParkingLocation.java new file mode 100644 index 0000000..28a44c6 --- /dev/null +++ b/src/com/uncc/gameday/parking/ParkingLocation.java @@ -0,0 +1,27 @@ +package com.uncc.gameday.parking; + +public class ParkingLocation { + + private int latitude; + private int longitude; + private String label; + + public int getLatitude() { + return latitude; + } + public void setLatitude(int latitude) { + this.latitude = latitude; + } + public int getLongitude() { + return longitude; + } + public void setLongitude(int longitude) { + this.longitude = longitude; + } + public String getLabel() { + return label; + } + public void setLabel(String label) { + this.label = label; + } +} diff --git a/src/com/uncc/gameday/rest/GamedayService.java b/src/com/uncc/gameday/rest/GamedayService.java index e573fc7..f485ef7 100644 --- a/src/com/uncc/gameday/rest/GamedayService.java +++ b/src/com/uncc/gameday/rest/GamedayService.java @@ -2,6 +2,7 @@ package com.uncc.gameday.rest; import java.util.List; +import com.uncc.gameday.parking.ParkingLocation; import com.uncc.gameday.parking.ParkingLot; import com.uncc.gameday.parking.ParkingRating; import com.uncc.gameday.registration.Attendee; @@ -20,6 +21,9 @@ public interface GamedayService { @POST("/lots/rate/") void rateLot(@Body ParkingRating p, Callback lot); + @GET("/lots/{lot}/") + ParkingLocation listLotLocation(@Path("lot") String lot); + @GET("/register/{id}/") Attendee getUser(@Path("id") int id);