mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Comments
This commit is contained in:
parent
38dbf9928a
commit
daa02eee2e
1 changed files with 4 additions and 3 deletions
|
|
@ -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>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue