Back to solving repeat calls bug

This commit is contained in:
misaochan 2016-01-02 18:41:04 +13:00
parent b13c162a2e
commit abc7555b82

View file

@ -29,7 +29,7 @@ public class MwVolleyApi {
private static RequestQueue REQUEST_QUEUE; private static RequestQueue REQUEST_QUEUE;
private static final Gson GSON = new GsonBuilder().create(); private static final Gson GSON = new GsonBuilder().create();
private Context context; private Context context;
private String coordsLog; private static String coordsLog;
protected static Set<String> categorySet; protected static Set<String> categorySet;
@ -48,7 +48,7 @@ public class MwVolleyApi {
* Example URL: https://commons.wikimedia.org/w/api.php?action=query&prop=categories|coordinates|pageprops&format=json&clshow=!hidden&coprop=type|name|dim|country|region|globe&codistancefrompoint=38.11386944444445|13.356263888888888& * Example URL: https://commons.wikimedia.org/w/api.php?action=query&prop=categories|coordinates|pageprops&format=json&clshow=!hidden&coprop=type|name|dim|country|region|globe&codistancefrompoint=38.11386944444445|13.356263888888888&
* generator=geosearch&redirects=&ggscoord=38.11386944444445|13.356263888888888&ggsradius=100&ggslimit=10&ggsnamespace=6&ggsprop=type|name|dim|country|region|globe&ggsprimary=all&formatversion=2 * generator=geosearch&redirects=&ggscoord=38.11386944444445|13.356263888888888&ggsradius=100&ggslimit=10&ggsnamespace=6&ggsprop=type|name|dim|country|region|globe&ggsprimary=all&formatversion=2
*/ */
private String buildUrl(int ggsradius) { private static String buildUrl(int ggsradius) {
Uri.Builder builder = Uri.parse(MWURL).buildUpon(); Uri.Builder builder = Uri.parse(MWURL).buildUpon();
@ -86,7 +86,6 @@ public class MwVolleyApi {
} }
private synchronized RequestQueue getQueue() { private synchronized RequestQueue getQueue() {
return getQueue(context); return getQueue(context);
} }
@ -112,10 +111,11 @@ public class MwVolleyApi {
String apiUrl = buildUrl(radius); String apiUrl = buildUrl(radius);
Log.d("Repeat", "URL: " + apiUrl); Log.d("Repeat", "URL: " + apiUrl);
Log.d("Repeat", "Repeating API call with radius " + Integer.toString(radius)); Log.d("Repeat", "Repeating API call with radius " + Integer.toString(radius));
//request(); //request();
//JsonRequest<QueryResponse> request = new QueryRequest(apiUrl, new LogResponseListener<QueryResponse>(), new LogResponseErrorListener()); //JsonRequest<QueryResponse> request = new QueryRequest(apiUrl, new LogResponseListener<QueryResponse>(), new LogResponseErrorListener());
//getQueue().add(request); //MwVolleyApi.getQueue(context).add(request);
if (categorySet.size() >= 10) { if (categorySet.size() >= 10) {
break; break;
@ -255,7 +255,7 @@ public class MwVolleyApi {
} }
} }
} }
}