mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Don't create local vars when returning straight away
This commit is contained in:
parent
85182e3fb7
commit
f019aa2865
4 changed files with 6 additions and 12 deletions
|
|
@ -69,9 +69,8 @@ public class LicenseList {
|
|||
int nameId = stringIdByName(stringId);
|
||||
//Log.d("Commons", "LicenseList.nameForTemplate: nameId: " + nameId);
|
||||
if(nameId != 0) {
|
||||
String name = res.getString(nameId);
|
||||
//Log.d("Commons", "LicenseList.nameForTemplate: name: " + name);
|
||||
return name;
|
||||
return res.getString(nameId);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,8 +357,7 @@ public class CategorizationFragment extends Fragment {
|
|||
new String[] {name},
|
||||
null);
|
||||
if (cursor.moveToFirst()) {
|
||||
Category cat = Category.fromCursor(cursor);
|
||||
return cat;
|
||||
return Category.fromCursor(cursor);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// This feels lazy, but to hell with checked exceptions. :)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ public class MethodAUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
|
|||
}
|
||||
|
||||
Timber.d("Found categories from Method A search, waiting for filter");
|
||||
ArrayList<String> filteredItems = new ArrayList<>(filterYears(categories));
|
||||
return filteredItems;
|
||||
return new ArrayList<>(filterYears(categories));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,16 +83,14 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
|
|||
if(TextUtils.isEmpty(filter)) {
|
||||
ArrayList<String> mergedItems = new ArrayList<>(catFragment.mergeItems());
|
||||
Timber.d("Merged items, waiting for filter");
|
||||
ArrayList<String> filteredItems = new ArrayList<>(filterYears(mergedItems));
|
||||
return filteredItems;
|
||||
return new ArrayList<>(filterYears(mergedItems));
|
||||
}
|
||||
|
||||
//if user types in something that is in cache, return cached category
|
||||
if(catFragment.categoriesCache.containsKey(filter)) {
|
||||
ArrayList<String> cachedItems = new ArrayList<>(catFragment.categoriesCache.get(filter));
|
||||
Timber.d("Found cache items, waiting for filter");
|
||||
ArrayList<String> filteredItems = new ArrayList<>(filterYears(cachedItems));
|
||||
return filteredItems;
|
||||
return new ArrayList<>(filterYears(cachedItems));
|
||||
}
|
||||
|
||||
//otherwise if user has typed something in that isn't in cache, search API for matching categories
|
||||
|
|
@ -119,7 +117,6 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
|
|||
}
|
||||
|
||||
Timber.d("Found categories from Prefix search, waiting for filter");
|
||||
ArrayList<String> filteredItems = new ArrayList<>(filterYears(categories));
|
||||
return filteredItems;
|
||||
return new ArrayList<>(filterYears(categories));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue