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.
This commit is contained in:
bspeice 2013-10-28 14:20:22 -04:00
parent 4264fa6fc7
commit 6955ef0b09
3 changed files with 47 additions and 0 deletions

View File

@ -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<ParkingLot, ParkingLocation> listLotLocation(ParkingLot p){
HashMap<ParkingLot, ParkingLocation> mMap = new HashMap<ParkingLot, ParkingLocation>();
mMap.put(p, gds.listLotLocation(p.getLocation().getValue()));
return mMap;
}
public Map<ParkingLot, ParkingLocation> listLotLocation(ParkingChoices c) {
HashMap<ParkingLot, ParkingLocation> mMap = new HashMap<ParkingLot, ParkingLocation>();
ParkingLot mParkingLot = new ParkingLot();
mParkingLot.setLocation(c);
mMap.put(mParkingLot, gds.listLotLocation(c.getValue()));
return mMap;
}
}

View File

@ -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;
}
}

View File

@ -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<ParkingLot> lot);
@GET("/lots/{lot}/")
ParkingLocation listLotLocation(@Path("lot") String lot);
@GET("/register/{id}/")
Attendee getUser(@Path("id") int id);