mirror of
				https://github.com/bspeice/itcs4180
				synced 2025-11-04 02:10:32 -05:00 
			
		
		
		
	Refactor some weird naming conventions for locations
This commit is contained in:
		@ -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();
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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());
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user