mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Split out NSFW source setting to separate section
Temporarily hidden until feature is ready for stable release.
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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) | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user