Add filterYears() call to all category return methods

This commit is contained in:
misaochan 2016-10-27 16:37:36 +13:00
parent b7fef046d3
commit 9a475ef3c9
2 changed files with 14 additions and 4 deletions

View file

@ -71,7 +71,10 @@ public class MethodAUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
//if user types in something that is in cache, return cached category
if(catFragment.categoriesCache.containsKey(filter)) {
return catFragment.categoriesCache.get(filter);
ArrayList<String> cachedItems = new ArrayList<String>(catFragment.categoriesCache.get(filter));
Log.d(TAG, "Found cache items, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(cachedItems));
return filteredItems;
}
//otherwise if user has typed something in that isn't in cache, search API for matching categories
@ -103,6 +106,8 @@ public class MethodAUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
categories.add(catString);
}
return categories;
Log.d(TAG, "Found categories from Method A search, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(categories));
return filteredItems;
}
}

View file

@ -76,7 +76,10 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
//if user types in something that is in cache, return cached category
if(catFragment.categoriesCache.containsKey(filter)) {
return catFragment.categoriesCache.get(filter);
ArrayList<String> cachedItems = new ArrayList<String>(catFragment.categoriesCache.get(filter));
Log.d(TAG, "Found cache items, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(cachedItems));
return filteredItems;
}
//otherwise if user has typed something in that isn't in cache, search API for matching categories
@ -102,6 +105,8 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
categories.add(categoryNode.getDocument().getTextContent());
}
return categories;
Log.d(TAG, "Found categories from Prefix search, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(categories));
return filteredItems;
}
}