mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add directPrefs injection and obtain CategoryItem for direct cats
This commit is contained in:
parent
945aa35864
commit
d2b0ffc69d
1 changed files with 26 additions and 7 deletions
|
|
@ -70,9 +70,19 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
|
|||
@BindView(R.id.categoriesExplanation)
|
||||
TextView categoriesSkip;
|
||||
|
||||
@Inject MediaWikiApi mwApi;
|
||||
@Inject @Named("default_preferences") SharedPreferences prefs;
|
||||
@Inject CategoryDao categoryDao;
|
||||
@Inject
|
||||
MediaWikiApi mwApi;
|
||||
@Inject
|
||||
@Named("default_preferences")
|
||||
SharedPreferences prefs;
|
||||
@Inject
|
||||
@Named("prefs")
|
||||
SharedPreferences prefsPrefs;
|
||||
@Inject
|
||||
@Named("direct_nearby_upload_prefs")
|
||||
SharedPreferences directPrefs;
|
||||
@Inject
|
||||
CategoryDao categoryDao;
|
||||
|
||||
private RVRendererAdapter<CategoryItem> categoriesAdapter;
|
||||
private OnCategoriesSaveHandler onCategoriesSaveHandler;
|
||||
|
|
@ -259,11 +269,20 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
|
|||
private Observable<CategoryItem> defaultCategories() {
|
||||
return gpsCategories()
|
||||
.concatWith(titleCategories())
|
||||
.concatWith(recentCategories());
|
||||
.concatWith(recentCategories())
|
||||
.concatWith(directCategories());
|
||||
//TODO: Add category suggestions for direct uploads here
|
||||
}
|
||||
|
||||
//TODO: Add category suggestions for direct uploads here
|
||||
private Observable<CategoryItem> directCategories() {
|
||||
String directCategory = directPrefs.getString("Category", "");
|
||||
Timber.d("Direct category found: " + directCategory);
|
||||
//String[] myStringArray = {directCategory};
|
||||
List<String> categoryList = new ArrayList<>();
|
||||
categoryList.add(directCategory);
|
||||
return Observable.fromIterable(categoryList).map(name -> new CategoryItem(name, false));
|
||||
}
|
||||
|
||||
private Observable<CategoryItem> gpsCategories() {
|
||||
return Observable.fromIterable(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue