diff --git a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt b/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt index 4c36cfd3a..296ca0b06 100644 --- a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt @@ -16,80 +16,80 @@ class LibraryPreferences( private val preferenceStore: PreferenceStore, ) { - fun libraryDisplayMode() = this.preferenceStore.getObject("pref_display_mode_library", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize) + fun libraryDisplayMode() = preferenceStore.getObject("pref_display_mode_library", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize) - fun librarySortingMode() = this.preferenceStore.getObject("library_sorting_mode", LibrarySort.default, LibrarySort.Serializer::serialize, LibrarySort.Serializer::deserialize) + fun librarySortingMode() = preferenceStore.getObject("library_sorting_mode", LibrarySort.default, LibrarySort.Serializer::serialize, LibrarySort.Serializer::deserialize) - fun portraitColumns() = this.preferenceStore.getInt("pref_library_columns_portrait_key", 0) + fun portraitColumns() = preferenceStore.getInt("pref_library_columns_portrait_key", 0) - fun landscapeColumns() = this.preferenceStore.getInt("pref_library_columns_landscape_key", 0) + fun landscapeColumns() = preferenceStore.getInt("pref_library_columns_landscape_key", 0) - fun libraryUpdateInterval() = this.preferenceStore.getInt("pref_library_update_interval_key", 24) - fun libraryUpdateLastTimestamp() = this.preferenceStore.getLong("library_update_last_timestamp", 0L) + fun libraryUpdateInterval() = preferenceStore.getInt("pref_library_update_interval_key", 24) + fun libraryUpdateLastTimestamp() = preferenceStore.getLong("library_update_last_timestamp", 0L) - fun libraryUpdateDeviceRestriction() = this.preferenceStore.getStringSet("library_update_restriction", setOf(DEVICE_ONLY_ON_WIFI)) - fun libraryUpdateMangaRestriction() = this.preferenceStore.getStringSet("library_update_manga_restriction", setOf(MANGA_HAS_UNREAD, MANGA_NON_COMPLETED, MANGA_NON_READ)) + fun libraryUpdateDeviceRestriction() = preferenceStore.getStringSet("library_update_restriction", setOf(DEVICE_ONLY_ON_WIFI)) + fun libraryUpdateMangaRestriction() = preferenceStore.getStringSet("library_update_manga_restriction", setOf(MANGA_HAS_UNREAD, MANGA_NON_COMPLETED, MANGA_NON_READ)) // region Filter - fun filterDownloaded() = this.preferenceStore.getInt("pref_filter_library_downloaded", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) + fun filterDownloaded() = preferenceStore.getInt("pref_filter_library_downloaded", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) - fun filterUnread() = this.preferenceStore.getInt("pref_filter_library_unread", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) + fun filterUnread() = preferenceStore.getInt("pref_filter_library_unread", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) - fun filterStarted() = this.preferenceStore.getInt("pref_filter_library_started", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) + fun filterStarted() = preferenceStore.getInt("pref_filter_library_started", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) - fun filterCompleted() = this.preferenceStore.getInt("pref_filter_library_completed", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) + fun filterCompleted() = preferenceStore.getInt("pref_filter_library_completed", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) // SY --> - fun filterLewd() = this.preferenceStore.getInt("pref_filter_library_lewd", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) + fun filterLewd() = preferenceStore.getInt("pref_filter_library_lewd", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) // SY <-- - fun filterTracking(name: Int) = this.preferenceStore.getInt("pref_filter_library_tracked_$name", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) + fun filterTracking(name: Int) = preferenceStore.getInt("pref_filter_library_tracked_$name", ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value) // endregion // region Badges - fun downloadBadge() = this.preferenceStore.getBoolean("display_download_badge", false) + fun downloadBadge() = preferenceStore.getBoolean("display_download_badge", false) - fun localBadge() = this.preferenceStore.getBoolean("display_local_badge", true) + fun localBadge() = preferenceStore.getBoolean("display_local_badge", true) - fun unreadBadge() = this.preferenceStore.getBoolean("display_unread_badge", true) + fun unreadBadge() = preferenceStore.getBoolean("display_unread_badge", true) - fun languageBadge() = this.preferenceStore.getBoolean("display_language_badge", false) + fun languageBadge() = preferenceStore.getBoolean("display_language_badge", false) - fun showUpdatesNavBadge() = this.preferenceStore.getBoolean("library_update_show_tab_badge", false) - fun unreadUpdatesCount() = this.preferenceStore.getInt("library_unread_updates_count", 0) + fun showUpdatesNavBadge() = preferenceStore.getBoolean("library_update_show_tab_badge", false) + fun unreadUpdatesCount() = preferenceStore.getInt("library_unread_updates_count", 0) // endregion // region Category - fun defaultCategory() = this.preferenceStore.getInt("default_category", -1) + fun defaultCategory() = preferenceStore.getInt("default_category", -1) - fun lastUsedCategory() = this.preferenceStore.getInt("last_used_category", 0) + fun lastUsedCategory() = preferenceStore.getInt("last_used_category", 0) - fun categoryTabs() = this.preferenceStore.getBoolean("display_category_tabs", true) + fun categoryTabs() = preferenceStore.getBoolean("display_category_tabs", true) - fun categoryNumberOfItems() = this.preferenceStore.getBoolean("display_number_of_items", false) + fun categoryNumberOfItems() = preferenceStore.getBoolean("display_number_of_items", false) - fun categorizedDisplaySettings() = this.preferenceStore.getBoolean("categorized_display", false) + fun categorizedDisplaySettings() = preferenceStore.getBoolean("categorized_display", false) - fun libraryUpdateCategories() = this.preferenceStore.getStringSet("library_update_categories", emptySet()) + fun libraryUpdateCategories() = preferenceStore.getStringSet("library_update_categories", emptySet()) - fun libraryUpdateCategoriesExclude() = this.preferenceStore.getStringSet("library_update_categories_exclude", emptySet()) + fun libraryUpdateCategoriesExclude() = preferenceStore.getStringSet("library_update_categories_exclude", emptySet()) // endregion // SY --> - fun sortTagsForLibrary() = this.preferenceStore.getStringSet("sort_tags_for_library", mutableSetOf()) + fun sortTagsForLibrary() = preferenceStore.getStringSet("sort_tags_for_library", mutableSetOf()) - fun groupLibraryUpdateType() = this.preferenceStore.getEnum("group_library_update_type", GroupLibraryMode.GLOBAL) + fun groupLibraryUpdateType() = preferenceStore.getEnum("group_library_update_type", GroupLibraryMode.GLOBAL) - fun startReadingButton() = this.preferenceStore.getBoolean("start_reading_button", true) + fun startReadingButton() = preferenceStore.getBoolean("start_reading_button", true) - fun groupLibraryBy() = this.preferenceStore.getInt("group_library_by", LibraryGroup.BY_DEFAULT) + fun groupLibraryBy() = preferenceStore.getInt("group_library_by", LibraryGroup.BY_DEFAULT) // SY <-- } diff --git a/app/src/main/java/eu/kanade/domain/source/service/SourcePreferences.kt b/app/src/main/java/eu/kanade/domain/source/service/SourcePreferences.kt index 0265aecd0..0e035f1a9 100644 --- a/app/src/main/java/eu/kanade/domain/source/service/SourcePreferences.kt +++ b/app/src/main/java/eu/kanade/domain/source/service/SourcePreferences.kt @@ -10,55 +10,55 @@ class SourcePreferences( private val preferenceStore: PreferenceStore, ) { - fun sourceDisplayMode() = this.preferenceStore.getObject("pref_display_mode_catalogue", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize) + fun sourceDisplayMode() = preferenceStore.getObject("pref_display_mode_catalogue", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize) - fun enabledLanguages() = this.preferenceStore.getStringSet("source_languages", LocaleHelper.getDefaultEnabledLanguages()) + fun enabledLanguages() = preferenceStore.getStringSet("source_languages", LocaleHelper.getDefaultEnabledLanguages()) - fun disabledSources() = this.preferenceStore.getStringSet("hidden_catalogues", emptySet()) + fun disabledSources() = preferenceStore.getStringSet("hidden_catalogues", emptySet()) - fun pinnedSources() = this.preferenceStore.getStringSet("pinned_catalogues", emptySet()) + fun pinnedSources() = preferenceStore.getStringSet("pinned_catalogues", emptySet()) - fun duplicatePinnedSources() = this.preferenceStore.getBoolean("duplicate_pinned_sources", false) + fun duplicatePinnedSources() = preferenceStore.getBoolean("duplicate_pinned_sources", false) - fun lastUsedSource() = this.preferenceStore.getLong("last_catalogue_source", -1) + fun lastUsedSource() = preferenceStore.getLong("last_catalogue_source", -1) - fun showNsfwSource() = this.preferenceStore.getBoolean("show_nsfw_source", true) + fun showNsfwSource() = preferenceStore.getBoolean("show_nsfw_source", true) - fun migrationSortingMode() = this.preferenceStore.getEnum("pref_migration_sorting", SetMigrateSorting.Mode.ALPHABETICAL) + fun migrationSortingMode() = preferenceStore.getEnum("pref_migration_sorting", SetMigrateSorting.Mode.ALPHABETICAL) - fun migrationSortingDirection() = this.preferenceStore.getEnum("pref_migration_direction", SetMigrateSorting.Direction.ASCENDING) + fun migrationSortingDirection() = preferenceStore.getEnum("pref_migration_direction", SetMigrateSorting.Direction.ASCENDING) - fun extensionUpdatesCount() = this.preferenceStore.getInt("ext_updates_count", 0) + fun extensionUpdatesCount() = preferenceStore.getInt("ext_updates_count", 0) - fun trustedSignatures() = this.preferenceStore.getStringSet("trusted_signatures", emptySet()) + fun trustedSignatures() = preferenceStore.getStringSet("trusted_signatures", emptySet()) - fun searchPinnedSourcesOnly() = this.preferenceStore.getBoolean("search_pinned_sources_only", false) + fun searchPinnedSourcesOnly() = preferenceStore.getBoolean("search_pinned_sources_only", false) // SY --> - fun enableSourceBlacklist() = this.preferenceStore.getBoolean("eh_enable_source_blacklist", true) + fun enableSourceBlacklist() = preferenceStore.getBoolean("eh_enable_source_blacklist", true) - fun sourcesTabCategories() = this.preferenceStore.getStringSet("sources_tab_categories", mutableSetOf()) + fun sourcesTabCategories() = preferenceStore.getStringSet("sources_tab_categories", mutableSetOf()) - fun sourcesTabCategoriesFilter() = this.preferenceStore.getBoolean("sources_tab_categories_filter", false) + fun sourcesTabCategoriesFilter() = preferenceStore.getBoolean("sources_tab_categories_filter", false) - fun sourcesTabSourcesInCategories() = this.preferenceStore.getStringSet("sources_tab_source_categories", mutableSetOf()) + fun sourcesTabSourcesInCategories() = preferenceStore.getStringSet("sources_tab_source_categories", mutableSetOf()) - fun dataSaver() = this.preferenceStore.getBoolean("data_saver", false) + fun dataSaver() = preferenceStore.getBoolean("data_saver", false) - fun dataSaverIgnoreJpeg() = this.preferenceStore.getBoolean("ignore_jpeg", false) + fun dataSaverIgnoreJpeg() = preferenceStore.getBoolean("ignore_jpeg", false) - fun dataSaverIgnoreGif() = this.preferenceStore.getBoolean("ignore_gif", true) + fun dataSaverIgnoreGif() = preferenceStore.getBoolean("ignore_gif", true) - fun dataSaverImageQuality() = this.preferenceStore.getInt("data_saver_image_quality", 80) + fun dataSaverImageQuality() = preferenceStore.getInt("data_saver_image_quality", 80) - fun dataSaverImageFormatJpeg() = this.preferenceStore.getBoolean("data_saver_image_format_jpeg", false) + fun dataSaverImageFormatJpeg() = preferenceStore.getBoolean("data_saver_image_format_jpeg", false) - fun dataSaverServer() = this.preferenceStore.getString("data_saver_server", "") + fun dataSaverServer() = preferenceStore.getString("data_saver_server", "") - fun dataSaverColorBW() = this.preferenceStore.getBoolean("data_saver_color_bw", false) + fun dataSaverColorBW() = preferenceStore.getBoolean("data_saver_color_bw", false) - fun dataSaverExcludedSources() = this.preferenceStore.getStringSet("data_saver_excluded", emptySet()) + fun dataSaverExcludedSources() = preferenceStore.getStringSet("data_saver_excluded", emptySet()) - fun dataSaverDownloader() = this.preferenceStore.getBoolean("data_saver_downloader", true) + fun dataSaverDownloader() = preferenceStore.getBoolean("data_saver_downloader", true) // SY <-- } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 666ee68fe..119941fc3 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -5,57 +5,11 @@ package eu.kanade.tachiyomi.data.preference */ object PreferenceKeys { - const val confirmExit = "pref_confirm_exit" - - const val showReadingMode = "pref_show_reading_mode" - - const val defaultReadingMode = "pref_default_reading_mode_key" - - const val defaultOrientationType = "pref_default_orientation_type_key" - - const val autoUpdateTrack = "pref_auto_update_manga_sync_key" - - const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key" - - const val folderPerManga = "create_folder_per_manga" - - const val removeAfterReadSlots = "remove_after_read_slots" - - const val removeAfterMarkedAsRead = "pref_remove_after_marked_as_read_key" - - const val removeBookmarkedChapters = "pref_remove_bookmarked" - - const val autoUpdateMetadata = "auto_update_metadata" - - const val autoUpdateTrackers = "auto_update_trackers" - const val dateFormat = "app_date_format" - const val skipRead = "skip_read" - - const val skipFiltered = "skip_filtered" - - const val defaultChapterFilterByRead = "default_chapter_filter_by_read" - - const val defaultChapterFilterByDownloaded = "default_chapter_filter_by_downloaded" - - const val defaultChapterFilterByBookmarked = "default_chapter_filter_by_bookmarked" - - const val defaultChapterSortBySourceOrNumber = "default_chapter_sort_by_source_or_number" // and upload date - - const val defaultChapterSortByAscendingOrDescending = "default_chapter_sort_by_ascending_or_descending" - - const val defaultChapterDisplayByNameOrNumber = "default_chapter_display_by_name_or_number" - - const val autoClearChapterCache = "auto_clear_chapter_cache" - fun trackUsername(syncId: Long) = "pref_mangasync_username_$syncId" fun trackPassword(syncId: Long) = "pref_mangasync_password_$syncId" fun trackToken(syncId: Long) = "track_token_$syncId" - - // SY --> - const val eh_logLevel = "eh_log_level" - // SY <-- } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 40442ba91..447360435 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -41,204 +41,204 @@ class PreferencesHelper( "backup", ).toUri() - fun confirmExit() = this.preferenceStore.getBoolean(Keys.confirmExit, false) + fun confirmExit() = preferenceStore.getBoolean("pref_confirm_exit", false) - fun sideNavIconAlignment() = this.preferenceStore.getInt("pref_side_nav_icon_alignment", 0) + fun sideNavIconAlignment() = preferenceStore.getInt("pref_side_nav_icon_alignment", 0) - fun autoUpdateMetadata() = this.preferenceStore.getBoolean(Keys.autoUpdateMetadata, false) + fun autoUpdateMetadata() = preferenceStore.getBoolean("auto_update_metadata", false) - fun autoUpdateTrackers() = this.preferenceStore.getBoolean(Keys.autoUpdateTrackers, false) + fun autoUpdateTrackers() = preferenceStore.getBoolean("auto_update_trackers", false) - fun themeMode() = this.preferenceStore.getEnum( + fun themeMode() = preferenceStore.getEnum( "pref_theme_mode_key", if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light }, ) - fun appTheme() = this.preferenceStore.getEnum( + fun appTheme() = preferenceStore.getEnum( "pref_app_theme", if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT }, ) - fun themeDarkAmoled() = this.preferenceStore.getBoolean("pref_theme_dark_amoled_key", false) + fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false) // SY --> - fun pageTransitionsPager() = this.preferenceStore.getBoolean("pref_enable_transitions_pager_key", true) + fun pageTransitionsPager() = preferenceStore.getBoolean("pref_enable_transitions_pager_key", true) - fun pageTransitionsWebtoon() = this.preferenceStore.getBoolean("pref_enable_transitions_webtoon_key", true) - // SY <-- + fun pageTransitionsWebtoon() = preferenceStore.getBoolean("pref_enable_transitions_webtoon_key", true) - fun doubleTapAnimSpeed() = this.preferenceStore.getInt("pref_double_tap_anim_speed", 500) + fun doubleTapAnimSpeed() = preferenceStore.getInt("pref_double_tap_anim_speed", 500) - fun showPageNumber() = this.preferenceStore.getBoolean("pref_show_page_number_key", true) + fun showPageNumber() = preferenceStore.getBoolean("pref_show_page_number_key", true) - fun dualPageSplitPaged() = this.preferenceStore.getBoolean("pref_dual_page_split", false) + fun dualPageSplitPaged() = preferenceStore.getBoolean("pref_dual_page_split", false) - fun dualPageInvertPaged() = this.preferenceStore.getBoolean("pref_dual_page_invert", false) + fun dualPageInvertPaged() = preferenceStore.getBoolean("pref_dual_page_invert", false) - fun dualPageSplitWebtoon() = this.preferenceStore.getBoolean("pref_dual_page_split_webtoon", false) + fun dualPageSplitWebtoon() = preferenceStore.getBoolean("pref_dual_page_split_webtoon", false) - fun dualPageInvertWebtoon() = this.preferenceStore.getBoolean("pref_dual_page_invert_webtoon", false) + fun dualPageInvertWebtoon() = preferenceStore.getBoolean("pref_dual_page_invert_webtoon", false) - fun longStripSplitWebtoon() = this.preferenceStore.getBoolean("pref_long_strip_split_webtoon", true) + fun longStripSplitWebtoon() = preferenceStore.getBoolean("pref_long_strip_split_webtoon", true) - fun showReadingMode() = this.preferenceStore.getBoolean(Keys.showReadingMode, true) + fun showReadingMode() = preferenceStore.getBoolean("pref_show_reading_mode", true) - fun trueColor() = this.preferenceStore.getBoolean("pref_true_color_key", false) + fun trueColor() = preferenceStore.getBoolean("pref_true_color_key", false) - fun fullscreen() = this.preferenceStore.getBoolean("fullscreen", true) + fun fullscreen() = preferenceStore.getBoolean("fullscreen", true) - fun cutoutShort() = this.preferenceStore.getBoolean("cutout_short", true) + fun cutoutShort() = preferenceStore.getBoolean("cutout_short", true) - fun keepScreenOn() = this.preferenceStore.getBoolean("pref_keep_screen_on_key", true) + fun keepScreenOn() = preferenceStore.getBoolean("pref_keep_screen_on_key", true) - fun customBrightness() = this.preferenceStore.getBoolean("pref_custom_brightness_key", false) + fun customBrightness() = preferenceStore.getBoolean("pref_custom_brightness_key", false) - fun customBrightnessValue() = this.preferenceStore.getInt("custom_brightness_value", 0) + fun customBrightnessValue() = preferenceStore.getInt("custom_brightness_value", 0) - fun colorFilter() = this.preferenceStore.getBoolean("pref_color_filter_key", false) + fun colorFilter() = preferenceStore.getBoolean("pref_color_filter_key", false) - fun colorFilterValue() = this.preferenceStore.getInt("color_filter_value", 0) + fun colorFilterValue() = preferenceStore.getInt("color_filter_value", 0) - fun colorFilterMode() = this.preferenceStore.getInt("color_filter_mode", 0) + fun colorFilterMode() = preferenceStore.getInt("color_filter_mode", 0) - fun grayscale() = this.preferenceStore.getBoolean("pref_grayscale", false) + fun grayscale() = preferenceStore.getBoolean("pref_grayscale", false) - fun invertedColors() = this.preferenceStore.getBoolean("pref_inverted_colors", false) + fun invertedColors() = preferenceStore.getBoolean("pref_inverted_colors", false) - fun defaultReadingMode() = this.preferenceStore.getInt(Keys.defaultReadingMode, ReadingModeType.RIGHT_TO_LEFT.flagValue) + fun defaultReadingMode() = preferenceStore.getInt("pref_default_reading_mode_key", ReadingModeType.RIGHT_TO_LEFT.flagValue) - fun defaultOrientationType() = this.preferenceStore.getInt(Keys.defaultOrientationType, OrientationType.FREE.flagValue) + fun defaultOrientationType() = preferenceStore.getInt("pref_default_orientation_type_key", OrientationType.FREE.flagValue) - fun imageScaleType() = this.preferenceStore.getInt("pref_image_scale_type_key", 1) + fun imageScaleType() = preferenceStore.getInt("pref_image_scale_type_key", 1) - fun zoomStart() = this.preferenceStore.getInt("pref_zoom_start_key", 1) + fun zoomStart() = preferenceStore.getInt("pref_zoom_start_key", 1) - fun readerTheme() = this.preferenceStore.getInt("pref_reader_theme_key", 3) + fun readerTheme() = preferenceStore.getInt("pref_reader_theme_key", 3) - fun alwaysShowChapterTransition() = this.preferenceStore.getBoolean("always_show_chapter_transition", true) + fun alwaysShowChapterTransition() = preferenceStore.getBoolean("always_show_chapter_transition", true) - fun cropBorders() = this.preferenceStore.getBoolean("crop_borders", false) + fun cropBorders() = preferenceStore.getBoolean("crop_borders", false) - fun navigateToPan() = this.preferenceStore.getBoolean("navigate_pan", true) + fun navigateToPan() = preferenceStore.getBoolean("navigate_pan", true) - fun landscapeZoom() = this.preferenceStore.getBoolean("landscape_zoom", true) + fun landscapeZoom() = preferenceStore.getBoolean("landscape_zoom", true) - fun cropBordersWebtoon() = this.preferenceStore.getBoolean("crop_borders_webtoon", false) + fun cropBordersWebtoon() = preferenceStore.getBoolean("crop_borders_webtoon", false) - fun webtoonSidePadding() = this.preferenceStore.getInt("webtoon_side_padding", 0) + fun webtoonSidePadding() = preferenceStore.getInt("webtoon_side_padding", 0) - fun readWithTapping() = this.preferenceStore.getBoolean("reader_tap", true) + fun readWithTapping() = preferenceStore.getBoolean("reader_tap", true) - fun pagerNavInverted() = this.preferenceStore.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE) + fun pagerNavInverted() = preferenceStore.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE) - fun webtoonNavInverted() = this.preferenceStore.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE) + fun webtoonNavInverted() = preferenceStore.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE) - fun readWithLongTap() = this.preferenceStore.getBoolean("reader_long_tap", true) + fun readWithLongTap() = preferenceStore.getBoolean("reader_long_tap", true) - fun readWithVolumeKeys() = this.preferenceStore.getBoolean("reader_volume_keys", false) + fun readWithVolumeKeys() = preferenceStore.getBoolean("reader_volume_keys", false) - fun readWithVolumeKeysInverted() = this.preferenceStore.getBoolean("reader_volume_keys_inverted", false) + fun readWithVolumeKeysInverted() = preferenceStore.getBoolean("reader_volume_keys_inverted", false) - fun navigationModePager() = this.preferenceStore.getInt("reader_navigation_mode_pager", 0) + fun navigationModePager() = preferenceStore.getInt("reader_navigation_mode_pager", 0) - fun navigationModeWebtoon() = this.preferenceStore.getInt("reader_navigation_mode_webtoon", 0) + fun navigationModeWebtoon() = preferenceStore.getInt("reader_navigation_mode_webtoon", 0) - fun showNavigationOverlayNewUser() = this.preferenceStore.getBoolean("reader_navigation_overlay_new_user", true) + fun showNavigationOverlayNewUser() = preferenceStore.getBoolean("reader_navigation_overlay_new_user", true) - fun showNavigationOverlayOnStart() = this.preferenceStore.getBoolean("reader_navigation_overlay_on_start", false) + fun showNavigationOverlayOnStart() = preferenceStore.getBoolean("reader_navigation_overlay_on_start", false) - fun readerHideThreshold() = this.preferenceStore.getEnum("reader_hide_threshold", Values.ReaderHideThreshold.LOW) + fun readerHideThreshold() = preferenceStore.getEnum("reader_hide_threshold", Values.ReaderHideThreshold.LOW) - fun autoUpdateTrack() = this.preferenceStore.getBoolean(Keys.autoUpdateTrack, true) + fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true) - fun lastVersionCode() = this.preferenceStore.getInt("last_version_code", 0) + fun lastVersionCode() = preferenceStore.getInt("last_version_code", 0) - fun trackUsername(sync: TrackService) = this.preferenceStore.getString(Keys.trackUsername(sync.id), "") + fun trackUsername(sync: TrackService) = preferenceStore.getString(Keys.trackUsername(sync.id), "") - fun trackPassword(sync: TrackService) = this.preferenceStore.getString(Keys.trackPassword(sync.id), "") + fun trackPassword(sync: TrackService) = preferenceStore.getString(Keys.trackPassword(sync.id), "") fun setTrackCredentials(sync: TrackService, username: String, password: String) { trackUsername(sync).set(username) trackPassword(sync).set(password) } - fun trackToken(sync: TrackService) = this.preferenceStore.getString(Keys.trackToken(sync.id), "") + fun trackToken(sync: TrackService) = preferenceStore.getString(Keys.trackToken(sync.id), "") - fun anilistScoreType() = this.preferenceStore.getString("anilist_score_type", Anilist.POINT_10) + fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10) - fun backupsDirectory() = this.preferenceStore.getString("backup_directory", defaultBackupDir.toString()) + fun backupsDirectory() = preferenceStore.getString("backup_directory", defaultBackupDir.toString()) - fun relativeTime() = this.preferenceStore.getInt("relative_time", 7) + fun relativeTime() = preferenceStore.getInt("relative_time", 7) - fun dateFormat(format: String = this.preferenceStore.getString(Keys.dateFormat, "").get()): DateFormat = when (format) { + fun dateFormat(format: String = preferenceStore.getString(Keys.dateFormat, "").get()): DateFormat = when (format) { "" -> DateFormat.getDateInstance(DateFormat.SHORT) else -> SimpleDateFormat(format, Locale.getDefault()) } - fun downloadsDirectory() = this.preferenceStore.getString("download_directory", defaultDownloadsDir.toString()) + fun downloadsDirectory() = preferenceStore.getString("download_directory", defaultDownloadsDir.toString()) - fun downloadOnlyOverWifi() = this.preferenceStore.getBoolean(Keys.downloadOnlyOverWifi, true) + fun downloadOnlyOverWifi() = preferenceStore.getBoolean("pref_download_only_over_wifi_key", true) - fun saveChaptersAsCBZ() = this.preferenceStore.getBoolean("save_chapter_as_cbz", true) + fun saveChaptersAsCBZ() = preferenceStore.getBoolean("save_chapter_as_cbz", true) - fun splitTallImages() = this.preferenceStore.getBoolean("split_tall_images", false) + fun splitTallImages() = preferenceStore.getBoolean("split_tall_images", false) - fun folderPerManga() = this.preferenceStore.getBoolean(Keys.folderPerManga, false) + fun folderPerManga() = preferenceStore.getBoolean("create_folder_per_manga", false) - fun numberOfBackups() = this.preferenceStore.getInt("backup_slots", 2) + fun numberOfBackups() = preferenceStore.getInt("backup_slots", 2) - fun backupInterval() = this.preferenceStore.getInt("backup_interval", 12) + fun backupInterval() = preferenceStore.getInt("backup_interval", 12) - fun removeAfterReadSlots() = this.preferenceStore.getInt(Keys.removeAfterReadSlots, -1) + fun removeAfterReadSlots() = preferenceStore.getInt("remove_after_read_slots", -1) - fun removeAfterMarkedAsRead() = this.preferenceStore.getBoolean(Keys.removeAfterMarkedAsRead, false) + fun removeAfterMarkedAsRead() = preferenceStore.getBoolean("pref_remove_after_marked_as_read_key", false) - fun removeBookmarkedChapters() = this.preferenceStore.getBoolean(Keys.removeBookmarkedChapters, false) + fun removeBookmarkedChapters() = preferenceStore.getBoolean("pref_remove_bookmarked", false) - fun removeExcludeCategories() = this.preferenceStore.getStringSet("remove_exclude_categories", emptySet()) + fun removeExcludeCategories() = preferenceStore.getStringSet("remove_exclude_categories", emptySet()) - fun downloadedOnly() = this.preferenceStore.getBoolean("pref_downloaded_only", false) + fun downloadedOnly() = preferenceStore.getBoolean("pref_downloaded_only", false) - fun automaticExtUpdates() = this.preferenceStore.getBoolean("automatic_ext_updates", true) + fun automaticExtUpdates() = preferenceStore.getBoolean("automatic_ext_updates", true) - fun lastAppCheck() = this.preferenceStore.getLong("last_app_check", 0) - fun lastExtCheck() = this.preferenceStore.getLong("last_ext_check", 0) + fun lastAppCheck() = preferenceStore.getLong("last_app_check", 0) + fun lastExtCheck() = preferenceStore.getLong("last_ext_check", 0) - fun downloadNewChapters() = this.preferenceStore.getBoolean("download_new", false) + fun downloadNewChapters() = preferenceStore.getBoolean("download_new", false) - fun downloadNewChapterCategories() = this.preferenceStore.getStringSet("download_new_categories", emptySet()) - fun downloadNewChapterCategoriesExclude() = this.preferenceStore.getStringSet("download_new_categories_exclude", emptySet()) + fun downloadNewChapterCategories() = preferenceStore.getStringSet("download_new_categories", emptySet()) + fun downloadNewChapterCategoriesExclude() = preferenceStore.getStringSet("download_new_categories_exclude", emptySet()) - fun autoDownloadWhileReading() = this.preferenceStore.getInt("auto_download_while_reading", 0) + fun autoDownloadWhileReading() = preferenceStore.getInt("auto_download_while_reading", 0) - fun skipRead() = this.preferenceStore.getBoolean(Keys.skipRead, false) + fun skipRead() = preferenceStore.getBoolean("skip_read", false) - fun skipFiltered() = this.preferenceStore.getBoolean(Keys.skipFiltered, true) + fun skipFiltered() = preferenceStore.getBoolean("skip_filtered", true) - fun migrateFlags() = this.preferenceStore.getInt("migrate_flags", Int.MAX_VALUE) + fun migrateFlags() = preferenceStore.getInt("migrate_flags", Int.MAX_VALUE) - fun filterChapterByRead() = this.preferenceStore.getInt(Keys.defaultChapterFilterByRead, DomainManga.SHOW_ALL.toInt()) + fun filterChapterByRead() = preferenceStore.getInt("default_chapter_filter_by_read", DomainManga.SHOW_ALL.toInt()) - fun filterChapterByDownloaded() = this.preferenceStore.getInt(Keys.defaultChapterFilterByDownloaded, DomainManga.SHOW_ALL.toInt()) + fun filterChapterByDownloaded() = preferenceStore.getInt("default_chapter_filter_by_downloaded", DomainManga.SHOW_ALL.toInt()) - fun filterChapterByBookmarked() = this.preferenceStore.getInt(Keys.defaultChapterFilterByBookmarked, DomainManga.SHOW_ALL.toInt()) + fun filterChapterByBookmarked() = preferenceStore.getInt("default_chapter_filter_by_bookmarked", DomainManga.SHOW_ALL.toInt()) - fun sortChapterBySourceOrNumber() = this.preferenceStore.getInt(Keys.defaultChapterSortBySourceOrNumber, DomainManga.CHAPTER_SORTING_SOURCE.toInt()) + // and upload date + fun sortChapterBySourceOrNumber() = preferenceStore.getInt("default_chapter_sort_by_source_or_number", DomainManga.CHAPTER_SORTING_SOURCE.toInt()) - fun displayChapterByNameOrNumber() = this.preferenceStore.getInt(Keys.defaultChapterDisplayByNameOrNumber, DomainManga.CHAPTER_DISPLAY_NAME.toInt()) + fun displayChapterByNameOrNumber() = preferenceStore.getInt("default_chapter_display_by_name_or_number", DomainManga.CHAPTER_DISPLAY_NAME.toInt()) - fun sortChapterByAscendingOrDescending() = this.preferenceStore.getInt(Keys.defaultChapterSortByAscendingOrDescending, DomainManga.CHAPTER_SORT_DESC.toInt()) + fun sortChapterByAscendingOrDescending() = preferenceStore.getInt("default_chapter_sort_by_ascending_or_descending", DomainManga.CHAPTER_SORT_DESC.toInt()) - fun incognitoMode() = this.preferenceStore.getBoolean("incognito_mode", false) + fun incognitoMode() = preferenceStore.getBoolean("incognito_mode", false) - fun tabletUiMode() = this.preferenceStore.getEnum("tablet_ui_mode", Values.TabletUiMode.AUTOMATIC) + fun tabletUiMode() = preferenceStore.getEnum("tablet_ui_mode", Values.TabletUiMode.AUTOMATIC) - fun extensionInstaller() = this.preferenceStore.getEnum( + fun extensionInstaller() = preferenceStore.getEnum( "extension_installer", if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER, ) - fun autoClearChapterCache() = this.preferenceStore.getBoolean(Keys.autoClearChapterCache, false) + fun autoClearChapterCache() = preferenceStore.getBoolean("auto_clear_chapter_cache", false) fun setChapterSettingsDefault(manga: Manga) { filterChapterByRead().set(manga.readFilter) @@ -250,138 +250,138 @@ class PreferencesHelper( } // SY --> - fun defaultMangaOrder() = this.preferenceStore.getString("default_manga_order", "") + fun defaultMangaOrder() = preferenceStore.getString("default_manga_order", "") - fun migrationSources() = this.preferenceStore.getString("migrate_sources", "") + fun migrationSources() = preferenceStore.getString("migrate_sources", "") - fun smartMigration() = this.preferenceStore.getBoolean("smart_migrate", false) + fun smartMigration() = preferenceStore.getBoolean("smart_migrate", false) - fun useSourceWithMost() = this.preferenceStore.getBoolean("use_source_with_most", false) + fun useSourceWithMost() = preferenceStore.getBoolean("use_source_with_most", false) - fun skipPreMigration() = this.preferenceStore.getBoolean("skip_pre_migration", false) + fun skipPreMigration() = preferenceStore.getBoolean("skip_pre_migration", false) - fun hideNotFoundMigration() = this.preferenceStore.getBoolean("hide_not_found_migration", false) + fun hideNotFoundMigration() = preferenceStore.getBoolean("hide_not_found_migration", false) - fun isHentaiEnabled() = this.preferenceStore.getBoolean("eh_is_hentai_enabled", true) + fun isHentaiEnabled() = preferenceStore.getBoolean("eh_is_hentai_enabled", true) - fun enableExhentai() = this.preferenceStore.getBoolean("enable_exhentai", false) + fun enableExhentai() = preferenceStore.getBoolean("enable_exhentai", false) - fun imageQuality() = this.preferenceStore.getString("ehentai_quality", "auto") + fun imageQuality() = preferenceStore.getString("ehentai_quality", "auto") - fun useHentaiAtHome() = this.preferenceStore.getInt("eh_enable_hah", 0) + fun useHentaiAtHome() = preferenceStore.getInt("eh_enable_hah", 0) - fun useJapaneseTitle() = this.preferenceStore.getBoolean("use_jp_title", false) + fun useJapaneseTitle() = preferenceStore.getBoolean("use_jp_title", false) - fun exhUseOriginalImages() = this.preferenceStore.getBoolean("eh_useOrigImages", false) + fun exhUseOriginalImages() = preferenceStore.getBoolean("eh_useOrigImages", false) - fun ehTagFilterValue() = this.preferenceStore.getInt("eh_tag_filtering_value", 0) + fun ehTagFilterValue() = preferenceStore.getInt("eh_tag_filtering_value", 0) - fun ehTagWatchingValue() = this.preferenceStore.getInt("eh_tag_watching_value", 0) + fun ehTagWatchingValue() = preferenceStore.getInt("eh_tag_watching_value", 0) // EH Cookies - fun memberIdVal() = this.preferenceStore.getString("eh_ipb_member_id", "") + fun memberIdVal() = preferenceStore.getString("eh_ipb_member_id", "") - fun passHashVal() = this.preferenceStore.getString("eh_ipb_pass_hash", "") - fun igneousVal() = this.preferenceStore.getString("eh_igneous", "") - fun ehSettingsProfile() = this.preferenceStore.getInt("eh_ehSettingsProfile", -1) - fun exhSettingsProfile() = this.preferenceStore.getInt("eh_exhSettingsProfile", -1) - fun exhSettingsKey() = this.preferenceStore.getString("eh_settingsKey", "") - fun exhSessionCookie() = this.preferenceStore.getString("eh_sessionCookie", "") - fun exhHathPerksCookies() = this.preferenceStore.getString("eh_hathPerksCookie", "") + fun passHashVal() = preferenceStore.getString("eh_ipb_pass_hash", "") + fun igneousVal() = preferenceStore.getString("eh_igneous", "") + fun ehSettingsProfile() = preferenceStore.getInt("eh_ehSettingsProfile", -1) + fun exhSettingsProfile() = preferenceStore.getInt("eh_exhSettingsProfile", -1) + fun exhSettingsKey() = preferenceStore.getString("eh_settingsKey", "") + fun exhSessionCookie() = preferenceStore.getString("eh_sessionCookie", "") + fun exhHathPerksCookies() = preferenceStore.getString("eh_hathPerksCookie", "") - fun exhShowSyncIntro() = this.preferenceStore.getBoolean("eh_show_sync_intro", true) + fun exhShowSyncIntro() = preferenceStore.getBoolean("eh_show_sync_intro", true) - fun exhReadOnlySync() = this.preferenceStore.getBoolean("eh_sync_read_only", false) + fun exhReadOnlySync() = preferenceStore.getBoolean("eh_sync_read_only", false) - fun exhLenientSync() = this.preferenceStore.getBoolean("eh_lenient_sync", false) + fun exhLenientSync() = preferenceStore.getBoolean("eh_lenient_sync", false) - fun exhShowSettingsUploadWarning() = this.preferenceStore.getBoolean("eh_showSettingsUploadWarning2", true) + fun exhShowSettingsUploadWarning() = preferenceStore.getBoolean("eh_showSettingsUploadWarning2", true) - fun expandFilters() = this.preferenceStore.getBoolean("eh_expand_filters", false) + fun expandFilters() = preferenceStore.getBoolean("eh_expand_filters", false) - fun readerThreads() = this.preferenceStore.getInt("eh_reader_threads", 2) + fun readerThreads() = preferenceStore.getInt("eh_reader_threads", 2) - fun readerInstantRetry() = this.preferenceStore.getBoolean("eh_reader_instant_retry", true) + fun readerInstantRetry() = preferenceStore.getBoolean("eh_reader_instant_retry", true) - fun autoscrollInterval() = this.preferenceStore.getFloat("eh_util_autoscroll_interval", 3f) + fun autoscrollInterval() = preferenceStore.getFloat("eh_util_autoscroll_interval", 3f) - fun cacheSize() = this.preferenceStore.getString("eh_cache_size", "75") + fun cacheSize() = preferenceStore.getString("eh_cache_size", "75") - fun preserveReadingPosition() = this.preferenceStore.getBoolean("eh_preserve_reading_position", false) + fun preserveReadingPosition() = preferenceStore.getBoolean("eh_preserve_reading_position", false) - fun autoSolveCaptcha() = this.preferenceStore.getBoolean("eh_autosolve_captchas", false) + fun autoSolveCaptcha() = preferenceStore.getBoolean("eh_autosolve_captchas", false) - fun ehLastVersionCode() = this.preferenceStore.getInt("eh_last_version_code", 0) + fun ehLastVersionCode() = preferenceStore.getInt("eh_last_version_code", 0) - fun logLevel() = this.preferenceStore.getInt(Keys.eh_logLevel, 0) + fun logLevel() = preferenceStore.getInt("eh_log_level", 0) - fun exhAutoUpdateFrequency() = this.preferenceStore.getInt("eh_auto_update_frequency", 1) + fun exhAutoUpdateFrequency() = preferenceStore.getInt("eh_auto_update_frequency", 1) - fun exhAutoUpdateRequirements() = this.preferenceStore.getStringSet("eh_auto_update_restrictions", emptySet()) + fun exhAutoUpdateRequirements() = preferenceStore.getStringSet("eh_auto_update_restrictions", emptySet()) - fun exhAutoUpdateStats() = this.preferenceStore.getString("eh_auto_update_stats", "") + fun exhAutoUpdateStats() = preferenceStore.getString("eh_auto_update_stats", "") - fun aggressivePageLoading() = this.preferenceStore.getBoolean("eh_aggressive_page_loading", false) + fun aggressivePageLoading() = preferenceStore.getBoolean("eh_aggressive_page_loading", false) - fun preloadSize() = this.preferenceStore.getInt("eh_preload_size", 10) + fun preloadSize() = preferenceStore.getInt("eh_preload_size", 10) - fun useAutoWebtoon() = this.preferenceStore.getBoolean("eh_use_auto_webtoon", true) + fun useAutoWebtoon() = preferenceStore.getBoolean("eh_use_auto_webtoon", true) - fun exhWatchedListDefaultState() = this.preferenceStore.getBoolean("eh_watched_list_default_state", false) + fun exhWatchedListDefaultState() = preferenceStore.getBoolean("eh_watched_list_default_state", false) - fun exhSettingsLanguages() = this.preferenceStore.getString( + fun exhSettingsLanguages() = preferenceStore.getString( "eh_settings_languages", "false*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false", ) - fun exhEnabledCategories() = this.preferenceStore.getString( + fun exhEnabledCategories() = preferenceStore.getString( "eh_enabled_categories", "false,false,false,false,false,false,false,false,false,false", ) - fun feedTabInFront() = this.preferenceStore.getBoolean("latest_tab_position", false) + fun feedTabInFront() = preferenceStore.getBoolean("latest_tab_position", false) - fun sourceSorting() = this.preferenceStore.getInt("sources_sort", 0) + fun sourceSorting() = preferenceStore.getInt("sources_sort", 0) - fun recommendsInOverflow() = this.preferenceStore.getBoolean("recommends_in_overflow", false) + fun recommendsInOverflow() = preferenceStore.getBoolean("recommends_in_overflow", false) - fun mergeInOverflow() = this.preferenceStore.getBoolean("merge_in_overflow", false) + fun mergeInOverflow() = preferenceStore.getBoolean("merge_in_overflow", false) - fun enhancedEHentaiView() = this.preferenceStore.getBoolean("enhanced_e_hentai_view", true) + fun enhancedEHentaiView() = preferenceStore.getBoolean("enhanced_e_hentai_view", true) - fun webtoonEnableZoomOut() = this.preferenceStore.getBoolean("webtoon_enable_zoom_out", false) + fun webtoonEnableZoomOut() = preferenceStore.getBoolean("webtoon_enable_zoom_out", false) - fun continuousVerticalTappingByPage() = this.preferenceStore.getBoolean("continuous_vertical_tapping_by_page", false) + fun continuousVerticalTappingByPage() = preferenceStore.getBoolean("continuous_vertical_tapping_by_page", false) - fun useNewSourceNavigation() = this.preferenceStore.getBoolean("use_new_source_navigation", true) + fun useNewSourceNavigation() = preferenceStore.getBoolean("use_new_source_navigation", true) - fun preferredMangaDexId() = this.preferenceStore.getString("preferred_mangaDex_id", "0") + fun preferredMangaDexId() = preferenceStore.getString("preferred_mangaDex_id", "0") - fun mangadexSyncToLibraryIndexes() = this.preferenceStore.getStringSet("pref_mangadex_sync_to_library_indexes", emptySet()) + fun mangadexSyncToLibraryIndexes() = preferenceStore.getStringSet("pref_mangadex_sync_to_library_indexes", emptySet()) - fun allowLocalSourceHiddenFolders() = this.preferenceStore.getBoolean("allow_local_source_hidden_folders", false) + fun allowLocalSourceHiddenFolders() = preferenceStore.getBoolean("allow_local_source_hidden_folders", false) - fun extensionRepos() = this.preferenceStore.getStringSet("extension_repos", emptySet()) + fun extensionRepos() = preferenceStore.getStringSet("extension_repos", emptySet()) - fun cropBordersContinuousVertical() = this.preferenceStore.getBoolean("crop_borders_continues_vertical", false) + fun cropBordersContinuousVertical() = preferenceStore.getBoolean("crop_borders_continues_vertical", false) - fun forceHorizontalSeekbar() = this.preferenceStore.getBoolean("pref_force_horz_seekbar", false) + fun forceHorizontalSeekbar() = preferenceStore.getBoolean("pref_force_horz_seekbar", false) - fun landscapeVerticalSeekbar() = this.preferenceStore.getBoolean("pref_show_vert_seekbar_landscape", false) + fun landscapeVerticalSeekbar() = preferenceStore.getBoolean("pref_show_vert_seekbar_landscape", false) - fun leftVerticalSeekbar() = this.preferenceStore.getBoolean("pref_left_handed_vertical_seekbar", false) + fun leftVerticalSeekbar() = preferenceStore.getBoolean("pref_left_handed_vertical_seekbar", false) - fun readerBottomButtons() = this.preferenceStore.getStringSet("reader_bottom_buttons", ReaderBottomButton.BUTTONS_DEFAULTS) + fun readerBottomButtons() = preferenceStore.getStringSet("reader_bottom_buttons", ReaderBottomButton.BUTTONS_DEFAULTS) - fun bottomBarLabels() = this.preferenceStore.getBoolean("pref_show_bottom_bar_labels", true) + fun bottomBarLabels() = preferenceStore.getBoolean("pref_show_bottom_bar_labels", true) - fun showNavUpdates() = this.preferenceStore.getBoolean("pref_show_updates_button", true) + fun showNavUpdates() = preferenceStore.getBoolean("pref_show_updates_button", true) - fun showNavHistory() = this.preferenceStore.getBoolean("pref_show_history_button", true) + fun showNavHistory() = preferenceStore.getBoolean("pref_show_history_button", true) - fun pageLayout() = this.preferenceStore.getInt("page_layout", PagerConfig.PageLayout.AUTOMATIC) + fun pageLayout() = preferenceStore.getInt("page_layout", PagerConfig.PageLayout.AUTOMATIC) - fun centerMarginType() = this.preferenceStore.getInt("center_margin_type", PagerConfig.CenterMarginType.NONE) + fun centerMarginType() = preferenceStore.getInt("center_margin_type", PagerConfig.CenterMarginType.NONE) - fun invertDoublePages() = this.preferenceStore.getBoolean("invert_double_pages", false) + fun invertDoublePages() = preferenceStore.getBoolean("invert_double_pages", false) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt index 6603d3dd9..2e1fae8b8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt @@ -83,7 +83,6 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy import java.io.File -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsAdvancedController( private val mangaRepository: MangaRepository = Injekt.get(), @@ -184,9 +183,8 @@ class SettingsAdvancedController( } // SY <-- switchPreference { - key = Keys.autoClearChapterCache + bindTo(preferences.autoClearChapterCache()) titleRes = R.string.pref_auto_clear_chapter_cache - defaultValue = false } preference { key = "pref_clear_database" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt index fcf6ae368..7101fc7bd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt @@ -17,7 +17,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.util.preference.bindTo -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.intListPreference @@ -38,7 +37,6 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy import java.io.File -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsDownloadController : SettingsController() { @@ -66,9 +64,8 @@ class SettingsDownloadController : SettingsController() { .launchIn(viewScope) } switchPreference { - key = Keys.downloadOnlyOverWifi + bindTo(preferences.downloadOnlyOverWifi()) titleRes = R.string.connected_to_wifi - defaultValue = true } switchPreference { bindTo(preferences.saveChaptersAsCBZ()) @@ -84,12 +81,11 @@ class SettingsDownloadController : SettingsController() { titleRes = R.string.pref_category_delete_chapters switchPreference { - key = Keys.removeAfterMarkedAsRead + bindTo(preferences.removeAfterMarkedAsRead()) titleRes = R.string.pref_remove_after_marked_as_read - defaultValue = false } intListPreference { - key = Keys.removeAfterReadSlots + bindTo(preferences.removeAfterReadSlots()) titleRes = R.string.pref_remove_after_read entriesRes = arrayOf( R.string.disabled, @@ -100,13 +96,11 @@ class SettingsDownloadController : SettingsController() { R.string.fifth_to_last, ) entryValues = arrayOf("-1", "0", "1", "2", "3", "4") - defaultValue = "-1" summary = "%s" } switchPreference { - key = Keys.removeBookmarkedChapters + bindTo(preferences.removeBookmarkedChapters()) titleRes = R.string.pref_remove_bookmarked_chapters - defaultValue = false } multiSelectListPreference { bindTo(preferences.removeExcludeCategories()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index ea7bd2c51..83cf36ed6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -9,7 +9,6 @@ import androidx.preference.PreferenceScreen import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.preference.bindTo -import eu.kanade.tachiyomi.util.preference.defaultValue import eu.kanade.tachiyomi.util.preference.listPreference import eu.kanade.tachiyomi.util.preference.onChange import eu.kanade.tachiyomi.util.preference.onClick @@ -21,7 +20,6 @@ import eu.kanade.tachiyomi.util.preference.titleRes import eu.kanade.tachiyomi.util.system.LocaleHelper import org.xmlpull.v1.XmlPullParser import uy.kohesive.injekt.injectLazy -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsGeneralController : SettingsController() { @@ -35,9 +33,8 @@ class SettingsGeneralController : SettingsController() { titleRes = R.string.pref_library_update_show_tab_badge } switchPreference { - key = Keys.confirmExit + bindTo(preferences.confirmExit()) titleRes = R.string.pref_confirm_exit - defaultValue = false } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { preference { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index 2162d8af7..aa364045b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -50,7 +50,6 @@ import kotlinx.coroutines.runBlocking import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsLibraryController : SettingsController() { @@ -298,17 +297,15 @@ class SettingsLibraryController : SettingsController() { } // SY <-- switchPreference { - key = Keys.autoUpdateMetadata + bindTo(preferences.autoUpdateMetadata()) titleRes = R.string.pref_library_update_refresh_metadata summaryRes = R.string.pref_library_update_refresh_metadata_summary - defaultValue = false } if (trackManager.hasLoggedServices()) { switchPreference { - key = Keys.autoUpdateTrackers + bindTo(preferences.autoUpdateTrackers()) titleRes = R.string.pref_library_update_refresh_trackers summaryRes = R.string.pref_library_update_refresh_trackers_summary - defaultValue = false } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt index e1011a13b..4aa5436fa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt @@ -15,7 +15,6 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderBottomButton import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig import eu.kanade.tachiyomi.util.preference.bindTo -import eu.kanade.tachiyomi.util.preference.defaultValue import eu.kanade.tachiyomi.util.preference.entriesRes import eu.kanade.tachiyomi.util.preference.intListPreference import eu.kanade.tachiyomi.util.preference.listPreference @@ -28,7 +27,6 @@ import eu.kanade.tachiyomi.util.preference.titleRes import eu.kanade.tachiyomi.util.system.hasDisplayCutout import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsReaderController : SettingsController() { @@ -36,7 +34,7 @@ class SettingsReaderController : SettingsController() { titleRes = R.string.pref_category_reader intListPreference { - key = Keys.defaultReadingMode + bindTo(preferences.defaultReadingMode()) titleRes = R.string.pref_viewer_type entriesRes = arrayOf( R.string.left_to_right_viewer, @@ -47,7 +45,6 @@ class SettingsReaderController : SettingsController() { ) entryValues = ReadingModeType.values().drop(1) .map { value -> "${value.flagValue}" }.toTypedArray() - defaultValue = "${ReadingModeType.RIGHT_TO_LEFT.flagValue}" summary = "%s" } intListPreference { @@ -58,10 +55,9 @@ class SettingsReaderController : SettingsController() { summary = "%s" } switchPreference { - key = Keys.showReadingMode + bindTo(preferences.showReadingMode()) titleRes = R.string.pref_show_reading_mode summaryRes = R.string.pref_show_reading_mode_summary - defaultValue = true } switchPreference { bindTo(preferences.showNavigationOverlayOnStart()) @@ -99,7 +95,7 @@ class SettingsReaderController : SettingsController() { titleRes = R.string.pref_category_display intListPreference { - key = Keys.defaultOrientationType + bindTo(preferences.defaultOrientationType()) titleRes = R.string.pref_rotation_type entriesRes = arrayOf( R.string.rotation_free, @@ -111,7 +107,6 @@ class SettingsReaderController : SettingsController() { ) entryValues = OrientationType.values().drop(1) .map { value -> "${value.flagValue}" }.toTypedArray() - defaultValue = "${OrientationType.FREE.flagValue}" summary = "%s" } intListPreference { @@ -149,14 +144,12 @@ class SettingsReaderController : SettingsController() { titleRes = R.string.pref_category_reading switchPreference { - key = Keys.skipRead + bindTo(preferences.skipRead()) titleRes = R.string.pref_skip_read_chapters - defaultValue = false } switchPreference { - key = Keys.skipFiltered + bindTo(preferences.skipFiltered()) titleRes = R.string.pref_skip_filtered_chapters - defaultValue = true } switchPreference { bindTo(preferences.alwaysShowChapterTransition()) @@ -376,10 +369,9 @@ class SettingsReaderController : SettingsController() { titleRes = R.string.pref_read_with_long_tap } switchPreference { - key = Keys.folderPerManga + bindTo(preferences.folderPerManga()) titleRes = R.string.pref_create_folder_per_manga summaryRes = R.string.pref_create_folder_per_manga_summary - defaultValue = false } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt index 8950d9471..5cc83f923 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt @@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.ui.setting.track.TrackLoginDialog import eu.kanade.tachiyomi.ui.setting.track.TrackLogoutDialog import eu.kanade.tachiyomi.util.preference.add -import eu.kanade.tachiyomi.util.preference.defaultValue +import eu.kanade.tachiyomi.util.preference.bindTo import eu.kanade.tachiyomi.util.preference.iconRes import eu.kanade.tachiyomi.util.preference.infoPreference import eu.kanade.tachiyomi.util.preference.onClick @@ -44,9 +44,8 @@ class SettingsTrackingController : titleRes = R.string.pref_category_tracking switchPreference { - key = Keys.autoUpdateTrack + bindTo(preferences.autoUpdateTrack()) titleRes = R.string.pref_auto_update_manga_sync - defaultValue = true } preferenceCategory { diff --git a/core/src/main/java/eu/kanade/tachiyomi/core/security/SecurityPreferences.kt b/core/src/main/java/eu/kanade/tachiyomi/core/security/SecurityPreferences.kt index 41343fbfe..76c654921 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/core/security/SecurityPreferences.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/core/security/SecurityPreferences.kt @@ -8,13 +8,13 @@ class SecurityPreferences( private val preferenceStore: PreferenceStore ) { - fun useAuthenticator() = this.preferenceStore.getBoolean("use_biometric_lock", false) + fun useAuthenticator() = preferenceStore.getBoolean("use_biometric_lock", false) - fun lockAppAfter() = this.preferenceStore.getInt("lock_app_after", 0) + fun lockAppAfter() = preferenceStore.getInt("lock_app_after", 0) - fun secureScreen() = this.preferenceStore.getEnum("secure_screen_v2", SecureScreenMode.INCOGNITO) + fun secureScreen() = preferenceStore.getEnum("secure_screen_v2", SecureScreenMode.INCOGNITO) - fun hideNotificationContent() = this.preferenceStore.getBoolean("hide_notification_content", false) + fun hideNotificationContent() = preferenceStore.getBoolean("hide_notification_content", false) // SY --> fun authenticatorTimeRanges() = this.preferenceStore.getStringSet("biometric_time_ranges", mutableSetOf()) @@ -26,7 +26,7 @@ class SecurityPreferences( * For app lock. Will be set when there is a pending timed lock. * Otherwise this pref should be deleted. */ - fun lastAppClosed() = this.preferenceStore.getLong("last_app_closed", 0) + fun lastAppClosed() = preferenceStore.getLong("last_app_closed", 0) enum class SecureScreenMode(val titleResId: Int) { ALWAYS(R.string.lock_always), diff --git a/core/src/main/java/exh/pref/DelegateSourcePreferences.kt b/core/src/main/java/exh/pref/DelegateSourcePreferences.kt index 34d0c732e..09565361c 100644 --- a/core/src/main/java/exh/pref/DelegateSourcePreferences.kt +++ b/core/src/main/java/exh/pref/DelegateSourcePreferences.kt @@ -1,17 +1,12 @@ package exh.pref -import eu.kanade.tachiyomi.core.preference.Preference import eu.kanade.tachiyomi.core.preference.PreferenceStore class DelegateSourcePreferences( private val preferenceStore: PreferenceStore, ) { - fun delegateSources(): Preference { - return preferenceStore.getBoolean("eh_delegate_sources", true) - } + fun delegateSources() = preferenceStore.getBoolean("eh_delegate_sources", true) - fun useJapaneseTitle(): Preference { - return preferenceStore.getBoolean("use_jp_title", false) - } + fun useJapaneseTitle() = preferenceStore.getBoolean("use_jp_title", false) }