diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 20709ee0efaf..f676a6378885 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -157,6 +157,7 @@ object PreferenceKeys { const val enableDoh = "enable_doh" + const val hideLastUsedSource = "hide_last_used_source" fun trackUsername(syncId: Int) = "pref_mangasync_username_$syncId" fun trackPassword(syncId: Int) = "pref_mangasync_password_$syncId" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 33dc0995b2d0..4183e3ed9e7f 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -239,6 +239,7 @@ class PreferencesHelper(val context: Context) { fun enableDoh() = prefs.getBoolean(Keys.enableDoh, false) + fun hideLastUsedSource() = flowPrefs.getBoolean(Keys.hideLastUsedSource, false) fun extensionInstaller() = flowPrefs.getEnum( Keys.extensionInstaller, if (MiuiUtil.isMiui()) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt index e2ef9e6d0a4f..87015e01692c 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt @@ -69,33 +69,22 @@ class SettingsBrowseController : SettingsController() { } preferenceCategory { - titleRes = R.string.action_global_search + titleRes = R.string.label_sources switchPreference { - key = Keys.searchPinnedSourcesOnly - titleRes = R.string.pref_search_pinned_sources_only + key = Keys.hideLastUsedSource + titleRes = R.string.pref_hide_last_used_source defaultValue = false } } preferenceCategory { - titleRes = R.string.pref_category_nsfw_content + titleRes = R.string.action_global_search - listPreference { - key = Keys.allowNsfwSource - titleRes = R.string.pref_allow_nsfw_sources - entriesRes = arrayOf( - R.string.pref_allow_nsfw_sources_allowed, - R.string.pref_allow_nsfw_sources_allowed_multisource, - R.string.pref_allow_nsfw_sources_blocked - ) - entryValues = arrayOf( - Values.NsfwAllowance.ALLOWED.name, - Values.NsfwAllowance.PARTIAL.name, - Values.NsfwAllowance.BLOCKED.name - ) - defaultValue = Values.NsfwAllowance.ALLOWED.name - summary = "%s" + switchPreference { + key = Keys.searchPinnedSourcesOnly + titleRes = R.string.pref_search_pinned_sources_only + defaultValue = false } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt index 541203d1a4e7..b1af4aced22c 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt @@ -100,9 +100,13 @@ class SourcePresenter( } private fun updateLastUsedSource(sourceId: Long) { - val source = (sourceManager.get(sourceId) as? CatalogueSource)?.let { SourceItem(it, showButtons = controllerMode == SourceController.Mode.CATALOGUE) } - source?.let { - view().subscribe { view -> view?.setLastUsedSource(it) } + if (preferences.hideLastUsedSource().get()) { + view().subscribe { view -> view?.setLastUsedSource(null) } + } else { + val source = (sourceManager.get(sourceId) as? CatalogueSource)?.let { SourceItem(it, showButtons = controllerMode == SourceController.Mode.CATALOGUE) } + source?.let { + view().subscribe { view -> view?.setLastUsedSource(it) } + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c4db43b6f741..6346d105f41f 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -354,6 +354,7 @@ Block source but show in extensions list Blocked Only include pinned sources + Hide Last Used Source Backup