Refactored recent + gps cat block

This commit is contained in:
misaochan 2016-01-21 16:08:22 +13:00
parent 89ed9eb70a
commit 0c29a875dd

View file

@ -256,10 +256,7 @@ public class CategorizationFragment extends SherlockFragment{
}
}
@Override
protected ArrayList<String> doInBackground(Void... voids) {
//If user hasn't typed anything in yet, get GPS and recent items
if(TextUtils.isEmpty(filter)) {
private ArrayList<String> recentCatQuery() {
ArrayList<String> items = new ArrayList<String>();
ArrayList<String> mergedItems= new ArrayList<String>();
@ -293,6 +290,13 @@ public class CategorizationFragment extends SherlockFragment{
return mergedItems;
}
@Override
protected ArrayList<String> doInBackground(Void... voids) {
//If user hasn't typed anything in yet, get GPS and recent items
if(TextUtils.isEmpty(filter)) {
return recentCatQuery();
}
//if user types in something that is in cache, return cached category
if(categoriesCache.containsKey(filter)) {
return categoriesCache.get(filter);