From c8316c72544308755fa73de9b5c632fd09fc7df3 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 28 Nov 2020 12:43:17 -0500 Subject: [PATCH] Move NSFW source setting into Browse settings --- .../tachiyomi/data/backup/BackupNotifier.kt | 7 +--- .../ui/setting/SettingsBrowseController.kt | 27 +++++++++++++ .../ui/setting/SettingsMainController.kt | 6 --- .../SettingsParentalControlsController.kt | 40 ------------------- .../ui/setting/search/SettingsSearchHelper.kt | 2 - .../drawable/ic_outline_people_alt_24dp.xml | 18 --------- app/src/main/res/values/strings.xml | 8 ++-- 7 files changed, 32 insertions(+), 76 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsParentalControlsController.kt delete mode 100644 app/src/main/res/drawable/ic_outline_people_alt_24dp.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt index 020f0d5d4..7354c685f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt @@ -65,12 +65,7 @@ class BackupNotifier(private val context: Context) { with(completeNotificationBuilder) { setContentTitle(context.getString(R.string.backup_created)) - - if (unifile.filePath != null) { - setContentText(unifile.filePath) - } else { - setContentText(unifile.name) - } + setContentText(unifile.filePath ?: unifile.name) // Clear old actions if they exist if (mActions.isNotEmpty()) { 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 61defdcfb..9a1524558 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt @@ -2,8 +2,12 @@ package eu.kanade.tachiyomi.ui.setting import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.util.preference.defaultValue +import eu.kanade.tachiyomi.util.preference.entriesRes +import eu.kanade.tachiyomi.util.preference.infoPreference +import eu.kanade.tachiyomi.util.preference.listPreference import eu.kanade.tachiyomi.util.preference.onChange import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.switchPreference @@ -40,5 +44,28 @@ class SettingsBrowseController : SettingsController() { defaultValue = false } } + + preferenceCategory { + titleRes = R.string.pref_category_nsfw_content + + 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( + PreferenceValues.NsfwAllowance.ALLOWED.name, + PreferenceValues.NsfwAllowance.PARTIAL.name, + PreferenceValues.NsfwAllowance.BLOCKED.name + ) + defaultValue = PreferenceValues.NsfwAllowance.ALLOWED.name + summary = "%s" + } + + infoPreference(R.string.parental_controls_info) + } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt index aecd29615..eb2e5ac58 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt @@ -70,12 +70,6 @@ class SettingsMainController : SettingsController() { titleRes = R.string.pref_category_security onClick { navigateTo(SettingsSecurityController()) } } - preference { - iconRes = R.drawable.ic_outline_people_alt_24dp - iconTint = tintColor - titleRes = R.string.pref_category_parental_controls - onClick { navigateTo(SettingsParentalControlsController()) } - } preference { iconRes = R.drawable.ic_code_24dp iconTint = tintColor diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsParentalControlsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsParentalControlsController.kt deleted file mode 100644 index 58859bdc8..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsParentalControlsController.kt +++ /dev/null @@ -1,40 +0,0 @@ -package eu.kanade.tachiyomi.ui.setting - -import androidx.preference.PreferenceScreen -import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.util.preference.defaultValue -import eu.kanade.tachiyomi.util.preference.entriesRes -import eu.kanade.tachiyomi.util.preference.infoPreference -import eu.kanade.tachiyomi.util.preference.listPreference -import eu.kanade.tachiyomi.util.preference.preferenceCategory -import eu.kanade.tachiyomi.util.preference.titleRes -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values - -class SettingsParentalControlsController : SettingsController() { - - override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { - titleRes = R.string.pref_category_parental_controls - - 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" - } - - preferenceCategory { - infoPreference(R.string.parental_controls_info) - } - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchHelper.kt index 0fad670c3..ebcdd42cc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchHelper.kt @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.ui.setting.SettingsController import eu.kanade.tachiyomi.ui.setting.SettingsDownloadController import eu.kanade.tachiyomi.ui.setting.SettingsGeneralController import eu.kanade.tachiyomi.ui.setting.SettingsLibraryController -import eu.kanade.tachiyomi.ui.setting.SettingsParentalControlsController import eu.kanade.tachiyomi.ui.setting.SettingsReaderController import eu.kanade.tachiyomi.ui.setting.SettingsSecurityController import eu.kanade.tachiyomi.ui.setting.SettingsTrackingController @@ -36,7 +35,6 @@ object SettingsSearchHelper { SettingsDownloadController::class, SettingsGeneralController::class, SettingsLibraryController::class, - SettingsParentalControlsController::class, SettingsReaderController::class, SettingsSecurityController::class, SettingsTrackingController::class diff --git a/app/src/main/res/drawable/ic_outline_people_alt_24dp.xml b/app/src/main/res/drawable/ic_outline_people_alt_24dp.xml deleted file mode 100644 index f58829566..000000000 --- a/app/src/main/res/drawable/ic_outline_people_alt_24dp.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 77262d76c..6247ddc8d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -172,11 +172,11 @@ Hide app contents when switching apps and block screenshots Hide notification content - Parental controls + 18+ content 18+ sources - Allowed - Block browsing sources but show in extensions list - Blocked + Show + Hide in sources but show in extensions list + Hide This does not prevent unofficial or potentially incorrectly flagged extensions from surfacing 18+ content within the app.