mirror of
https://github.com/bspeice/itcs4180
synced 2025-04-20 23:01:34 -04:00
Refactor some weird naming conventions for locations
This commit is contained in:
parent
ba882dfa8f
commit
c81decd705
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user