Minor formatting/logging changes

This commit is contained in:
misaochan 2016-01-02 00:42:34 +13:00
parent 75e3da7ea2
commit cf6b5f3471
2 changed files with 5 additions and 12 deletions

View file

@ -150,7 +150,6 @@ public class CategorizationFragment extends SherlockFragment{
Category cat = Category.fromCursor(cursor);
items.add(cat.getName());
}
if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true){
Log.d("Cat", "GPS cats found in CategorizationFragment.java" + MwVolleyApi.getGpsCat().toString());
List<String> gpsItems = new ArrayList<String>(MwVolleyApi.getGpsCat());
@ -158,10 +157,8 @@ public class CategorizationFragment extends SherlockFragment{
mergedItems.addAll(gpsItems);
}
mergedItems.addAll(items);
}
catch (RemoteException e) {
} catch (RemoteException e) {
// faaaail
throw new RuntimeException(e);
}
@ -172,9 +169,11 @@ public class CategorizationFragment extends SherlockFragment{
if(categoriesCache.containsKey(filter)) {
return categoriesCache.get(filter);
}
MWApi api = CommonsApplication.createMWApi();
ApiResult result;
ArrayList<String> categories = new ArrayList<String>();
try {
result = api.action("query")
.param("list", "allcategories")
@ -189,9 +188,7 @@ public class CategorizationFragment extends SherlockFragment{
for(ApiResult categoryNode: categoryNodes) {
categories.add(categoryNode.getDocument().getTextContent());
}
categoriesCache.put(filter, categories);
return categories;
}
}

View file

@ -29,7 +29,6 @@ public class MwVolleyApi {
private static RequestQueue REQUEST_QUEUE;
private static final Gson GSON = new GsonBuilder().create();
private Context context;
private String coordsLog;
protected static Set<String> categorySet;
@ -48,17 +47,15 @@ public class MwVolleyApi {
public void request(String coords) {
coordsLog = coords;
//If <10 categories found, repeat API call with incremented radius
for (int radius=100; radius<=10000; radius=radius*10) {
String apiUrl = buildUrl(coords, radius);
Log.d("Image", "URL: " + apiUrl);
Log.d("Repeat", "URL: " + apiUrl);
JsonRequest<QueryResponse> request = new QueryRequest(apiUrl,
new LogResponseListener<QueryResponse>(), new LogResponseErrorListener());
getQueue().add(request);
Log.d("Image", "Repeating API call with radius " + Integer.toString(radius));
Log.d("Repeat", "Repeating API call with radius " + Integer.toString(radius));
if (categorySet.size()>=10) {
break;
@ -136,7 +133,6 @@ public class MwVolleyApi {
@Override
protected Response<QueryResponse> parseNetworkResponse(NetworkResponse response) {
String json = parseString(response);
//Log.d(TAG, "json=" + json);
QueryResponse queryResponse = GSON.fromJson(json, QueryResponse.class);
return Response.success(queryResponse, cacheEntry(response));
}