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()

@ -2,13 +2,13 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name" translatable="false">Kotatsu</string>
<string name="local_storage">Local storage</string>
<string name="favourites">Favourites</string>
<string name="favourites">Favorites</string>
<string name="history">History</string>
<string name="error_occurred">An error occurred</string>
<string name="network_error">Network error</string>
<string name="details">Details</string>
<string name="chapters">Chapters</string>
<string name="list">List</string>
<string name="list">Liste</string>
<string name="detailed_list">Detailed list</string>
<string name="grid">Grid</string>
<string name="list_mode">List mode</string>
@ -25,8 +25,8 @@
<string name="nothing_found">Nothing found</string>
<string name="history_is_empty">No history yet</string>
<string name="read">Read</string>
<string name="you_have_not_favourites_yet">No favourites yet</string>
<string name="add_to_favourites">Add to favourites</string>
<string name="you_have_not_favourites_yet">No favorites yet</string>
<string name="add_to_favourites">Favorite this</string>
<string name="add_new_category">New category</string>
<string name="add">Add</string>
<string name="save">Save</string>
@ -93,7 +93,7 @@
<string name="notification_sound">Notification sound</string>
<string name="light_indicator">LED indicator</string>
<string name="vibration">Vibration</string>
<string name="favourites_categories">Favourite categories</string>
<string name="favourites_categories">Favorite categories</string>
<string name="remove_category">Remove</string>
<string name="text_empty_holder_primary">It\'s kind of empty here…</string>
<string name="text_search_holder_secondary">Try to reformulate the query.</string>
@ -110,7 +110,7 @@
<string name="cannot_find_available_storage">No available storage</string>
<string name="other_storage">Other storage</string>
<string name="done">Done</string>
<string name="all_favourites">All favourites</string>
<string name="all_favourites">All favorites</string>
<string name="favourites_category_empty">Empty category</string>
<string name="read_later">Read later</string>
<string name="updates">Updates</string>
@ -152,7 +152,7 @@
<string name="file_not_found">File not found</string>
<string name="data_restored_success">All data was restored</string>
<string name="data_restored_with_errors">The data was restored, but there are errors</string>
<string name="backup_information">You can create backup of your history and favourites and restore it</string>
<string name="backup_information">You can create backup of your history and favorites and restore it</string>
<string name="just_now">Just now</string>
<string name="yesterday">Yesterday</string>
<string name="long_ago">Long ago</string>
@ -248,7 +248,7 @@
<string name="edit">Edit</string>
<string name="edit_category">Edit category</string>
<string name="tracking">Tracking</string>
<string name="empty_favourite_categories">No favourite categories</string>
<string name="empty_favourite_categories">No favorite categories</string>
<string name="logout">Log out</string>
<string name="bookmark_add">Add bookmark</string>
<string name="bookmark_remove">Remove bookmark</string>
@ -273,12 +273,12 @@
<string name="status_dropped">Dropped</string>
<string name="disable_all">Disable all</string>
<string name="use_fingerprint">Use biometric if available</string>
<string name="appwidget_shelf_description">Manga from your favourites</string>
<string name="appwidget_shelf_description">Manga from your favorites</string>
<string name="appwidget_recent_description">Your recently read manga</string>
<string name="report">Report</string>
<string name="show_reading_indicators">Show reading progress indicators</string>
<string name="data_deletion">Data deletion</string>
<string name="show_reading_indicators_summary">Show percentage read in history and favourites</string>
<string name="show_reading_indicators_summary">Show percentage read in history and favorites</string>
<string name="exclude_nsfw_from_history_summary">Manga marked as NSFW will never be added to the history and your progress will not be saved</string>
<string name="clear_cookies_summary">Can help in case of some issues. All authorizations will be invalidated</string>
<string name="show_all">Show all</string>
@ -308,7 +308,7 @@
<string name="storage_usage">Storage usage</string>
<string name="available">Available</string>
<string name="memory_usage_pattern" translatable="false">%1$s - %2$s</string>
<string name="removed_from_favourites">Removed from favourites</string>
<string name="removed_from_favourites">Removed from favorites</string>
<string name="options">Options</string>
<string name="not_found_404">Content not found or removed</string>
<string name="download_summary_pattern" translatable="false">%1$s · %2$s</string>
@ -689,7 +689,7 @@
<string name="sfw">SFW</string>
<string name="skip_all">Skip all</string>
<string name="stuck">Stuck</string>
<string name="not_in_favorites">Not in favourites</string>
<string name="not_in_favorites">Not in favorites</string>
<string name="updated_long_ago">Updated long ago</string>
<string name="unpopular">Unpopular</string>
<string name="low_rating">Low rating</string>
@ -823,4 +823,6 @@
<string name="exclude_nsfw_from_suggestions_summary">Adult manga will not be shown in suggestions. This option may work inaccurate with some sources</string>
<string name="include_disabled_sources">Include disabled sources</string>
<string name="suggestions_disabled_sources_summary">Show suggestions from all manga sources, including disabled ones</string>
<string name="tags_warnings">Highlight dangerous genres</string>
<string name="tags_warnings_summary">Highlight genres that may be inappropriate for most users</string>
</resources>

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