1
0
mirror of https://github.com/bspeice/itcs4180 synced 2024-12-04 21:28:10 -05:00

RestLocations created correctly from the server.

This commit is contained in:
Bradlee Speice 2014-04-21 09:40:24 -04:00
parent 6e2ad36f09
commit 60062298bc
4 changed files with 15 additions and 6 deletions

View File

@ -53,6 +53,7 @@ public class MainActivity extends Activity {
/*End Test Code*/ /*End Test Code*/
// And kick off contacting to server to see if there are any new ones // And kick off contacting to server to see if there are any new ones
locationList = (ListView)findViewById(R.id.listLocations);
new LocationClient.LocationsDownloader(this) { new LocationClient.LocationsDownloader(this) {
@Override @Override
protected void onPostExecute(List<RestLocation> result) { protected void onPostExecute(List<RestLocation> result) {

View File

@ -138,7 +138,7 @@ public class SearchActivity extends Activity {
} }
else else
{ {
new ImageDownloader().execute(restLocation.getRiddleImageURL()); new ImageDownloader().execute(restLocation.getRiddleImageUrl());
} }
} }

View File

@ -11,7 +11,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit.RestAdapter; import retrofit.RestAdapter;
import retrofit.converter.GsonConverter;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import edu.uncc.scavenger.R; import edu.uncc.scavenger.R;
@ -20,7 +25,10 @@ public class LocationClient {
private static LocationService getAdapter(Context ctx) { private static LocationService getAdapter(Context ctx) {
String endpoint = ctx.getString(R.string.endpoint); String endpoint = ctx.getString(R.string.endpoint);
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.create();
RestAdapter ra = new RestAdapter.Builder().setEndpoint(endpoint) RestAdapter ra = new RestAdapter.Builder().setEndpoint(endpoint)
.setConverter(new GsonConverter(gson))
.build(); .build();
return ra.create(LocationService.class); return ra.create(LocationService.class);
} }

View File

@ -18,7 +18,7 @@ public class RestLocation implements Serializable{
private String riddle; private String riddle;
private double locationLong; private double locationLong;
private double locationLat; private double locationLat;
private String riddleImageURL; private String riddleImageUrl;
private String key; private String key;
public int getId() { public int getId() {
@ -57,11 +57,11 @@ public class RestLocation implements Serializable{
public void setKey(String key) { public void setKey(String key) {
this.key = key; this.key = key;
} }
public String getRiddleImageURL() { public String getRiddleImageUrl() {
return riddleImageURL; return riddleImageUrl;
} }
public void setRiddleImageURL(String riddleImageURL) { public void setRiddleImageUrl(String riddleImageUrl) {
this.riddleImageURL = riddleImageURL; this.riddleImageUrl = riddleImageUrl;
} }
public Location getLocation() { public Location getLocation() {