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);
}
public List<Location> getLocations() {
public List<RestLocation> getLocations() {
try {
// Inline AsyncTask
return new AsyncTask<Void, Void, List<Location>>() {
return new AsyncTask<Void, Void, List<RestLocation>>() {
@Override
protected List<Location> doInBackground(Void... params) {
protected List<RestLocation> doInBackground(Void... params) {
// Work happens here
return getAdapter().listLocations();
}

View File

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

View File

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