mirror of
https://github.com/bspeice/UNCCGameDay
synced 2024-11-05 07:38:13 -05:00
Get the rate lot function working correctly.
It's a bit funky - requests seem to hit the server about 90% of the time...
This commit is contained in:
parent
e12b47fe4c
commit
250db4a1f9
@ -7,6 +7,7 @@
|
|||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="11"
|
android:minSdkVersion="11"
|
||||||
android:targetSdkVersion="17" />
|
android:targetSdkVersion="17" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<string name="university_handle">unccharlotte</string>
|
<string name="university_handle">unccharlotte</string>
|
||||||
<string name="db_path">Gameday.sqlite</string>
|
<string name="db_path">Gameday.sqlite</string>
|
||||||
<string name="preferences_file">GamedayPreferences</string>
|
<string name="preferences_file">GamedayPreferences</string>
|
||||||
<string name="server_hostname">uncc-gameday.no-ip.org</string>
|
<string name="server_hostname">10.0.1.12</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -2,6 +2,7 @@ package com.uncc.gameday.registration;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import retrofit.Callback;
|
||||||
import retrofit.http.*;
|
import retrofit.http.*;
|
||||||
|
|
||||||
public interface GamedayService {
|
public interface GamedayService {
|
||||||
@ -12,7 +13,7 @@ public interface GamedayService {
|
|||||||
@GET("/lots/{lot}/")
|
@GET("/lots/{lot}/")
|
||||||
ParkingLot listLot(@Path("lot") String lot);
|
ParkingLot listLot(@Path("lot") String lot);
|
||||||
|
|
||||||
@POST("/rating/")
|
@POST("/rate/")
|
||||||
void rateLot(@Body RatingChoices rating, @Body ParkingChoices parking_lot);
|
void rateLot(@Body ParkingRating p, Callback<ParkingLot> lot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.uncc.gameday.registration;
|
package com.uncc.gameday.registration;
|
||||||
|
|
||||||
public class ParkingRating {
|
public class ParkingRating {
|
||||||
private ParkingChoices parking_lot;
|
private ParkingChoices parking_lot;
|
||||||
private RatingChoices rating;
|
private RatingChoices rating;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.uncc.gameday.registration;
|
package com.uncc.gameday.registration;
|
||||||
|
|
||||||
public enum RatingChoices {
|
public enum RatingChoices {
|
||||||
EMPTY ("EMP"),
|
EMP ("EMPTY"),
|
||||||
SCATTERED ("SCT"),
|
SCT ("SCATTERED"),
|
||||||
BUSY ("BSY"),
|
BSY ("BUSY"),
|
||||||
FULL ("FLL");
|
FLL ("FULL");
|
||||||
|
|
||||||
String choice;
|
String choice;
|
||||||
RatingChoices(String choice) { this.choice = choice; }
|
RatingChoices(String choice) { this.choice = choice; }
|
||||||
|
@ -2,12 +2,11 @@ package com.uncc.gameday.registration;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.uncc.gameday.R;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
import retrofit.RestAdapter;
|
import retrofit.RestAdapter;
|
||||||
import retrofit.RetrofitError;
|
import retrofit.RestAdapter.LogLevel;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.uncc.gameday.R;
|
||||||
|
|
||||||
public class RegistrationClient {
|
public class RegistrationClient {
|
||||||
|
|
||||||
@ -33,11 +32,14 @@ public class RegistrationClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void rateLot(RatingChoices rating, ParkingChoices parkingLot) {
|
public void rateLot(RatingChoices rating, ParkingChoices parkingLot) {
|
||||||
gds.rateLot(rating, parkingLot);
|
ParkingRating pRating = new ParkingRating();
|
||||||
|
pRating.setParkingLot(parkingLot);
|
||||||
|
pRating.setRating(rating);
|
||||||
|
gds.rateLot(pRating, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rateLot(ParkingRating rating) {
|
public void rateLot(ParkingRating rating) {
|
||||||
gds.rateLot(rating.getRating(), rating.getParkingLot());
|
gds.rateLot(rating, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user