ResponseListener changed to non static

To be able to access non static setRadius() method of MwVolley
This commit is contained in:
misaochan 2016-01-03 15:18:35 +13:00
parent 021c17166a
commit a967ecfce4
2 changed files with 9 additions and 6 deletions

View file

@ -26,7 +26,7 @@ public class MwVolley {
private String coords;
private static final String MWURL = "https://commons.wikimedia.org/";
private String apiUrl;
private int radius;
private int radius = 100;
private Gson GSON;
protected Set<String> categorySet;
@ -83,7 +83,7 @@ public class MwVolley {
radius = getRadius();
apiUrl = buildUrl(radius);
ShareActivity.ResponseListener responseListener = new ShareActivity.ResponseListener();
ShareActivity.ResponseListener responseListener = new ShareActivity().new ResponseListener();
ShareActivity.ErrorListener errorListener = new ShareActivity.ErrorListener();
JsonRequest request = new QueryRequest(apiUrl, responseListener, errorListener);

View file

@ -52,6 +52,8 @@ public class ShareActivity
private UploadController uploadController;
private MwVolley apiCall;
public ShareActivity() {
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
}
@ -195,7 +197,7 @@ public class ShareActivity
Log.d("Image", "Coords of image: " + coords);
MwVolleyApi apiCall = new MwVolleyApi(this, coords);
apiCall = new MwVolley(this, coords);
//asynchronous calls to MediaWiki Commons API to match image coords with nearby Commons categories
apiCall.request();
@ -211,16 +213,17 @@ public class ShareActivity
requestAuthToken();
}
protected static class ResponseListener<T> implements Response.Listener<T>{
protected class ResponseListener<T> implements Response.Listener<T>{
@Override
public void onResponse(T response){
apiCall.setRadius(1000);
}
}
protected static class ErrorListener implements Response.ErrorListener {
protected class ErrorListener implements Response.ErrorListener {
private static final String TAG = ErrorListener.class.getName();
private final String TAG = ErrorListener.class.getName();
@Override
public void onErrorResponse(VolleyError error) {