mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Add check for empty direct categories
This commit is contained in:
parent
efa7820fe4
commit
819ec795bd
1 changed files with 6 additions and 3 deletions
|
|
@ -89,6 +89,7 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
|
|||
private HashMap<String, ArrayList<String>> categoriesCache;
|
||||
private List<CategoryItem> selectedCategories = new ArrayList<>();
|
||||
private TitleTextWatcher textWatcher = new TitleTextWatcher();
|
||||
private boolean hasDirectCategories = false;
|
||||
|
||||
private final CategoriesAdapterFactory adapterFactory = new CategoriesAdapterFactory(item -> {
|
||||
if (item.isSelected()) {
|
||||
|
|
@ -275,11 +276,13 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
|
|||
|
||||
private Observable<CategoryItem> directCategories() {
|
||||
String directCategory = directPrefs.getString("Category", "");
|
||||
List<String> categoryList = new ArrayList<>();
|
||||
Timber.d("Direct category found: " + directCategory);
|
||||
|
||||
List<String> categoryList = new ArrayList<>();
|
||||
categoryList.add(directCategory);
|
||||
|
||||
if (!directCategory.equals("")) {
|
||||
hasDirectCategories = true;
|
||||
categoryList.add(directCategory);
|
||||
}
|
||||
return Observable.fromIterable(categoryList).map(name -> new CategoryItem(name, false));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue