diff --git a/commons/src/main/java/fr/free/nrw/commons/caching/CacheController.java b/commons/src/main/java/fr/free/nrw/commons/caching/CacheController.java index 1bce5d4c0..13db87430 100644 --- a/commons/src/main/java/fr/free/nrw/commons/caching/CacheController.java +++ b/commons/src/main/java/fr/free/nrw/commons/caching/CacheController.java @@ -1,6 +1,5 @@ package fr.free.nrw.commons.caching; -import android.content.Context; import android.util.Log; import java.util.ArrayList; @@ -29,7 +28,6 @@ public class CacheController { } public void cacheCategory() { - List pointCatList = new ArrayList(); if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true) { pointCatList.addAll(MwVolleyApi.getGpsCat()); @@ -41,7 +39,6 @@ public class CacheController { } public ArrayList findCategory() { - //Convert decLatitude and decLongitude to a coordinate offset range convertCoordRange(); pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus); @@ -51,7 +48,6 @@ public class CacheController { ArrayList flatCatList = new ArrayList(); if (pointsFound.length != 0) { - Log.d(TAG, "Entering for loop"); int index = 0; for (Point point : pointsFound) { @@ -63,6 +59,7 @@ public class CacheController { } //FIXME: temporary, can't figure out why for loop always only accesses 1 point flatCatList = ((ArrayList)displayCatList.get(0)); + Log.d(TAG, "Categories found in cache: " + flatCatList.toString()); } else { Log.d(TAG, "No categories found in cache"); @@ -70,8 +67,6 @@ public class CacheController { return flatCatList; } - - public void convertCoordRange() { //Position, decimal degrees double lat = y; diff --git a/commons/src/main/java/fr/free/nrw/commons/upload/MwVolleyApi.java b/commons/src/main/java/fr/free/nrw/commons/upload/MwVolleyApi.java index 00a38ac02..7b6c78bd6 100644 --- a/commons/src/main/java/fr/free/nrw/commons/upload/MwVolleyApi.java +++ b/commons/src/main/java/fr/free/nrw/commons/upload/MwVolleyApi.java @@ -44,7 +44,6 @@ public class MwVolleyApi { categorySet = new HashSet(); } - //To get the list of categories for display public static List getGpsCat() { return categoryList; } @@ -55,9 +54,7 @@ public class MwVolleyApi { Log.d(TAG, "Setting GPS cats from cache: " + categoryList.toString()); } - public void request(String coords) { - coordsLog = coords; String apiUrl = buildUrl(coords); Log.d("Image", "URL: " + apiUrl); diff --git a/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java b/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java index 6a6aec0be..ea0d5b8b4 100644 --- a/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java +++ b/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java @@ -182,7 +182,6 @@ public class ShareActivity } else { source = Contribution.SOURCE_EXTERNAL; } - mimeType = intent.getType(); } @@ -195,15 +194,11 @@ public class ShareActivity //Using global singleton to get CacheController to last longer than the activity lifecycle cacheObj = ((CommonsApplication)this.getApplication()); - - if (filePath != null) { //extract the coordinates of image in decimal degrees Log.d(TAG, "Calling GPSExtractor"); GPSExtractor imageObj = new GPSExtractor(filePath); - //decimalCoords for MediaWiki API, xyCoords for Quadtree String decimalCoords = imageObj.getCoords(); - double decLongitude = imageObj.getDecLongitude(); double decLatitude = imageObj.getDecLatitude(); @@ -216,14 +211,12 @@ public class ShareActivity List displayCatList = cacheObj.cacheData.findCategory(); //if no categories found in cache, call MW API to match image coords with nearby Commons categories - if (displayCatList.size() == 0) { cacheFound = false; apiCall.request(decimalCoords); Log.d(TAG, "displayCatList size 0, calling MWAPI" + displayCatList.toString()); } else { - //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 cacheFound = true; Log.d(TAG, "Cache found, setting categoryList in MwVolleyApi to " + displayCatList.toString()); MwVolleyApi.setGpsCat(displayCatList);