Refactor some weird naming conventions for locations

master
DjBushido 2014-04-08 19:56:41 -04:00
parent ba882dfa8f
commit c81decd705
3 changed files with 10 additions and 8 deletions

View File

@ -33,12 +33,12 @@ public class LocationClient {
return client.getResult(keys); return client.getResult(keys);
} }
public List<Location> getLocations() { public List<RestLocation> getLocations() {
try { try {
// Inline AsyncTask // Inline AsyncTask
return new AsyncTask<Void, Void, List<Location>>() { return new AsyncTask<Void, Void, List<RestLocation>>() {
@Override @Override
protected List<Location> doInBackground(Void... params) { protected List<RestLocation> doInBackground(Void... params) {
// Work happens here // Work happens here
return getAdapter().listLocations(); return getAdapter().listLocations();
} }

View File

@ -9,7 +9,7 @@ import retrofit.http.QueryMap;
public interface LocationService { public interface LocationService {
@GET("/locations") @GET("/locations")
List<Location> listLocations(); List<RestLocation> listLocations();
@GET("/validate") @GET("/validate")
String getResult(@QueryMap Map<String, String> keys); String getResult(@QueryMap Map<String, String> keys);

View File

@ -1,6 +1,8 @@
package edu.uncc.scavenger.rest; package edu.uncc.scavenger.rest;
public class Location { import android.location.Location;
public class RestLocation {
private int id; private int id;
private String name; private String name;
@ -39,14 +41,14 @@ public class Location {
this.locationLat = locationLat; this.locationLat = locationLat;
} }
private android.location.Location getAndroidLocation() { public Location getLocation() {
android.location.Location mLocation = new android.location.Location("NinerFinderServer"); android.location.Location mLocation = new android.location.Location("NinerFinderServer");
mLocation.setLatitude(getLocationLat()); mLocation.setLatitude(getLocationLat());
mLocation.setLongitude(getLocationLong()); mLocation.setLongitude(getLocationLong());
return mLocation; return mLocation;
} }
public float bearingTo(Location target) { public float bearingTo(RestLocation target) {
return getAndroidLocation().bearingTo(target.getAndroidLocation()); return getLocation().bearingTo(target.getLocation());
} }
} }