mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Replaced TAGs in logs
This commit is contained in:
parent
207ee2bfac
commit
9c58e28371
3 changed files with 28 additions and 18 deletions
|
|
@ -15,6 +15,8 @@ public class CacheController {
|
|||
private Point[] pointsFound;
|
||||
private double xMinus, xPlus, yMinus, yPlus;
|
||||
|
||||
private static final String TAG = CacheController.class.getName();
|
||||
|
||||
public CacheController() {
|
||||
quadTree = new QuadTree(-180, -90, +180, +90);
|
||||
}
|
||||
|
|
@ -22,8 +24,8 @@ public class CacheController {
|
|||
public void setQtPoint(double decLongitude, double decLatitude) {
|
||||
x = decLongitude;
|
||||
y = decLatitude;
|
||||
Log.d("Cache", "New QuadTree created");
|
||||
Log.d("Cache", "X (longitude) value: " + x + ", Y (latitude) value: " + y);
|
||||
Log.d(TAG, "New QuadTree created");
|
||||
Log.d(TAG, "X (longitude) value: " + x + ", Y (latitude) value: " + y);
|
||||
}
|
||||
|
||||
public void cacheCategory() {
|
||||
|
|
@ -31,9 +33,9 @@ public class CacheController {
|
|||
List<String> pointCatList = new ArrayList<String>();
|
||||
if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true) {
|
||||
pointCatList.addAll(MwVolleyApi.getGpsCat());
|
||||
Log.d("Cache", "Categories being cached: " + pointCatList);
|
||||
Log.d(TAG, "Categories being cached: " + pointCatList);
|
||||
} else {
|
||||
Log.d("Cache", "No categories found, so no categories cached");
|
||||
Log.d(TAG, "No categories found, so no categories cached");
|
||||
}
|
||||
quadTree.set(x, y, pointCatList);
|
||||
}
|
||||
|
|
@ -44,26 +46,26 @@ public class CacheController {
|
|||
convertCoordRange();
|
||||
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
|
||||
ArrayList displayCatList = new ArrayList();
|
||||
Log.d("Cache", "Points found in quadtree: " + pointsFound);
|
||||
Log.d(TAG, "Points found in quadtree: " + pointsFound);
|
||||
|
||||
ArrayList<String> flatCatList = new ArrayList<String>();
|
||||
|
||||
if (pointsFound.length != 0) {
|
||||
|
||||
Log.d("Cache", "Entering for loop");
|
||||
Log.d(TAG, "Entering for loop");
|
||||
int index = 0;
|
||||
for (Point point : pointsFound) {
|
||||
Log.d("Cache", "Nearby point: " + point.toString());
|
||||
Log.d(TAG, "Nearby point: " + point.toString());
|
||||
Object cat = point.getValue();
|
||||
Log.d("Cache", "Nearby cat: " + cat);
|
||||
Log.d(TAG, "Nearby cat: " + cat);
|
||||
displayCatList.add(index, cat);
|
||||
index++;
|
||||
}
|
||||
//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());
|
||||
Log.d(TAG, "Categories found in cache: " + flatCatList.toString());
|
||||
} else {
|
||||
Log.d("Cache", "No categories found in cache");
|
||||
Log.d(TAG, "No categories found in cache");
|
||||
}
|
||||
return flatCatList;
|
||||
}
|
||||
|
|
@ -89,6 +91,6 @@ public class CacheController {
|
|||
yMinus = lat - dLat * 180/Math.PI;
|
||||
xPlus = lon + dLon * 180/Math.PI;
|
||||
xMinus = lon - dLon * 180/Math.PI;
|
||||
Log.d("Cache", "Search within: xMinus=" + xMinus + ", yMinus=" + yMinus + ", xPlus=" + xPlus + ", yPlus=" + yPlus);
|
||||
Log.d(TAG, "Search within: xMinus=" + xMinus + ", yMinus=" + yMinus + ", xPlus=" + xPlus + ", yPlus=" + yPlus);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class MwVolleyApi {
|
|||
private static List<String> categoryList;
|
||||
|
||||
private static final String MWURL = "https://commons.wikimedia.org/";
|
||||
private static final String TAG = MwVolleyApi.class.getName();
|
||||
|
||||
public MwVolleyApi(Context context) {
|
||||
this.context = context;
|
||||
|
|
@ -52,7 +53,7 @@ public class MwVolleyApi {
|
|||
public static void setGpsCat(List cachedList) {
|
||||
categoryList = new ArrayList<String>();
|
||||
categoryList.addAll(cachedList);
|
||||
Log.d("Cache", "Setting GPS cats from cache: " + categoryList.toString());
|
||||
Log.d(TAG, "Setting GPS cats from cache: " + categoryList.toString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ public class ShareActivity
|
|||
private UploadController uploadController;
|
||||
|
||||
private CommonsApplication cacheObj;
|
||||
private boolean cacheFound;
|
||||
|
||||
private static final String TAG = ShareActivity.class.getName();
|
||||
|
||||
public ShareActivity() {
|
||||
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
|
||||
|
|
@ -58,9 +61,11 @@ public class ShareActivity
|
|||
Toast startingToast = Toast.makeText(getApplicationContext(), R.string.uploading_started, Toast.LENGTH_LONG);
|
||||
startingToast.show();
|
||||
|
||||
//Has to be called after apiCall.request()
|
||||
cacheObj.cacheData.cacheCategory();
|
||||
Log.d("Cache", "Cache the categories found");
|
||||
if (cacheFound == false) {
|
||||
//Has to be called after apiCall.request()
|
||||
cacheObj.cacheData.cacheCategory();
|
||||
Log.d("Cache", "Cache the categories found");
|
||||
}
|
||||
|
||||
uploadController.startUpload(title, mediaUri, description, mimeType, source, new UploadController.ContributionUploadProgress() {
|
||||
public void onUploadStarted(Contribution contribution) {
|
||||
|
|
@ -213,12 +218,14 @@ public class ShareActivity
|
|||
//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("Cache", "displayCatList size 0, calling MWAPI" + displayCatList.toString());
|
||||
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
|
||||
|
||||
Log.d("Cache", "Cache found, setting categoryList in MwVolleyApi to " + displayCatList.toString());
|
||||
cacheFound = true;
|
||||
Log.d(TAG, "Cache found, setting categoryList in MwVolleyApi to " + displayCatList.toString());
|
||||
MwVolleyApi.setGpsCat(displayCatList);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue