Option to disable dangerous genres highlighting #1348

master
Koitharu 1 year ago
parent 3ff25de252
commit bfc733784f
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -105,6 +105,9 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
get() = prefs.getEnumValue(KEY_LIST_MODE_FAVORITES, listMode)
set(value) = prefs.edit { putEnumValue(KEY_LIST_MODE_FAVORITES, value) }
val isTagsWarningsEnabled: Boolean
get() = prefs.getBoolean(KEY_TAGS_WARNINGS, true)
var isNsfwContentDisabled: Boolean
get() = prefs.getBoolean(KEY_DISABLE_NSFW, false)
set(value) = prefs.edit { putBoolean(KEY_DISABLE_NSFW, value) }
@ -732,6 +735,7 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
const val KEY_BACKUP_TG_ENABLED = "backup_periodic_tg_enabled"
const val KEY_BACKUP_TG_CHAT = "backup_periodic_tg_chat_id"
const val KEY_MANGA_LIST_BADGES = "manga_list_badges"
const val KEY_TAGS_WARNINGS = "tags_warnings"
// keys for non-persistent preferences
const val KEY_APP_VERSION = "app_version"

@ -140,7 +140,7 @@ class MangaListMapper @Inject constructor(
@ColorRes
private fun getTagTint(tag: MangaTag): Int {
return if (tag.title.lowercase() in dict) {
return if (settings.isTagsWarningsEnabled && tag.title.lowercase() in dict) {
R.color.warning
} else {
0
@ -148,7 +148,7 @@ class MangaListMapper @Inject constructor(
}
private fun readTagsDict(context: Context): ScatterSet<String> =
context.resources.openRawResource(R.raw.tags_redlist).use {
context.resources.openRawResource(R.raw.tags_warnlist).use {
val set = MutableScatterSet<String>()
it.bufferedReader().forEachLine { x ->
val line = x.trim()

File diff suppressed because it is too large Load Diff

@ -38,6 +38,12 @@
android:summary="@string/disable_nsfw_summary"
android:title="@string/disable_nsfw" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="tags_warnings"
android:summary="@string/tags_warnings_summary"
android:title="@string/tags_warnings" />
<SwitchPreferenceCompat
android:key="handle_links"
android:persistent="false"

Loading…
Cancel
Save