Add source categories removing the source in the language as a option

This commit is contained in:
Jobobby04 2020-09-30 18:26:56 -04:00
parent 604b4ec01e
commit 4bd88fa194
5 changed files with 17 additions and 1 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -179,6 +179,8 @@
<string name="pref_latest_tab_language_code">Display language code next to name</string>
<string name="pref_latest_position">Latest tab position</string>
<string name="pref_latest_position_summery">Do you want the latest tab to be the first tab in browse? This will make it the default tab when opening browse, not recommended if your on data or a metered network</string>
<string name="pref_source_source_filtering">Filter sources in categories</string>
<string name="pref_source_source_filtering_summery">Filter the sources that are in categories, making the sources not get put under the language if they are in a category</string>
<string name="pref_source_navigation">Replace latest button</string>
<string name="pref_source_navigation_summery">Replace latest button with a custom browse view that includes both latest and browse</string>
<string name="pref_local_source_hidden_folders">Local source hidden folders</string>