Split out NSFW source setting to separate section

Temporarily hidden until feature is ready for stable release.
This commit is contained in:
arkon 2020-08-10 14:19:35 -04:00
parent 5e9bdc2690
commit 65b32ddeb2
5 changed files with 71 additions and 23 deletions

View File

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

View File

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

View File

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

View File

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M16.67,13.13C18.04,14.06 19,15.32 19,17v3h4v-3C23,14.82 19.43,13.53 16.67,13.13z" />
<path
android:fillColor="#FF000000"
android:pathData="M15,12c2.21,0 4,-1.79 4,-4c0,-2.21 -1.79,-4 -4,-4c-0.47,0 -0.91,0.1 -1.33,0.24C14.5,5.27 15,6.58 15,8s-0.5,2.73 -1.33,3.76C14.09,11.9 14.53,12 15,12z" />
<path
android:fillColor="#FF000000"
android:pathData="M9,12c2.21,0 4,-1.79 4,-4c0,-2.21 -1.79,-4 -4,-4S5,5.79 5,8C5,10.21 6.79,12 9,12zM9,6c1.1,0 2,0.9 2,2c0,1.1 -0.9,2 -2,2S7,9.1 7,8C7,6.9 7.9,6 9,6z" />
<path
android:fillColor="#FF000000"
android:pathData="M9,13c-2.67,0 -8,1.34 -8,4v3h16v-3C17,14.34 11.67,13 9,13zM15,18H3l0,-0.99C3.2,16.29 6.3,15 9,15s5.8,1.29 6,2V18z" />
</vector>

View File

@ -170,6 +170,13 @@
<string name="secure_screen_summary">Hide app contents when switching apps and block screenshots</string>
<string name="hide_notification_content">Hide notification content</string>
<string name="pref_category_parental_controls">Parental controls</string>
<string name="pref_allow_nsfw_sources">18+ sources</string>
<string name="pref_allow_nsfw_sources_allowed">Allowed</string>
<string name="pref_allow_nsfw_sources_allowed_multisource">Block browsing sources but show in extensions list</string>
<string name="pref_allow_nsfw_sources_blocked">Blocked</string>
<string name="parental_controls_info">This does not prevent unofficial or potentially incorrectly flagged extensions from surfacing 18+ content within the app.</string>
<!-- Library section -->
<string name="pref_category_display">Display</string>
<string name="pref_library_columns">Items per row</string>
@ -334,10 +341,6 @@
<!-- Browse section -->
<string name="pref_enable_automatic_extension_updates">Check for extension updates</string>
<string name="pref_allow_nsfw_sources">NSFW sources</string>
<string name="pref_allow_nsfw_sources_allowed">Allowed</string>
<string name="pref_allow_nsfw_sources_allowed_multisource">Block source but show in extensions list</string>
<string name="pref_allow_nsfw_sources_blocked">Blocked</string>
<string name="pref_search_pinned_sources_only">Only include pinned sources</string>
<!-- Backup section -->