mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Minor formatting/logging changes
This commit is contained in:
parent
75e3da7ea2
commit
cf6b5f3471
2 changed files with 5 additions and 12 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue