Added getters/setters for GpsCatExists

This commit is contained in:
misaochan 2016-01-01 20:07:23 +13:00
parent b3de195176
commit 681cde18e8
2 changed files with 17 additions and 8 deletions

View file

@ -151,7 +151,7 @@ public class CategorizationFragment extends SherlockFragment{
items.add(cat.getName()); items.add(cat.getName());
} }
if (MwVolleyApi.gpsCatExists){ if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true){
Log.d("Cat", "GPS cats found in CategorizationFragment.java" + MwVolleyApi.getGpsCat().toString()); Log.d("Cat", "GPS cats found in CategorizationFragment.java" + MwVolleyApi.getGpsCat().toString());
List<String> gpsItems = new ArrayList<String>(MwVolleyApi.getGpsCat()); List<String> gpsItems = new ArrayList<String>(MwVolleyApi.getGpsCat());
Log.d("Cat", "GPS items: " + gpsItems.toString()); Log.d("Cat", "GPS items: " + gpsItems.toString());

View file

@ -33,8 +33,6 @@ public class MwVolleyApi {
protected static Set<String> categorySet; protected static Set<String> 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 static final String MWURL = "https://commons.wikimedia.org/";
public MwVolleyApi(Context context) { 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 static class QueryResponse {
private Query query = new Query(); private Query query = new Query();
private Page page;
private String printSet() { private String printSet() {
if (categorySet == null || categorySet.isEmpty()) { if (categorySet == null || categorySet.isEmpty()) {
gpsCatExists = false; GpsCatExists.setGpsCatExists(false);
Log.d("Cat", "gpsCatExists=" + gpsCatExists); Log.d("Cat", "gpsCatExists=" + GpsCatExists.getGpsCatExists());
return "No collection of categories"; return "No collection of categories";
} else { } else {
gpsCatExists = true; GpsCatExists.setGpsCatExists(true);
Log.d("Cat", "gpsCatExists=" + gpsCatExists); Log.d("Cat", "gpsCatExists=" + GpsCatExists.getGpsCatExists());
return "CATEGORIES FOUND" + categorySet.toString(); return "CATEGORIES FOUND" + categorySet.toString();
} }
} }