mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Flattened category list found in cache
This commit is contained in:
parent
46af717e40
commit
d2f765daec
3 changed files with 12 additions and 6 deletions
|
|
@ -38,14 +38,15 @@ public class CacheController {
|
|||
quadTree.set(x, y, pointCatList);
|
||||
}
|
||||
|
||||
public List findCategory() {
|
||||
public ArrayList findCategory() {
|
||||
|
||||
//Convert decLatitude and decLongitude to a coordinate offset range
|
||||
convertCoordRange();
|
||||
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
|
||||
List displayCatList = new ArrayList();
|
||||
ArrayList displayCatList = new ArrayList();
|
||||
Log.d("Cache", "Points found in quadtree: " + pointsFound);
|
||||
|
||||
ArrayList<String> flatCatList = null;
|
||||
//TODO: Make this return a proper flat array
|
||||
if (pointsFound.length != 0) {
|
||||
|
||||
|
|
@ -58,13 +59,17 @@ public class CacheController {
|
|||
displayCatList.add(index, cat);
|
||||
index++;
|
||||
}
|
||||
Log.d("Cache", "Categories found in cache: " + displayCatList.toString());
|
||||
//FIXME: temporary, can't figure out why for loop always only accesses 1 point
|
||||
flatCatList = ((ArrayList<String>)displayCatList.get(0));
|
||||
Log.d("Cache", "Categories found in cache: " + flatCatList.toString());
|
||||
} else {
|
||||
Log.d("Cache", "No categories found in cache");
|
||||
}
|
||||
return displayCatList;
|
||||
return flatCatList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void convertCoordRange() {
|
||||
//Position, decimal degrees
|
||||
double lat = y;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class MwVolleyApi {
|
|||
|
||||
public static void setGpsCat(List cachedList) {
|
||||
categoryList = new ArrayList<String>(cachedList);
|
||||
Log.d("Cache", "Setting GPS cats from cache: " + categoryList.toString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -213,9 +213,9 @@ public class ShareActivity
|
|||
//if no categories found in cache, call MW API to match image coords with nearby Commons categories
|
||||
if (displayCatList.size() == 0) {
|
||||
apiCall.request(decimalCoords);
|
||||
Log.d("Cache", "displayCatList size 0, calling MWAPI");
|
||||
Log.d("Cache", "displayCatList size 0, calling MWAPI" + displayCatList.toString());
|
||||
} else {
|
||||
//TODO: Set categoryList in MwVolleyApi. Not filling up right. Maybe do global singleton for MwVolleyApi
|
||||
//TODO: Set categoryList in MwVolleyApi. Not filling up right. Maybe do global singleton for MwVolleyApi? Can't do that, we want new cats for each upload, so new instance of mwapi
|
||||
MwVolleyApi.setGpsCat(displayCatList);
|
||||
Log.d("Cache", "Cache found, setting categoryList in MwVolleyApi to " + displayCatList.toString());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue