mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Add filterYears() call to all category return methods
This commit is contained in:
parent
b7fef046d3
commit
9a475ef3c9
2 changed files with 14 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue