From cea007421b2a1ee1ec2f8b2d094a1023b288a26b Mon Sep 17 00:00:00 2001 From: DjBushido Date: Sat, 5 Apr 2014 17:04:33 -0400 Subject: [PATCH] The LocationClient shouldn't be static. --- .../edu/uncc/scavenger/rest/LocationClient.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java b/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java index fbf2bbe..34180e7 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java @@ -11,24 +11,28 @@ import retrofit.RestAdapter; public class LocationClient { + private Context ctx; + public LocationClient(Context ctx) { + this.ctx = ctx; + } - public static LocationService getAdapter(Context ctx) { + public LocationService getAdapter() { String endpoint = ctx.getString(R.string.endpoint); RestAdapter ra = new RestAdapter.Builder().setEndpoint(endpoint).build(); return ra.create(LocationService.class); } - public static String validateLocation(Context ctx, int id, String key) { - LocationService client = getAdapter(ctx); + public String validateLocation(int id, String key) { + LocationService client = getAdapter(); Map keys = new HashMap(); keys.put("key", key); keys.put("id", String.valueOf(id)); return client.getResult(keys); } - public static List getLocations(Context ctx) { - LocationService client = getAdapter(ctx); + public List getLocations(Context ctx) { + LocationService client = getAdapter(); return client.listLocations(); } }