Move NSFW source setting into Browse settings

This commit is contained in:
arkon 2020-11-28 12:43:17 -05:00
parent 6b9180844d
commit c8316c7254
7 changed files with 32 additions and 76 deletions

View File

@ -65,12 +65,7 @@ class BackupNotifier(private val context: Context) {
with(completeNotificationBuilder) { with(completeNotificationBuilder) {
setContentTitle(context.getString(R.string.backup_created)) setContentTitle(context.getString(R.string.backup_created))
setContentText(unifile.filePath ?: unifile.name)
if (unifile.filePath != null) {
setContentText(unifile.filePath)
} else {
setContentText(unifile.name)
}
// Clear old actions if they exist // Clear old actions if they exist
if (mActions.isNotEmpty()) { if (mActions.isNotEmpty()) {

View File

@ -2,8 +2,12 @@ package eu.kanade.tachiyomi.ui.setting
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferenceValues
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
import eu.kanade.tachiyomi.util.preference.defaultValue 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.onChange
import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.switchPreference
@ -40,5 +44,28 @@ class SettingsBrowseController : SettingsController() {
defaultValue = false 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)
}
} }
} }

View File

@ -70,12 +70,6 @@ class SettingsMainController : SettingsController() {
titleRes = R.string.pref_category_security titleRes = R.string.pref_category_security
onClick { navigateTo(SettingsSecurityController()) } 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 { preference {
iconRes = R.drawable.ic_code_24dp iconRes = R.drawable.ic_code_24dp
iconTint = tintColor iconTint = tintColor

View File

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

View File

@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.ui.setting.SettingsController
import eu.kanade.tachiyomi.ui.setting.SettingsDownloadController import eu.kanade.tachiyomi.ui.setting.SettingsDownloadController
import eu.kanade.tachiyomi.ui.setting.SettingsGeneralController import eu.kanade.tachiyomi.ui.setting.SettingsGeneralController
import eu.kanade.tachiyomi.ui.setting.SettingsLibraryController 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.SettingsReaderController
import eu.kanade.tachiyomi.ui.setting.SettingsSecurityController import eu.kanade.tachiyomi.ui.setting.SettingsSecurityController
import eu.kanade.tachiyomi.ui.setting.SettingsTrackingController import eu.kanade.tachiyomi.ui.setting.SettingsTrackingController
@ -36,7 +35,6 @@ object SettingsSearchHelper {
SettingsDownloadController::class, SettingsDownloadController::class,
SettingsGeneralController::class, SettingsGeneralController::class,
SettingsLibraryController::class, SettingsLibraryController::class,
SettingsParentalControlsController::class,
SettingsReaderController::class, SettingsReaderController::class,
SettingsSecurityController::class, SettingsSecurityController::class,
SettingsTrackingController::class SettingsTrackingController::class

View File

@ -1,18 +0,0 @@
<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

@ -172,11 +172,11 @@
<string name="secure_screen_summary">Hide app contents when switching apps and block screenshots</string> <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="hide_notification_content">Hide notification content</string>
<string name="pref_category_parental_controls">Parental controls</string> <string name="pref_category_nsfw_content">18+ content</string>
<string name="pref_allow_nsfw_sources">18+ sources</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">Show</string>
<string name="pref_allow_nsfw_sources_allowed_multisource">Block browsing sources but show in extensions list</string> <string name="pref_allow_nsfw_sources_allowed_multisource">Hide in sources but show in extensions list</string>
<string name="pref_allow_nsfw_sources_blocked">Blocked</string> <string name="pref_allow_nsfw_sources_blocked">Hide</string>
<string name="parental_controls_info">This does not prevent unofficial or potentially incorrectly flagged extensions from surfacing 18+ content within the app.</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 --> <!-- Library section -->