Add source categories removing the source in the language as a option
This commit is contained in:
@@ -283,6 +283,8 @@ object PreferenceKeys {
|
||||
|
||||
const val sources_tab_categories = "sources_tab_categories"
|
||||
|
||||
const val sources_tab_categories_filter = "sources_tab_categories_filter"
|
||||
|
||||
const val sources_tab_source_categories = "sources_tab_source_categories"
|
||||
|
||||
const val sourcesSort = "sources_sort"
|
||||
|
||||
@@ -403,6 +403,8 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun sourcesTabCategories() = flowPrefs.getStringSet(Keys.sources_tab_categories, mutableSetOf())
|
||||
|
||||
fun sourcesTabCategoriesFilter() = flowPrefs.getBoolean(Keys.sources_tab_categories_filter, false)
|
||||
|
||||
fun sourcesTabSourcesInCategories() = flowPrefs.getStringSet(Keys.sources_tab_source_categories, mutableSetOf())
|
||||
|
||||
fun sourceSorting() = flowPrefs.getInt(Keys.sourcesSort, 0)
|
||||
|
||||
@@ -73,7 +73,7 @@ class SourcePresenter(
|
||||
val sourcesAndCategoriesCombined = preferences.sourcesTabSourcesInCategories().get()
|
||||
val sourcesAndCategories = if (sourcesAndCategoriesCombined.isNotEmpty()) sourcesAndCategoriesCombined.map {
|
||||
val temp = it.split("|")
|
||||
Pair(temp[0], temp[1])
|
||||
temp[0] to temp[1]
|
||||
} else null
|
||||
|
||||
val sourcesInCategories = sourcesAndCategories?.map { it.first }
|
||||
@@ -126,6 +126,10 @@ class SourcePresenter(
|
||||
}
|
||||
}
|
||||
|
||||
if (preferences.sourcesTabCategoriesFilter().get()) {
|
||||
sourcesInCategories?.let { sourcesIds -> sourceItems = sourceItems.filterNot { it.source.id.toString() in sourcesIds } }
|
||||
}
|
||||
|
||||
// SY -->
|
||||
categories.forEach {
|
||||
sourceItems = it.sources.sortedBy { sourceItem -> sourceItem.source.name.toLowerCase() } + sourceItems
|
||||
|
||||
@@ -35,6 +35,12 @@ class SettingsBrowseController : SettingsController() {
|
||||
router.pushController(SourceCategoryController().withFadeTransaction())
|
||||
}
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.sources_tab_categories_filter
|
||||
titleRes = R.string.pref_source_source_filtering
|
||||
summaryRes = R.string.pref_source_source_filtering_summery
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.useNewSourceNavigation
|
||||
titleRes = R.string.pref_source_navigation
|
||||
|
||||
Reference in New Issue
Block a user