mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +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)
|
@BindView(R.id.categoriesExplanation)
|
||||||
TextView categoriesSkip;
|
TextView categoriesSkip;
|
||||||
|
|
||||||
@Inject MediaWikiApi mwApi;
|
@Inject
|
||||||
@Inject @Named("default_preferences") SharedPreferences prefs;
|
MediaWikiApi mwApi;
|
||||||
@Inject CategoryDao categoryDao;
|
@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 RVRendererAdapter<CategoryItem> categoriesAdapter;
|
||||||
private OnCategoriesSaveHandler onCategoriesSaveHandler;
|
private OnCategoriesSaveHandler onCategoriesSaveHandler;
|
||||||
|
|
@ -127,7 +137,7 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideKeyboard(View view) {
|
public void hideKeyboard(View view) {
|
||||||
InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -259,11 +269,20 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
|
||||||
private Observable<CategoryItem> defaultCategories() {
|
private Observable<CategoryItem> defaultCategories() {
|
||||||
return gpsCategories()
|
return gpsCategories()
|
||||||
.concatWith(titleCategories())
|
.concatWith(titleCategories())
|
||||||
.concatWith(recentCategories());
|
.concatWith(recentCategories())
|
||||||
|
.concatWith(directCategories());
|
||||||
//TODO: Add category suggestions for direct uploads here
|
//TODO: Add category suggestions for direct uploads here
|
||||||
}
|
}
|
||||||
|
|
||||||
//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() {
|
private Observable<CategoryItem> gpsCategories() {
|
||||||
return Observable.fromIterable(
|
return Observable.fromIterable(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue