From 65b32ddeb22f109e59571c98121aa87bfe07d300 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 10 Aug 2020 14:19:35 -0400 Subject: [PATCH] Split out NSFW source setting to separate section Temporarily hidden until feature is ready for stable release. --- .../ui/setting/SettingsBrowseController.kt | 19 --------- .../ui/setting/SettingsMainController.kt | 6 +++ .../SettingsParentalControlsController.kt | 40 +++++++++++++++++++ .../drawable/ic_outline_people_alt_24dp.xml | 18 +++++++++ app/src/main/res/values/strings.xml | 11 +++-- 5 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsParentalControlsController.kt create mode 100644 app/src/main/res/drawable/ic_outline_people_alt_24dp.xml 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 41ab6017a..ab4d0bd7b 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 @@ -3,11 +3,8 @@ package eu.kanade.tachiyomi.ui.setting import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values 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.listPreference import eu.kanade.tachiyomi.util.preference.onChange import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.switchPreference @@ -32,22 +29,6 @@ class SettingsBrowseController : SettingsController() { true } } - 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 { 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 c165a9147..44d43f6ba 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 @@ -65,6 +65,12 @@ 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 new file mode 100644 index 000000000..016b626c5 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsParentalControlsController.kt @@ -0,0 +1,40 @@ +package eu.kanade.tachiyomi.ui.setting + +import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys +import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values +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 + +class SettingsParentalControlsController : SettingsController() { + + override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { + 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/res/drawable/ic_outline_people_alt_24dp.xml b/app/src/main/res/drawable/ic_outline_people_alt_24dp.xml new file mode 100644 index 000000000..f58829566 --- /dev/null +++ b/app/src/main/res/drawable/ic_outline_people_alt_24dp.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5bc5c29e8..0216638f8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -170,6 +170,13 @@ Hide app contents when switching apps and block screenshots Hide notification content + Parental controls + 18+ sources + Allowed + Block browsing sources but show in extensions list + Blocked + This does not prevent unofficial or potentially incorrectly flagged extensions from surfacing 18+ content within the app. + Display Items per row @@ -334,10 +341,6 @@ Check for extension updates - NSFW sources - Allowed - Block source but show in extensions list - Blocked Only include pinned sources