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());
}
if (MwVolleyApi.gpsCatExists){
if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true){
Log.d("Cat", "GPS cats found in CategorizationFragment.java" + MwVolleyApi.getGpsCat().toString());
List<String> gpsItems = new ArrayList<String>(MwVolleyApi.getGpsCat());
Log.d("Cat", "GPS items: " + gpsItems.toString());

View file

@ -33,8 +33,6 @@ public class MwVolleyApi {
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 MwVolleyApi(Context context) {
@ -148,18 +146,29 @@ 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();
}
}