This commit is contained in:
misaochan 2016-01-20 19:34:52 +13:00
parent 38dbf9928a
commit daa02eee2e

View file

@ -258,6 +258,7 @@ public class CategorizationFragment extends SherlockFragment{
@Override @Override
protected ArrayList<String> doInBackground(Void... voids) { protected ArrayList<String> doInBackground(Void... voids) {
//If user hasn't typed anything in yet, get GPS and recent items
if(TextUtils.isEmpty(filter)) { if(TextUtils.isEmpty(filter)) {
ArrayList<String> items = new ArrayList<String>(); ArrayList<String> items = new ArrayList<String>();
ArrayList<String> mergedItems= new ArrayList<String>(); ArrayList<String> mergedItems= new ArrayList<String>();
@ -286,18 +287,18 @@ public class CategorizationFragment extends SherlockFragment{
mergedItems.addAll(items); mergedItems.addAll(items);
} }
catch (RemoteException e) { catch (RemoteException e) {
// faaaail
throw new RuntimeException(e); throw new RuntimeException(e);
} }
//Log.d(TAG, "Merged items: " + mergedItems.toString()); //Log.d(TAG, "Merged items: " + mergedItems.toString());
return mergedItems; return mergedItems;
} }
//if user types in something that is in cache, return cached category
if(categoriesCache.containsKey(filter)) { if(categoriesCache.containsKey(filter)) {
return categoriesCache.get(filter); return categoriesCache.get(filter);
} }
//otherwise if user has typed something in, search API for matching categories
MWApi api = CommonsApplication.createMWApi(); MWApi api = CommonsApplication.createMWApi();
ApiResult result; ApiResult result;
ArrayList<String> categories = new ArrayList<String>(); ArrayList<String> categories = new ArrayList<String>();