diff --git a/commons/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java b/commons/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java index a76fe8d15..e5491c27f 100644 --- a/commons/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java +++ b/commons/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java @@ -151,7 +151,7 @@ public class CategorizationFragment extends SherlockFragment{ items.add(cat.getName()); } - if (MwVolleyApi.gpsCatExists){ + if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true){ Log.d("Cat", "GPS cats found in CategorizationFragment.java" + MwVolleyApi.getGpsCat().toString()); List gpsItems = new ArrayList(MwVolleyApi.getGpsCat()); Log.d("Cat", "GPS items: " + gpsItems.toString()); 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 62c62a0a7..db4090d33 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 @@ -33,8 +33,6 @@ public class MwVolleyApi { protected static Set categorySet; - //To check later on whether any nearby categories were found - public static boolean gpsCatExists; public static final String MWURL = "https://commons.wikimedia.org/"; public MwVolleyApi(Context context) { @@ -147,19 +145,30 @@ public class MwVolleyApi { } } } + + public static class GpsCatExists { + private static boolean gpsCatExists; + + public static void setGpsCatExists(boolean gpsCat) { + gpsCatExists = gpsCat; + } + + public static boolean getGpsCatExists() { + return gpsCatExists; + } + } private static class QueryResponse { private Query query = new Query(); - private Page page; private String printSet() { if (categorySet == null || categorySet.isEmpty()) { - gpsCatExists = false; - Log.d("Cat", "gpsCatExists=" + gpsCatExists); + GpsCatExists.setGpsCatExists(false); + Log.d("Cat", "gpsCatExists=" + GpsCatExists.getGpsCatExists()); return "No collection of categories"; } else { - gpsCatExists = true; - Log.d("Cat", "gpsCatExists=" + gpsCatExists); + GpsCatExists.setGpsCatExists(true); + Log.d("Cat", "gpsCatExists=" + GpsCatExists.getGpsCatExists()); return "CATEGORIES FOUND" + categorySet.toString(); } }