Reduce redundancy in some preference declarations
The remaining ones could also be converted to FlowPreferences for this, but it's not really necessary. (cherry picked from commit f3718257f50e595dbbf04c8d2e90a21fb4d80c09) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt # app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsSheet.kt # app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBrowseController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSecurityController.kt
This commit is contained in:
parent
c5819fe96f
commit
572eb0cceb
@ -5,142 +5,28 @@ package eu.kanade.tachiyomi.data.preference
|
||||
*/
|
||||
object PreferenceKeys {
|
||||
|
||||
const val themeMode = "pref_theme_mode_key"
|
||||
|
||||
const val appTheme = "pref_app_theme"
|
||||
|
||||
const val themeDarkAmoled = "pref_theme_dark_amoled_key"
|
||||
|
||||
const val confirmExit = "pref_confirm_exit"
|
||||
|
||||
const val hideBottomBarOnScroll = "pref_hide_bottom_bar_on_scroll"
|
||||
|
||||
const val sideNavIconAlignment = "pref_side_nav_icon_alignment"
|
||||
|
||||
const val enableTransitionsPager = "pref_enable_transitions_pager_key"
|
||||
|
||||
const val enableTransitionsWebtoon = "pref_enable_transitions_webtoon_key"
|
||||
|
||||
const val doubleTapAnimationSpeed = "pref_double_tap_anim_speed"
|
||||
|
||||
const val showPageNumber = "pref_show_page_number_key"
|
||||
|
||||
const val dualPageSplitPaged = "pref_dual_page_split"
|
||||
|
||||
const val dualPageSplitWebtoon = "pref_dual_page_split_webtoon"
|
||||
|
||||
const val dualPageInvertPaged = "pref_dual_page_invert"
|
||||
|
||||
const val dualPageInvertWebtoon = "pref_dual_page_invert_webtoon"
|
||||
|
||||
const val showReadingMode = "pref_show_reading_mode"
|
||||
|
||||
const val trueColor = "pref_true_color_key"
|
||||
|
||||
const val fullscreen = "fullscreen"
|
||||
|
||||
const val cutoutShort = "cutout_short"
|
||||
|
||||
const val keepScreenOn = "pref_keep_screen_on_key"
|
||||
|
||||
const val customBrightness = "pref_custom_brightness_key"
|
||||
|
||||
const val customBrightnessValue = "custom_brightness_value"
|
||||
|
||||
const val colorFilter = "pref_color_filter_key"
|
||||
|
||||
const val colorFilterValue = "color_filter_value"
|
||||
|
||||
const val colorFilterMode = "color_filter_mode"
|
||||
|
||||
const val grayscale = "pref_grayscale"
|
||||
|
||||
const val invertedColors = "pref_inverted_colors"
|
||||
|
||||
const val defaultReadingMode = "pref_default_reading_mode_key"
|
||||
|
||||
const val defaultOrientationType = "pref_default_orientation_type_key"
|
||||
|
||||
const val imageScaleType = "pref_image_scale_type_key"
|
||||
|
||||
const val zoomStart = "pref_zoom_start_key"
|
||||
|
||||
const val readerTheme = "pref_reader_theme_key"
|
||||
|
||||
const val cropBorders = "crop_borders"
|
||||
|
||||
const val cropBordersWebtoon = "crop_borders_webtoon"
|
||||
|
||||
const val readWithTapping = "reader_tap"
|
||||
|
||||
const val pagerNavInverted = "reader_tapping_inverted"
|
||||
|
||||
const val webtoonNavInverted = "reader_tapping_inverted_webtoon"
|
||||
|
||||
const val readWithLongTap = "reader_long_tap"
|
||||
|
||||
const val readWithVolumeKeys = "reader_volume_keys"
|
||||
|
||||
const val readWithVolumeKeysInverted = "reader_volume_keys_inverted"
|
||||
|
||||
const val navigationModePager = "reader_navigation_mode_pager"
|
||||
|
||||
const val navigationModeWebtoon = "reader_navigation_mode_webtoon"
|
||||
|
||||
const val showNavigationOverlayNewUser = "reader_navigation_overlay_new_user"
|
||||
|
||||
const val showNavigationOverlayOnStart = "reader_navigation_overlay_on_start"
|
||||
|
||||
const val readerHideThreshold = "reader_hide_threshold"
|
||||
|
||||
const val webtoonSidePadding = "webtoon_side_padding"
|
||||
|
||||
const val portraitColumns = "pref_library_columns_portrait_key"
|
||||
|
||||
const val landscapeColumns = "pref_library_columns_landscape_key"
|
||||
|
||||
const val jumpToChapters = "jump_to_chapters"
|
||||
|
||||
const val autoUpdateTrack = "pref_auto_update_manga_sync_key"
|
||||
|
||||
const val lastUsedSource = "last_catalogue_source"
|
||||
|
||||
const val lastUsedCategory = "last_used_category"
|
||||
|
||||
const val sourceDisplayMode = "pref_display_mode_catalogue"
|
||||
|
||||
const val enabledLanguages = "source_languages"
|
||||
|
||||
const val backupDirectory = "backup_directory"
|
||||
|
||||
const val downloadsDirectory = "download_directory"
|
||||
|
||||
const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key"
|
||||
|
||||
const val folderPerManga = "create_folder_per_manga"
|
||||
|
||||
const val numberOfBackups = "backup_slots"
|
||||
|
||||
const val backupInterval = "backup_interval"
|
||||
|
||||
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 libraryUpdateInterval = "pref_library_update_interval_key"
|
||||
|
||||
const val libraryUpdateDeviceRestriction = "library_update_restriction"
|
||||
const val libraryUpdateMangaRestriction = "library_update_manga_restriction"
|
||||
|
||||
const val showUpdatesNavBadge = "library_update_show_tab_badge"
|
||||
|
||||
const val libraryUpdateCategories = "library_update_categories"
|
||||
const val libraryUpdateCategoriesExclude = "library_update_categories_exclude"
|
||||
|
||||
const val downloadedOnly = "pref_downloaded_only"
|
||||
|
||||
const val filterDownloaded = "pref_filter_library_downloaded"
|
||||
|
||||
const val filterUnread = "pref_filter_library_unread"
|
||||
@ -159,59 +45,22 @@ object PreferenceKeys {
|
||||
const val migrationSortingMode = "pref_migration_sorting"
|
||||
const val migrationSortingDirection = "pref_migration_direction"
|
||||
|
||||
const val automaticExtUpdates = "automatic_ext_updates"
|
||||
|
||||
const val showNsfwSource = "show_nsfw_source"
|
||||
|
||||
const val startScreen = "start_screen"
|
||||
|
||||
const val useAuthenticator = "use_biometric_lock"
|
||||
|
||||
const val lockAppAfter = "lock_app_after"
|
||||
|
||||
const val lastAppUnlock = "last_app_unlock"
|
||||
|
||||
const val secureScreen = "secure_screen"
|
||||
|
||||
const val hideNotificationContent = "hide_notification_content"
|
||||
|
||||
const val autoUpdateMetadata = "auto_update_metadata"
|
||||
|
||||
const val autoUpdateTrackers = "auto_update_trackers"
|
||||
|
||||
const val downloadNew = "download_new"
|
||||
|
||||
const val downloadNewCategories = "download_new_categories"
|
||||
const val downloadNewCategoriesExclude = "download_new_categories_exclude"
|
||||
const val removeExcludeCategories = "remove_exclude_categories"
|
||||
|
||||
const val libraryDisplayMode = "pref_display_mode_library"
|
||||
|
||||
const val relativeTime: String = "relative_time"
|
||||
const val dateFormat = "app_date_format"
|
||||
|
||||
const val defaultCategory = "default_category"
|
||||
|
||||
const val categorizedDisplay = "categorized_display"
|
||||
|
||||
const val skipRead = "skip_read"
|
||||
|
||||
const val skipFiltered = "skip_filtered"
|
||||
|
||||
const val downloadBadge = "display_download_badge"
|
||||
|
||||
const val unreadBadge = "display_unread_badge"
|
||||
|
||||
const val languageBadge = "display_language_badge"
|
||||
|
||||
const val localBadge = "display_local_badge"
|
||||
|
||||
const val categoryTabs = "display_category_tabs"
|
||||
|
||||
const val categoryNumberOfItems = "display_number_of_items"
|
||||
|
||||
const val alwaysShowChapterTransition = "always_show_chapter_transition"
|
||||
|
||||
const val searchPinnedSourcesOnly = "search_pinned_sources_only"
|
||||
|
||||
const val dohProvider = "doh_provider"
|
||||
@ -228,12 +77,6 @@ object PreferenceKeys {
|
||||
|
||||
const val defaultChapterDisplayByNameOrNumber = "default_chapter_display_by_name_or_number"
|
||||
|
||||
const val incognitoMode = "incognito_mode"
|
||||
|
||||
const val tabletUiMode = "tablet_ui_mode"
|
||||
|
||||
const val extensionInstaller = "extension_installer"
|
||||
|
||||
const val verboseLogging = "verbose_logging"
|
||||
|
||||
const val autoClearChapterCache = "auto_clear_chapter_cache"
|
||||
@ -244,163 +87,7 @@ object PreferenceKeys {
|
||||
|
||||
fun trackToken(syncId: Int) = "track_token_$syncId"
|
||||
|
||||
const val skipPreMigration = "skip_pre_migration"
|
||||
|
||||
const val hideNotFoundMigration = "hide_not_found_migration"
|
||||
|
||||
const val eh_showSyncIntro = "eh_show_sync_intro"
|
||||
|
||||
const val eh_readOnlySync = "eh_sync_read_only"
|
||||
|
||||
const val eh_lenientSync = "eh_lenient_sync"
|
||||
|
||||
const val eh_useOrigImages = "eh_useOrigImages"
|
||||
|
||||
const val eh_ehSettingsProfile = "eh_ehSettingsProfile"
|
||||
|
||||
const val eh_exhSettingsProfile = "eh_exhSettingsProfile"
|
||||
|
||||
const val eh_settingsKey = "eh_settingsKey"
|
||||
|
||||
const val eh_sessionCookie = "eh_sessionCookie"
|
||||
|
||||
const val eh_hathPerksCookie = "eh_hathPerksCookie"
|
||||
|
||||
const val eh_enableExHentai = "enable_exhentai"
|
||||
|
||||
const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning2"
|
||||
|
||||
const val eh_expandFilters = "eh_expand_filters"
|
||||
|
||||
const val eh_readerThreads = "eh_reader_threads"
|
||||
|
||||
const val eh_readerInstantRetry = "eh_reader_instant_retry"
|
||||
|
||||
const val eh_utilAutoscrollInterval = "eh_util_autoscroll_interval"
|
||||
|
||||
const val eh_cacheSize = "eh_cache_size"
|
||||
|
||||
const val eh_preserveReadingPosition = "eh_preserve_reading_position"
|
||||
|
||||
const val eh_autoSolveCaptchas = "eh_autosolve_captchas"
|
||||
|
||||
const val eh_delegateSources = "eh_delegate_sources"
|
||||
|
||||
// SY -->
|
||||
const val eh_logLevel = "eh_log_level"
|
||||
|
||||
const val eh_enableSourceBlacklist = "eh_enable_source_blacklist"
|
||||
|
||||
const val eh_autoUpdateFrequency = "eh_auto_update_frequency"
|
||||
|
||||
const val eh_autoUpdateRestrictions = "eh_auto_update_restrictions"
|
||||
|
||||
const val eh_autoUpdateStats = "eh_auto_update_stats"
|
||||
|
||||
const val eh_aggressivePageLoading = "eh_aggressive_page_loading"
|
||||
|
||||
const val eh_preload_size = "eh_preload_size"
|
||||
|
||||
const val eh_tag_filtering_value = "eh_tag_filtering_value"
|
||||
|
||||
const val eh_tag_watching_value = "eh_tag_watching_value"
|
||||
|
||||
const val eh_is_hentai_enabled = "eh_is_hentai_enabled"
|
||||
|
||||
const val eh_use_auto_webtoon = "eh_use_auto_webtoon"
|
||||
|
||||
const val eh_watched_list_default_state = "eh_watched_list_default_state"
|
||||
|
||||
const val eh_settings_languages = "eh_settings_languages"
|
||||
|
||||
const val eh_enabled_categories = "eh_enabled_categories"
|
||||
|
||||
const val eh_ehentai_quality = "ehentai_quality"
|
||||
|
||||
const val eh_enable_hah = "eh_enable_hah"
|
||||
|
||||
const val latest_tab_sources = "latest_tab_sources"
|
||||
|
||||
const val latest_tab_position = "latest_tab_position"
|
||||
|
||||
const val sources_tab_categories = "sources_tab_categories"
|
||||
|
||||
const val sources_tab_categories_filter = "sources_tab_categories_filter"
|
||||
|
||||
const val sources_tab_source_categories = "sources_tab_source_categories"
|
||||
|
||||
const val sourcesSort = "sources_sort"
|
||||
|
||||
const val recommendsInOverflow = "recommends_in_overflow"
|
||||
|
||||
const val enhancedEHentaiView = "enhanced_e_hentai_view"
|
||||
|
||||
const val webtoonEnableZoomOut = "webtoon_enable_zoom_out"
|
||||
|
||||
const val startReadingButton = "start_reading_button"
|
||||
|
||||
const val groupLibraryBy = "group_library_by"
|
||||
|
||||
const val continuousVerticalTappingByPage = "continuous_vertical_tapping_by_page"
|
||||
|
||||
const val groupLibraryUpdateType = "group_library_update_type"
|
||||
|
||||
const val useNewSourceNavigation = "use_new_source_navigation"
|
||||
|
||||
const val mangaDexForceLatestCovers = "manga_dex_force_latest_covers"
|
||||
|
||||
const val mangadexSyncToLibraryIndexes = "pref_mangadex_sync_to_library_indexes"
|
||||
|
||||
const val preferredMangaDexId = "preferred_mangaDex_id"
|
||||
|
||||
const val dataSaver = "data_saver"
|
||||
|
||||
const val ignoreJpeg = "ignore_jpeg"
|
||||
|
||||
const val ignoreGif = "ignore_gif"
|
||||
|
||||
const val dataSaverImageQuality = "data_saver_image_quality"
|
||||
|
||||
const val dataSaverImageFormatJpeg = "data_saver_image_format_jpeg"
|
||||
|
||||
const val dataSaverServer = "data_saver_server"
|
||||
|
||||
const val dataSaverColorBW = "data_saver_color_bw"
|
||||
|
||||
const val dataSaverExcludedSources = "data_saver_excluded"
|
||||
|
||||
const val dataSaverDownloaer = "data_saver_downloader"
|
||||
|
||||
const val saveChaptersAsCBZ = "save_chapter_as_cbz"
|
||||
|
||||
const val saveChaptersAsCBZLevel = "save_chapter_as_cbz_level"
|
||||
|
||||
const val allowLocalSourceHiddenFolders = "allow_local_source_hidden_folders"
|
||||
|
||||
const val authenticatorTimeRanges = "biometric_time_ranges"
|
||||
|
||||
const val authenticatorDays = "biometric_days"
|
||||
|
||||
const val sortTagsForLibrary = "sort_tags_for_library"
|
||||
|
||||
const val extensionRepos = "extension_repos"
|
||||
|
||||
const val cropBordersContinuousVertical = "crop_borders_continues_vertical"
|
||||
|
||||
const val landscapeVerticalSeekbar = "pref_show_vert_seekbar_landscape"
|
||||
|
||||
const val leftVerticalSeekbar = "pref_left_handed_vertical_seekbar"
|
||||
|
||||
const val forceHorizontalSeekbar = "pref_force_horz_seekbar"
|
||||
|
||||
const val readerBottomButtons = "reader_bottom_buttons"
|
||||
|
||||
const val bottomBarLabels = "pref_show_bottom_bar_labels"
|
||||
|
||||
const val showNavUpdates = "pref_show_updates_button"
|
||||
|
||||
const val showNavHistory = "pref_show_history_button"
|
||||
|
||||
const val pageLayout = "page_layout"
|
||||
|
||||
const val invertDoublePages = "invert_double_pages"
|
||||
// SY <--
|
||||
}
|
||||
|
@ -1,18 +1,20 @@
|
||||
package eu.kanade.tachiyomi.data.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.tfcporciuncula.flow.FlowSharedPreferences
|
||||
import com.tfcporciuncula.flow.Preference
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues.ThemeMode.system
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
import eu.kanade.tachiyomi.data.track.anilist.Anilist
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesController
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryGroup
|
||||
import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting
|
||||
import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting
|
||||
import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
|
||||
@ -71,17 +73,17 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun confirmExit() = prefs.getBoolean(Keys.confirmExit, false)
|
||||
|
||||
fun hideBottomBarOnScroll() = flowPrefs.getBoolean(Keys.hideBottomBarOnScroll, true)
|
||||
fun hideBottomBarOnScroll() = flowPrefs.getBoolean("pref_hide_bottom_bar_on_scroll", true)
|
||||
|
||||
fun sideNavIconAlignment() = flowPrefs.getInt(Keys.sideNavIconAlignment, 0)
|
||||
fun sideNavIconAlignment() = flowPrefs.getInt("pref_side_nav_icon_alignment", 0)
|
||||
|
||||
fun useAuthenticator() = flowPrefs.getBoolean(Keys.useAuthenticator, false)
|
||||
fun useAuthenticator() = flowPrefs.getBoolean("use_biometric_lock", false)
|
||||
|
||||
fun lockAppAfter() = flowPrefs.getInt(Keys.lockAppAfter, 0)
|
||||
fun lockAppAfter() = flowPrefs.getInt("lock_app_after", 0)
|
||||
|
||||
fun lastAppUnlock() = flowPrefs.getLong(Keys.lastAppUnlock, 0)
|
||||
fun lastAppUnlock() = flowPrefs.getLong("last_app_unlock", 0)
|
||||
|
||||
fun secureScreen() = flowPrefs.getBoolean(Keys.secureScreen, false)
|
||||
fun secureScreen() = flowPrefs.getBoolean("secure_screen", false)
|
||||
|
||||
fun hideNotificationContent() = prefs.getBoolean(Keys.hideNotificationContent, false)
|
||||
|
||||
@ -89,109 +91,117 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun autoUpdateTrackers() = prefs.getBoolean(Keys.autoUpdateTrackers, false)
|
||||
|
||||
fun themeMode() = flowPrefs.getEnum(Keys.themeMode, system)
|
||||
fun themeMode() = flowPrefs.getEnum(
|
||||
"pref_theme_mode_key",
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light }
|
||||
)
|
||||
|
||||
fun appTheme() = flowPrefs.getEnum(Keys.appTheme, Values.AppTheme.DEFAULT)
|
||||
fun appTheme() = flowPrefs.getEnum(
|
||||
"pref_app_theme",
|
||||
if (DynamicColors.isDynamicColorAvailable()) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT }
|
||||
)
|
||||
|
||||
fun themeDarkAmoled() = flowPrefs.getBoolean(Keys.themeDarkAmoled, false)
|
||||
fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false)
|
||||
|
||||
fun pageTransitionsPager() = flowPrefs.getBoolean(Keys.enableTransitionsPager, true)
|
||||
// SY -->
|
||||
fun pageTransitionsPager() = flowPrefs.getBoolean("pref_enable_transitions_pager_key", true)
|
||||
|
||||
fun pageTransitionsWebtoon() = flowPrefs.getBoolean(Keys.enableTransitionsWebtoon, true)
|
||||
fun pageTransitionsWebtoon() = flowPrefs.getBoolean("pref_enable_transitions_webtoon_key", true)
|
||||
// SY <--
|
||||
|
||||
fun doubleTapAnimSpeed() = flowPrefs.getInt(Keys.doubleTapAnimationSpeed, 500)
|
||||
fun doubleTapAnimSpeed() = flowPrefs.getInt("pref_double_tap_anim_speed", 500)
|
||||
|
||||
fun showPageNumber() = flowPrefs.getBoolean(Keys.showPageNumber, true)
|
||||
fun showPageNumber() = flowPrefs.getBoolean("pref_show_page_number_key", true)
|
||||
|
||||
fun dualPageSplitPaged() = flowPrefs.getBoolean(Keys.dualPageSplitPaged, false)
|
||||
fun dualPageSplitPaged() = flowPrefs.getBoolean("pref_dual_page_split", false)
|
||||
|
||||
fun dualPageSplitWebtoon() = flowPrefs.getBoolean(Keys.dualPageSplitWebtoon, false)
|
||||
fun dualPageSplitWebtoon() = flowPrefs.getBoolean("pref_dual_page_split_webtoon", false)
|
||||
|
||||
fun dualPageInvertPaged() = flowPrefs.getBoolean(Keys.dualPageInvertPaged, false)
|
||||
fun dualPageInvertPaged() = flowPrefs.getBoolean("pref_dual_page_invert", false)
|
||||
|
||||
fun dualPageInvertWebtoon() = flowPrefs.getBoolean(Keys.dualPageInvertWebtoon, false)
|
||||
fun dualPageInvertWebtoon() = flowPrefs.getBoolean("pref_dual_page_invert_webtoon", false)
|
||||
|
||||
fun showReadingMode() = prefs.getBoolean(Keys.showReadingMode, true)
|
||||
|
||||
fun trueColor() = flowPrefs.getBoolean(Keys.trueColor, false)
|
||||
fun trueColor() = flowPrefs.getBoolean("pref_true_color_key", false)
|
||||
|
||||
fun fullscreen() = flowPrefs.getBoolean(Keys.fullscreen, true)
|
||||
fun fullscreen() = flowPrefs.getBoolean("fullscreen", true)
|
||||
|
||||
fun cutoutShort() = flowPrefs.getBoolean(Keys.cutoutShort, true)
|
||||
fun cutoutShort() = flowPrefs.getBoolean("cutout_short", true)
|
||||
|
||||
fun keepScreenOn() = flowPrefs.getBoolean(Keys.keepScreenOn, true)
|
||||
fun keepScreenOn() = flowPrefs.getBoolean("pref_keep_screen_on_key", true)
|
||||
|
||||
fun customBrightness() = flowPrefs.getBoolean(Keys.customBrightness, false)
|
||||
fun customBrightness() = flowPrefs.getBoolean("pref_custom_brightness_key", false)
|
||||
|
||||
fun customBrightnessValue() = flowPrefs.getInt(Keys.customBrightnessValue, 0)
|
||||
fun customBrightnessValue() = flowPrefs.getInt("custom_brightness_value", 0)
|
||||
|
||||
fun colorFilter() = flowPrefs.getBoolean(Keys.colorFilter, false)
|
||||
fun colorFilter() = flowPrefs.getBoolean("pref_color_filter_key", false)
|
||||
|
||||
fun colorFilterValue() = flowPrefs.getInt(Keys.colorFilterValue, 0)
|
||||
fun colorFilterValue() = flowPrefs.getInt("color_filter_value", 0)
|
||||
|
||||
fun colorFilterMode() = flowPrefs.getInt(Keys.colorFilterMode, 0)
|
||||
fun colorFilterMode() = flowPrefs.getInt("color_filter_mode", 0)
|
||||
|
||||
fun grayscale() = flowPrefs.getBoolean(Keys.grayscale, false)
|
||||
fun grayscale() = flowPrefs.getBoolean("pref_grayscale", false)
|
||||
|
||||
fun invertedColors() = flowPrefs.getBoolean(Keys.invertedColors, false)
|
||||
fun invertedColors() = flowPrefs.getBoolean("pref_inverted_colors", false)
|
||||
|
||||
fun defaultReadingMode() = prefs.getInt(Keys.defaultReadingMode, ReadingModeType.RIGHT_TO_LEFT.flagValue)
|
||||
|
||||
fun defaultOrientationType() = prefs.getInt(Keys.defaultOrientationType, OrientationType.FREE.flagValue)
|
||||
|
||||
fun imageScaleType() = flowPrefs.getInt(Keys.imageScaleType, 1)
|
||||
fun imageScaleType() = flowPrefs.getInt("pref_image_scale_type_key", 1)
|
||||
|
||||
fun zoomStart() = flowPrefs.getInt(Keys.zoomStart, 1)
|
||||
fun zoomStart() = flowPrefs.getInt("pref_zoom_start_key", 1)
|
||||
|
||||
fun readerTheme() = flowPrefs.getInt(Keys.readerTheme, 3)
|
||||
fun readerTheme() = flowPrefs.getInt("pref_reader_theme_key", 3)
|
||||
|
||||
fun alwaysShowChapterTransition() = flowPrefs.getBoolean(Keys.alwaysShowChapterTransition, true)
|
||||
fun alwaysShowChapterTransition() = flowPrefs.getBoolean("always_show_chapter_transition", true)
|
||||
|
||||
fun cropBorders() = flowPrefs.getBoolean(Keys.cropBorders, false)
|
||||
fun cropBorders() = flowPrefs.getBoolean("crop_borders", false)
|
||||
|
||||
fun cropBordersWebtoon() = flowPrefs.getBoolean(Keys.cropBordersWebtoon, false)
|
||||
fun cropBordersWebtoon() = flowPrefs.getBoolean("crop_borders_webtoon", false)
|
||||
|
||||
fun webtoonSidePadding() = flowPrefs.getInt(Keys.webtoonSidePadding, 0)
|
||||
fun webtoonSidePadding() = flowPrefs.getInt("webtoon_side_padding", 0)
|
||||
|
||||
fun readWithTapping() = flowPrefs.getBoolean(Keys.readWithTapping, true)
|
||||
fun readWithTapping() = flowPrefs.getBoolean("reader_tap", true)
|
||||
|
||||
fun pagerNavInverted() = flowPrefs.getEnum(Keys.pagerNavInverted, Values.TappingInvertMode.NONE)
|
||||
fun pagerNavInverted() = flowPrefs.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE)
|
||||
|
||||
fun webtoonNavInverted() = flowPrefs.getEnum(Keys.webtoonNavInverted, Values.TappingInvertMode.NONE)
|
||||
fun webtoonNavInverted() = flowPrefs.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE)
|
||||
|
||||
fun readWithLongTap() = flowPrefs.getBoolean(Keys.readWithLongTap, true)
|
||||
fun readWithLongTap() = flowPrefs.getBoolean("reader_long_tap", true)
|
||||
|
||||
fun readWithVolumeKeys() = flowPrefs.getBoolean(Keys.readWithVolumeKeys, false)
|
||||
fun readWithVolumeKeys() = flowPrefs.getBoolean("reader_volume_keys", false)
|
||||
|
||||
fun readWithVolumeKeysInverted() = flowPrefs.getBoolean(Keys.readWithVolumeKeysInverted, false)
|
||||
fun readWithVolumeKeysInverted() = flowPrefs.getBoolean("reader_volume_keys_inverted", false)
|
||||
|
||||
fun navigationModePager() = flowPrefs.getInt(Keys.navigationModePager, 0)
|
||||
fun navigationModePager() = flowPrefs.getInt("reader_navigation_mode_pager", 0)
|
||||
|
||||
fun navigationModeWebtoon() = flowPrefs.getInt(Keys.navigationModeWebtoon, 0)
|
||||
fun navigationModeWebtoon() = flowPrefs.getInt("reader_navigation_mode_webtoon", 0)
|
||||
|
||||
fun showNavigationOverlayNewUser() = flowPrefs.getBoolean(Keys.showNavigationOverlayNewUser, true)
|
||||
fun showNavigationOverlayNewUser() = flowPrefs.getBoolean("reader_navigation_overlay_new_user", true)
|
||||
|
||||
fun showNavigationOverlayOnStart() = flowPrefs.getBoolean(Keys.showNavigationOverlayOnStart, false)
|
||||
fun showNavigationOverlayOnStart() = flowPrefs.getBoolean("reader_navigation_overlay_on_start", false)
|
||||
|
||||
fun readerHideTreshold() = flowPrefs.getEnum(Keys.readerHideThreshold, Values.ReaderHideThreshold.LOW)
|
||||
fun readerHideThreshold() = flowPrefs.getEnum("reader_hide_threshold", Values.ReaderHideThreshold.LOW)
|
||||
|
||||
fun portraitColumns() = flowPrefs.getInt(Keys.portraitColumns, 0)
|
||||
fun portraitColumns() = flowPrefs.getInt("pref_library_columns_portrait_key", 0)
|
||||
|
||||
fun landscapeColumns() = flowPrefs.getInt(Keys.landscapeColumns, 0)
|
||||
fun landscapeColumns() = flowPrefs.getInt("pref_library_columns_landscape_key", 0)
|
||||
|
||||
fun jumpToChapters() = prefs.getBoolean(Keys.jumpToChapters, false)
|
||||
|
||||
fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true)
|
||||
|
||||
fun lastUsedSource() = flowPrefs.getLong(Keys.lastUsedSource, -1)
|
||||
fun lastUsedSource() = flowPrefs.getLong("last_catalogue_source", -1)
|
||||
|
||||
fun lastUsedCategory() = flowPrefs.getInt(Keys.lastUsedCategory, 0)
|
||||
fun lastUsedCategory() = flowPrefs.getInt("last_used_category", 0)
|
||||
|
||||
fun lastVersionCode() = flowPrefs.getInt("last_version_code", 0)
|
||||
|
||||
fun sourceDisplayMode() = flowPrefs.getEnum(Keys.sourceDisplayMode, DisplayModeSetting.COMPACT_GRID)
|
||||
fun sourceDisplayMode() = flowPrefs.getEnum("pref_display_mode_catalogue", DisplayModeSetting.COMPACT_GRID)
|
||||
|
||||
fun enabledLanguages() = flowPrefs.getStringSet(Keys.enabledLanguages, setOf("all", "en", Locale.getDefault().language))
|
||||
fun enabledLanguages() = flowPrefs.getStringSet("source_languages", setOf("all", "en", Locale.getDefault().language))
|
||||
|
||||
fun trackUsername(sync: TrackService) = prefs.getString(Keys.trackUsername(sync.id), "")
|
||||
|
||||
@ -208,24 +218,24 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun anilistScoreType() = flowPrefs.getString("anilist_score_type", Anilist.POINT_10)
|
||||
|
||||
fun backupsDirectory() = flowPrefs.getString(Keys.backupDirectory, defaultBackupDir.toString())
|
||||
fun backupsDirectory() = flowPrefs.getString("backup_directory", defaultBackupDir.toString())
|
||||
|
||||
fun relativeTime() = flowPrefs.getInt(Keys.relativeTime, 7)
|
||||
fun relativeTime() = flowPrefs.getInt("relative_time", 7)
|
||||
|
||||
fun dateFormat(format: String = flowPrefs.getString(Keys.dateFormat, "").get()): DateFormat = when (format) {
|
||||
"" -> DateFormat.getDateInstance(DateFormat.SHORT)
|
||||
else -> SimpleDateFormat(format, Locale.getDefault())
|
||||
}
|
||||
|
||||
fun downloadsDirectory() = flowPrefs.getString(Keys.downloadsDirectory, defaultDownloadsDir.toString())
|
||||
fun downloadsDirectory() = flowPrefs.getString("download_directory", defaultDownloadsDir.toString())
|
||||
|
||||
fun downloadOnlyOverWifi() = prefs.getBoolean(Keys.downloadOnlyOverWifi, true)
|
||||
|
||||
fun folderPerManga() = prefs.getBoolean(Keys.folderPerManga, false)
|
||||
|
||||
fun numberOfBackups() = flowPrefs.getInt(Keys.numberOfBackups, 1)
|
||||
fun numberOfBackups() = flowPrefs.getInt("backup_slots", 1)
|
||||
|
||||
fun backupInterval() = flowPrefs.getInt(Keys.backupInterval, 0)
|
||||
fun backupInterval() = flowPrefs.getInt("backup_interval", 0)
|
||||
|
||||
fun removeAfterReadSlots() = prefs.getInt(Keys.removeAfterReadSlots, -1)
|
||||
|
||||
@ -233,34 +243,34 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun removeBookmarkedChapters() = prefs.getBoolean(Keys.removeBookmarkedChapters, false)
|
||||
|
||||
fun removeExcludeCategories() = flowPrefs.getStringSet(Keys.removeExcludeCategories, emptySet())
|
||||
fun removeExcludeCategories() = flowPrefs.getStringSet("remove_exclude_categories", emptySet())
|
||||
|
||||
fun libraryUpdateInterval() = flowPrefs.getInt(Keys.libraryUpdateInterval, 24)
|
||||
fun libraryUpdateInterval() = flowPrefs.getInt("pref_library_update_interval_key", 24)
|
||||
|
||||
fun libraryUpdateDeviceRestriction() = flowPrefs.getStringSet(Keys.libraryUpdateDeviceRestriction, setOf(DEVICE_ONLY_ON_WIFI))
|
||||
fun libraryUpdateMangaRestriction() = flowPrefs.getStringSet(Keys.libraryUpdateMangaRestriction, setOf(MANGA_FULLY_READ, MANGA_ONGOING))
|
||||
fun libraryUpdateDeviceRestriction() = flowPrefs.getStringSet("library_update_restriction", setOf(DEVICE_ONLY_ON_WIFI))
|
||||
fun libraryUpdateMangaRestriction() = flowPrefs.getStringSet("library_update_manga_restriction", setOf(MANGA_FULLY_READ, MANGA_ONGOING))
|
||||
|
||||
fun showUpdatesNavBadge() = flowPrefs.getBoolean(Keys.showUpdatesNavBadge, false)
|
||||
fun showUpdatesNavBadge() = flowPrefs.getBoolean("library_update_show_tab_badge", false)
|
||||
fun unreadUpdatesCount() = flowPrefs.getInt("library_unread_updates_count", 0)
|
||||
|
||||
fun libraryUpdateCategories() = flowPrefs.getStringSet(Keys.libraryUpdateCategories, emptySet())
|
||||
fun libraryUpdateCategoriesExclude() = flowPrefs.getStringSet(Keys.libraryUpdateCategoriesExclude, emptySet())
|
||||
fun libraryUpdateCategories() = flowPrefs.getStringSet("library_update_categories", emptySet())
|
||||
fun libraryUpdateCategoriesExclude() = flowPrefs.getStringSet("library_update_categories_exclude", emptySet())
|
||||
|
||||
fun libraryDisplayMode() = flowPrefs.getEnum(Keys.libraryDisplayMode, DisplayModeSetting.COMPACT_GRID)
|
||||
fun libraryDisplayMode() = flowPrefs.getEnum("pref_display_mode_library", DisplayModeSetting.COMPACT_GRID)
|
||||
|
||||
fun downloadBadge() = flowPrefs.getBoolean(Keys.downloadBadge, false)
|
||||
fun downloadBadge() = flowPrefs.getBoolean("display_download_badge", false)
|
||||
|
||||
fun localBadge() = flowPrefs.getBoolean(Keys.localBadge, true)
|
||||
fun localBadge() = flowPrefs.getBoolean("display_local_badge", true)
|
||||
|
||||
fun downloadedOnly() = flowPrefs.getBoolean(Keys.downloadedOnly, false)
|
||||
fun downloadedOnly() = flowPrefs.getBoolean("pref_downloaded_only", false)
|
||||
|
||||
fun unreadBadge() = flowPrefs.getBoolean(Keys.unreadBadge, true)
|
||||
fun unreadBadge() = flowPrefs.getBoolean("display_unread_badge", true)
|
||||
|
||||
fun languageBadge() = flowPrefs.getBoolean(Keys.languageBadge, false)
|
||||
fun languageBadge() = flowPrefs.getBoolean("display_language_badge", false)
|
||||
|
||||
fun categoryTabs() = flowPrefs.getBoolean(Keys.categoryTabs, true)
|
||||
fun categoryTabs() = flowPrefs.getBoolean("display_category_tabs", true)
|
||||
|
||||
fun categoryNumberOfItems() = flowPrefs.getBoolean(Keys.categoryNumberOfItems, false)
|
||||
fun categoryNumberOfItems() = flowPrefs.getBoolean("display_number_of_items", false)
|
||||
|
||||
fun filterDownloaded() = flowPrefs.getInt(Keys.filterDownloaded, ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value)
|
||||
|
||||
@ -280,9 +290,9 @@ class PreferencesHelper(val context: Context) {
|
||||
fun migrationSortingMode() = flowPrefs.getEnum(Keys.migrationSortingMode, MigrationSourcesController.SortSetting.ALPHABETICAL)
|
||||
fun migrationSortingDirection() = flowPrefs.getEnum(Keys.migrationSortingDirection, MigrationSourcesController.DirectionSetting.ASCENDING)
|
||||
|
||||
fun automaticExtUpdates() = flowPrefs.getBoolean(Keys.automaticExtUpdates, true)
|
||||
fun automaticExtUpdates() = flowPrefs.getBoolean("automatic_ext_updates", true)
|
||||
|
||||
fun showNsfwSource() = flowPrefs.getBoolean(Keys.showNsfwSource, true)
|
||||
fun showNsfwSource() = flowPrefs.getBoolean("show_nsfw_source", true)
|
||||
|
||||
fun extensionUpdatesCount() = flowPrefs.getInt("ext_updates_count", 0)
|
||||
|
||||
@ -295,14 +305,14 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun pinnedSources() = flowPrefs.getStringSet("pinned_catalogues", emptySet())
|
||||
|
||||
fun downloadNew() = flowPrefs.getBoolean(Keys.downloadNew, false)
|
||||
fun downloadNew() = flowPrefs.getBoolean("download_new", false)
|
||||
|
||||
fun downloadNewCategories() = flowPrefs.getStringSet(Keys.downloadNewCategories, emptySet())
|
||||
fun downloadNewCategoriesExclude() = flowPrefs.getStringSet(Keys.downloadNewCategoriesExclude, emptySet())
|
||||
fun downloadNewCategories() = flowPrefs.getStringSet("download_new_categories", emptySet())
|
||||
fun downloadNewCategoriesExclude() = flowPrefs.getStringSet("download_new_categories_exclude", emptySet())
|
||||
|
||||
fun defaultCategory() = prefs.getInt(Keys.defaultCategory, -1)
|
||||
|
||||
fun categorisedDisplaySettings() = flowPrefs.getBoolean(Keys.categorizedDisplay, false)
|
||||
fun categorizedDisplaySettings() = flowPrefs.getBoolean("categorized_display", false)
|
||||
|
||||
fun skipRead() = prefs.getBoolean(Keys.skipRead, false)
|
||||
|
||||
@ -328,12 +338,12 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun sortChapterByAscendingOrDescending() = prefs.getInt(Keys.defaultChapterSortByAscendingOrDescending, Manga.CHAPTER_SORT_DESC)
|
||||
|
||||
fun incognitoMode() = flowPrefs.getBoolean(Keys.incognitoMode, false)
|
||||
fun incognitoMode() = flowPrefs.getBoolean("incognito_mode", false)
|
||||
|
||||
fun tabletUiMode() = flowPrefs.getEnum(Keys.tabletUiMode, Values.TabletUiMode.AUTOMATIC)
|
||||
fun tabletUiMode() = flowPrefs.getEnum("tablet_ui_mode", Values.TabletUiMode.AUTOMATIC)
|
||||
|
||||
fun extensionInstaller() = flowPrefs.getEnum(
|
||||
Keys.extensionInstaller,
|
||||
"extension_installer",
|
||||
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER
|
||||
)
|
||||
|
||||
@ -361,60 +371,60 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun useSourceWithMost() = flowPrefs.getBoolean("use_source_with_most", false)
|
||||
|
||||
fun skipPreMigration() = flowPrefs.getBoolean(Keys.skipPreMigration, false)
|
||||
fun skipPreMigration() = flowPrefs.getBoolean("skip_pre_migration", false)
|
||||
|
||||
fun hideNotFoundMigration() = flowPrefs.getBoolean(Keys.hideNotFoundMigration, false)
|
||||
fun hideNotFoundMigration() = flowPrefs.getBoolean("hide_not_found_migration", false)
|
||||
|
||||
fun isHentaiEnabled() = flowPrefs.getBoolean(Keys.eh_is_hentai_enabled, true)
|
||||
fun isHentaiEnabled() = flowPrefs.getBoolean("eh_is_hentai_enabled", true)
|
||||
|
||||
fun enableExhentai() = flowPrefs.getBoolean(Keys.eh_enableExHentai, false)
|
||||
fun enableExhentai() = flowPrefs.getBoolean("enable_exhentai", false)
|
||||
|
||||
fun imageQuality() = flowPrefs.getString(Keys.eh_ehentai_quality, "auto")
|
||||
fun imageQuality() = flowPrefs.getString("ehentai_quality", "auto")
|
||||
|
||||
fun useHentaiAtHome() = flowPrefs.getInt(Keys.eh_enable_hah, 0)
|
||||
fun useHentaiAtHome() = flowPrefs.getInt("eh_enable_hah", 0)
|
||||
|
||||
fun useJapaneseTitle() = flowPrefs.getBoolean("use_jp_title", false)
|
||||
|
||||
fun exhUseOriginalImages() = flowPrefs.getBoolean(Keys.eh_useOrigImages, false)
|
||||
fun exhUseOriginalImages() = flowPrefs.getBoolean("eh_useOrigImages", false)
|
||||
|
||||
fun ehTagFilterValue() = flowPrefs.getInt(Keys.eh_tag_filtering_value, 0)
|
||||
fun ehTagFilterValue() = flowPrefs.getInt("eh_tag_filtering_value", 0)
|
||||
|
||||
fun ehTagWatchingValue() = flowPrefs.getInt(Keys.eh_tag_watching_value, 0)
|
||||
fun ehTagWatchingValue() = flowPrefs.getInt("eh_tag_watching_value", 0)
|
||||
|
||||
// EH Cookies
|
||||
fun memberIdVal() = flowPrefs.getString("eh_ipb_member_id", "")
|
||||
|
||||
fun passHashVal() = flowPrefs.getString("eh_ipb_pass_hash", "")
|
||||
fun igneousVal() = flowPrefs.getString("eh_igneous", "")
|
||||
fun ehSettingsProfile() = flowPrefs.getInt(Keys.eh_ehSettingsProfile, -1)
|
||||
fun exhSettingsProfile() = flowPrefs.getInt(Keys.eh_exhSettingsProfile, -1)
|
||||
fun exhSettingsKey() = flowPrefs.getString(Keys.eh_settingsKey, "")
|
||||
fun exhSessionCookie() = flowPrefs.getString(Keys.eh_sessionCookie, "")
|
||||
fun exhHathPerksCookies() = flowPrefs.getString(Keys.eh_hathPerksCookie, "")
|
||||
fun ehSettingsProfile() = flowPrefs.getInt("eh_ehSettingsProfile", -1)
|
||||
fun exhSettingsProfile() = flowPrefs.getInt("eh_exhSettingsProfile", -1)
|
||||
fun exhSettingsKey() = flowPrefs.getString("eh_settingsKey", "")
|
||||
fun exhSessionCookie() = flowPrefs.getString("eh_sessionCookie", "")
|
||||
fun exhHathPerksCookies() = flowPrefs.getString("eh_hathPerksCookie", "")
|
||||
|
||||
fun exhShowSyncIntro() = flowPrefs.getBoolean(Keys.eh_showSyncIntro, true)
|
||||
fun exhShowSyncIntro() = flowPrefs.getBoolean("eh_show_sync_intro", true)
|
||||
|
||||
fun exhReadOnlySync() = flowPrefs.getBoolean(Keys.eh_readOnlySync, false)
|
||||
fun exhReadOnlySync() = flowPrefs.getBoolean("eh_sync_read_only", false)
|
||||
|
||||
fun exhLenientSync() = flowPrefs.getBoolean(Keys.eh_lenientSync, false)
|
||||
fun exhLenientSync() = flowPrefs.getBoolean("eh_lenient_sync", false)
|
||||
|
||||
fun exhShowSettingsUploadWarning() = flowPrefs.getBoolean(Keys.eh_showSettingsUploadWarning, true)
|
||||
fun exhShowSettingsUploadWarning() = flowPrefs.getBoolean("eh_showSettingsUploadWarning2", true)
|
||||
|
||||
fun expandFilters() = flowPrefs.getBoolean(Keys.eh_expandFilters, false)
|
||||
fun expandFilters() = flowPrefs.getBoolean("eh_expand_filters", false)
|
||||
|
||||
fun readerThreads() = flowPrefs.getInt(Keys.eh_readerThreads, 2)
|
||||
fun readerThreads() = flowPrefs.getInt("eh_reader_threads", 2)
|
||||
|
||||
fun readerInstantRetry() = flowPrefs.getBoolean(Keys.eh_readerInstantRetry, true)
|
||||
fun readerInstantRetry() = flowPrefs.getBoolean("eh_reader_instant_retry", true)
|
||||
|
||||
fun autoscrollInterval() = flowPrefs.getFloat(Keys.eh_utilAutoscrollInterval, 3f)
|
||||
fun autoscrollInterval() = flowPrefs.getFloat("eh_util_autoscroll_interval", 3f)
|
||||
|
||||
fun cacheSize() = flowPrefs.getString(Keys.eh_cacheSize, "75")
|
||||
fun cacheSize() = flowPrefs.getString("eh_cache_size", "75")
|
||||
|
||||
fun preserveReadingPosition() = flowPrefs.getBoolean(Keys.eh_preserveReadingPosition, false)
|
||||
fun preserveReadingPosition() = flowPrefs.getBoolean("eh_preserve_reading_position", false)
|
||||
|
||||
fun autoSolveCaptcha() = flowPrefs.getBoolean(Keys.eh_autoSolveCaptchas, false)
|
||||
fun autoSolveCaptcha() = flowPrefs.getBoolean("eh_autosolve_captchas", false)
|
||||
|
||||
fun delegateSources() = flowPrefs.getBoolean(Keys.eh_delegateSources, true)
|
||||
fun delegateSources() = flowPrefs.getBoolean("eh_delegate_sources", true)
|
||||
|
||||
fun ehLastVersionCode() = flowPrefs.getInt("eh_last_version_code", 0)
|
||||
|
||||
@ -422,107 +432,113 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun logLevel() = flowPrefs.getInt(Keys.eh_logLevel, 0)
|
||||
|
||||
fun enableSourceBlacklist() = flowPrefs.getBoolean(Keys.eh_enableSourceBlacklist, true)
|
||||
fun enableSourceBlacklist() = flowPrefs.getBoolean("eh_enable_source_blacklist", true)
|
||||
|
||||
fun exhAutoUpdateFrequency() = flowPrefs.getInt(Keys.eh_autoUpdateFrequency, 1)
|
||||
fun exhAutoUpdateFrequency() = flowPrefs.getInt("eh_auto_update_frequency", 1)
|
||||
|
||||
fun exhAutoUpdateRequirements() = flowPrefs.getStringSet(Keys.eh_autoUpdateRestrictions, emptySet())
|
||||
fun exhAutoUpdateRequirements() = flowPrefs.getStringSet("eh_auto_update_restrictions", emptySet())
|
||||
|
||||
fun exhAutoUpdateStats() = flowPrefs.getString(Keys.eh_autoUpdateStats, "")
|
||||
fun exhAutoUpdateStats() = flowPrefs.getString("eh_auto_update_stats", "")
|
||||
|
||||
fun aggressivePageLoading() = flowPrefs.getBoolean(Keys.eh_aggressivePageLoading, false)
|
||||
fun aggressivePageLoading() = flowPrefs.getBoolean("eh_aggressive_page_loading", false)
|
||||
|
||||
fun preloadSize() = flowPrefs.getInt(Keys.eh_preload_size, 10)
|
||||
fun preloadSize() = flowPrefs.getInt("eh_preload_size", 10)
|
||||
|
||||
fun useAutoWebtoon() = flowPrefs.getBoolean(Keys.eh_use_auto_webtoon, true)
|
||||
fun useAutoWebtoon() = flowPrefs.getBoolean("eh_use_auto_webtoon", true)
|
||||
|
||||
fun exhWatchedListDefaultState() = flowPrefs.getBoolean(Keys.eh_watched_list_default_state, false)
|
||||
fun exhWatchedListDefaultState() = flowPrefs.getBoolean("eh_watched_list_default_state", false)
|
||||
|
||||
fun exhSettingsLanguages() = flowPrefs.getString(Keys.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 exhSettingsLanguages() = flowPrefs.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() = flowPrefs.getString(Keys.eh_enabled_categories, "false,false,false,false,false,false,false,false,false,false")
|
||||
fun exhEnabledCategories() = flowPrefs.getString(
|
||||
"eh_enabled_categories",
|
||||
"false,false,false,false,false,false,false,false,false,false"
|
||||
)
|
||||
|
||||
fun latestTabSources() = flowPrefs.getStringSet(Keys.latest_tab_sources, mutableSetOf())
|
||||
fun latestTabSources() = flowPrefs.getStringSet("latest_tab_sources", mutableSetOf())
|
||||
|
||||
fun latestTabInFront() = flowPrefs.getBoolean(Keys.latest_tab_position, false)
|
||||
fun latestTabInFront() = flowPrefs.getBoolean("latest_tab_position", false)
|
||||
|
||||
fun sourcesTabCategories() = flowPrefs.getStringSet(Keys.sources_tab_categories, mutableSetOf())
|
||||
fun sourcesTabCategories() = flowPrefs.getStringSet("sources_tab_categories", mutableSetOf())
|
||||
|
||||
fun sourcesTabCategoriesFilter() = flowPrefs.getBoolean(Keys.sources_tab_categories_filter, false)
|
||||
fun sourcesTabCategoriesFilter() = flowPrefs.getBoolean("sources_tab_categories_filter", false)
|
||||
|
||||
fun sourcesTabSourcesInCategories() = flowPrefs.getStringSet(Keys.sources_tab_source_categories, mutableSetOf())
|
||||
fun sourcesTabSourcesInCategories() = flowPrefs.getStringSet("sources_tab_source_categories", mutableSetOf())
|
||||
|
||||
fun sourceSorting() = flowPrefs.getInt(Keys.sourcesSort, 0)
|
||||
fun sourceSorting() = flowPrefs.getInt("sources_sort", 0)
|
||||
|
||||
fun recommendsInOverflow() = flowPrefs.getBoolean(Keys.recommendsInOverflow, false)
|
||||
fun recommendsInOverflow() = flowPrefs.getBoolean("recommends_in_overflow", false)
|
||||
|
||||
fun enhancedEHentaiView() = flowPrefs.getBoolean(Keys.enhancedEHentaiView, true)
|
||||
fun enhancedEHentaiView() = flowPrefs.getBoolean("enhanced_e_hentai_view", true)
|
||||
|
||||
fun webtoonEnableZoomOut() = flowPrefs.getBoolean(Keys.webtoonEnableZoomOut, false)
|
||||
fun webtoonEnableZoomOut() = flowPrefs.getBoolean("webtoon_enable_zoom_out", false)
|
||||
|
||||
fun startReadingButton() = flowPrefs.getBoolean(Keys.startReadingButton, true)
|
||||
fun startReadingButton() = flowPrefs.getBoolean("start_reading_button", true)
|
||||
|
||||
fun groupLibraryBy() = flowPrefs.getInt(Keys.groupLibraryBy, 0)
|
||||
fun groupLibraryBy() = flowPrefs.getInt("group_library_by", LibraryGroup.BY_DEFAULT)
|
||||
|
||||
fun continuousVerticalTappingByPage() = flowPrefs.getBoolean(Keys.continuousVerticalTappingByPage, false)
|
||||
fun continuousVerticalTappingByPage() = flowPrefs.getBoolean("continuous_vertical_tapping_by_page", false)
|
||||
|
||||
fun groupLibraryUpdateType() = flowPrefs.getEnum(Keys.groupLibraryUpdateType, Values.GroupLibraryMode.GLOBAL)
|
||||
fun groupLibraryUpdateType() = flowPrefs.getEnum("group_library_update_type", Values.GroupLibraryMode.GLOBAL)
|
||||
|
||||
fun useNewSourceNavigation() = flowPrefs.getBoolean(Keys.useNewSourceNavigation, true)
|
||||
fun useNewSourceNavigation() = flowPrefs.getBoolean("use_new_source_navigation", true)
|
||||
|
||||
fun preferredMangaDexId() = flowPrefs.getString(Keys.preferredMangaDexId, "0")
|
||||
fun preferredMangaDexId() = flowPrefs.getString("preferred_mangaDex_id", "0")
|
||||
|
||||
fun mangadexSyncToLibraryIndexes() = flowPrefs.getStringSet(Keys.mangadexSyncToLibraryIndexes, emptySet())
|
||||
fun mangadexSyncToLibraryIndexes() = flowPrefs.getStringSet("pref_mangadex_sync_to_library_indexes", emptySet())
|
||||
|
||||
fun dataSaver() = flowPrefs.getBoolean(Keys.dataSaver, false)
|
||||
fun dataSaver() = flowPrefs.getBoolean("data_saver", false)
|
||||
|
||||
fun ignoreJpeg() = flowPrefs.getBoolean(Keys.ignoreJpeg, false)
|
||||
fun dataSaverIgnoreJpeg() = flowPrefs.getBoolean("ignore_jpeg", false)
|
||||
|
||||
fun ignoreGif() = flowPrefs.getBoolean(Keys.ignoreGif, true)
|
||||
fun dataSaverIgnoreGif() = flowPrefs.getBoolean("ignore_gif", true)
|
||||
|
||||
fun dataSaverImageQuality() = flowPrefs.getInt(Keys.dataSaverImageQuality, 80)
|
||||
fun dataSaverImageQuality() = flowPrefs.getInt("data_saver_image_quality", 80)
|
||||
|
||||
fun dataSaverImageFormatJpeg() = flowPrefs.getBoolean(Keys.dataSaverImageFormatJpeg, false)
|
||||
fun dataSaverImageFormatJpeg() = flowPrefs.getBoolean("data_saver_image_format_jpeg", false)
|
||||
|
||||
fun dataSaverServer() = flowPrefs.getString(Keys.dataSaverServer, "")
|
||||
fun dataSaverServer() = flowPrefs.getString("data_saver_server", "")
|
||||
|
||||
fun dataSaverColorBW() = flowPrefs.getBoolean(Keys.dataSaverColorBW, false)
|
||||
fun dataSaverColorBW() = flowPrefs.getBoolean("data_saver_color_bw", false)
|
||||
|
||||
fun dataSaverExcludedSources() = flowPrefs.getStringSet(Keys.dataSaverExcludedSources, emptySet())
|
||||
fun dataSaverExcludedSources() = flowPrefs.getStringSet("data_saver_excluded", emptySet())
|
||||
|
||||
fun dataSaverDownloader() = flowPrefs.getBoolean(Keys.dataSaverDownloaer, true)
|
||||
fun dataSaverDownloader() = flowPrefs.getBoolean("data_saver_downloader", true)
|
||||
|
||||
fun saveChaptersAsCBZ() = flowPrefs.getBoolean(Keys.saveChaptersAsCBZ, false)
|
||||
fun saveChaptersAsCBZ() = flowPrefs.getBoolean("save_chapter_as_cbz", false)
|
||||
|
||||
fun saveChaptersAsCBZLevel() = flowPrefs.getInt(Keys.saveChaptersAsCBZLevel, 0)
|
||||
fun saveChaptersAsCBZLevel() = flowPrefs.getInt("save_chapter_as_cbz_level", 0)
|
||||
|
||||
fun allowLocalSourceHiddenFolders() = flowPrefs.getBoolean(Keys.allowLocalSourceHiddenFolders, false)
|
||||
fun allowLocalSourceHiddenFolders() = flowPrefs.getBoolean("allow_local_source_hidden_folders", false)
|
||||
|
||||
fun authenticatorTimeRanges() = flowPrefs.getStringSet(Keys.authenticatorTimeRanges, mutableSetOf())
|
||||
fun authenticatorTimeRanges() = flowPrefs.getStringSet("biometric_time_ranges", mutableSetOf())
|
||||
|
||||
fun authenticatorDays() = flowPrefs.getInt(Keys.authenticatorDays, 0x7F)
|
||||
fun authenticatorDays() = flowPrefs.getInt("biometric_days", 0x7F)
|
||||
|
||||
fun sortTagsForLibrary() = flowPrefs.getStringSet(Keys.sortTagsForLibrary, mutableSetOf())
|
||||
fun sortTagsForLibrary() = flowPrefs.getStringSet("sort_tags_for_library", mutableSetOf())
|
||||
|
||||
fun extensionRepos() = flowPrefs.getStringSet(Keys.extensionRepos, emptySet())
|
||||
fun extensionRepos() = flowPrefs.getStringSet("extension_repos", emptySet())
|
||||
|
||||
fun cropBordersContinuousVertical() = flowPrefs.getBoolean(Keys.cropBordersContinuousVertical, false)
|
||||
fun cropBordersContinuousVertical() = flowPrefs.getBoolean("crop_borders_continues_vertical", false)
|
||||
|
||||
fun forceHorizontalSeekbar() = flowPrefs.getBoolean(Keys.forceHorizontalSeekbar, false)
|
||||
fun forceHorizontalSeekbar() = flowPrefs.getBoolean("pref_force_horz_seekbar", false)
|
||||
|
||||
fun landscapeVerticalSeekbar() = flowPrefs.getBoolean(Keys.landscapeVerticalSeekbar, false)
|
||||
fun landscapeVerticalSeekbar() = flowPrefs.getBoolean("pref_show_vert_seekbar_landscape", false)
|
||||
|
||||
fun leftVerticalSeekbar() = flowPrefs.getBoolean(Keys.leftVerticalSeekbar, false)
|
||||
fun leftVerticalSeekbar() = flowPrefs.getBoolean("pref_left_handed_vertical_seekbar", false)
|
||||
|
||||
fun readerBottomButtons() = flowPrefs.getStringSet(Keys.readerBottomButtons, ReaderBottomButton.BUTTONS_DEFAULTS)
|
||||
fun readerBottomButtons() = flowPrefs.getStringSet("reader_bottom_buttons", ReaderBottomButton.BUTTONS_DEFAULTS)
|
||||
|
||||
fun bottomBarLabels() = flowPrefs.getBoolean(Keys.bottomBarLabels, true)
|
||||
fun bottomBarLabels() = flowPrefs.getBoolean("pref_show_bottom_bar_labels", true)
|
||||
|
||||
fun showNavUpdates() = flowPrefs.getBoolean(Keys.showNavUpdates, true)
|
||||
fun showNavUpdates() = flowPrefs.getBoolean("pref_show_updates_button", true)
|
||||
|
||||
fun showNavHistory() = flowPrefs.getBoolean(Keys.showNavHistory, true)
|
||||
fun showNavHistory() = flowPrefs.getBoolean("pref_show_history_button", true)
|
||||
|
||||
fun pageLayout() = flowPrefs.getInt(Keys.pageLayout, PagerConfig.PageLayout.AUTOMATIC)
|
||||
fun pageLayout() = flowPrefs.getInt("page_layout", PagerConfig.PageLayout.AUTOMATIC)
|
||||
|
||||
fun invertDoublePages() = flowPrefs.getBoolean(Keys.invertDoublePages, false)
|
||||
fun invertDoublePages() = flowPrefs.getBoolean("invert_double_pages", false)
|
||||
}
|
||||
|
@ -67,8 +67,10 @@ open class ExtensionPresenter(
|
||||
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||
|
||||
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
|
||||
.sortedWith(compareBy<Extension.Installed> { !it.isObsolete /* SY --> */ && !it.isRedundant /* SY <-- */ }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
||||
.sortedWith(
|
||||
compareBy<Extension.Installed> { !it.isObsolete /* SY --> */ && !it.isRedundant /* SY <-- */ }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
|
||||
)
|
||||
|
||||
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||
|
||||
|
@ -49,7 +49,7 @@ class LibraryAdapter(
|
||||
|
||||
private var boundViews = arrayListOf<View>()
|
||||
|
||||
private val isPerCategory by lazy { preferences.categorisedDisplaySettings().get() }
|
||||
private val isPerCategory by lazy { preferences.categorizedDisplaySettings().get() }
|
||||
private var currentDisplayMode = preferences.libraryDisplayMode().get()
|
||||
|
||||
init {
|
||||
|
@ -262,7 +262,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
// SY -->
|
||||
adapter.isLongPressDragEnabled = adapter.canDrag()
|
||||
var mangaForCategory = event.getMangaForCategory(category).orEmpty()
|
||||
if (preferences.categorisedDisplaySettings().get() && category.id != 0) {
|
||||
if (preferences.categorizedDisplaySettings().get() && category.id != 0) {
|
||||
if (SortModeSetting.fromFlag(category.sortMode) == SortModeSetting.DRAG_AND_DROP) {
|
||||
mangaForCategory = mangaForCategory.sortedBy {
|
||||
category.mangaOrder.indexOf(it.manga.id)
|
||||
@ -436,7 +436,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
} else {
|
||||
db.insertCategory(category).asRxObservable().subscribe()
|
||||
}
|
||||
if (preferences.categorisedDisplaySettings().get() && category.id != 0) {
|
||||
if (preferences.categorizedDisplaySettings().get() && category.id != 0) {
|
||||
if (SortModeSetting.fromFlag(category.sortMode) != SortModeSetting.DRAG_AND_DROP) {
|
||||
category.sortMode = SortModeSetting.DRAG_AND_DROP.flag
|
||||
category.sortDirection = SortDirectionSetting.ASCENDING.flag
|
||||
|
@ -230,7 +230,7 @@ class LibraryController(
|
||||
is LibrarySettingsSheet.Filter.FilterGroup -> onFilterChanged()
|
||||
is LibrarySettingsSheet.Sort.SortGroup -> onSortChanged()
|
||||
is LibrarySettingsSheet.Display.DisplayGroup -> {
|
||||
val delay = if (preferences.categorisedDisplaySettings().get()) 125L else 0L
|
||||
val delay = if (preferences.categorizedDisplaySettings().get()) 125L else 0L
|
||||
|
||||
Observable.timer(delay, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
|
@ -519,7 +519,7 @@ class LibraryPresenter(
|
||||
*/
|
||||
private fun getLibraryMangasObservable(): Observable<LibraryMap> {
|
||||
val defaultLibraryDisplayMode = preferences.libraryDisplayMode()
|
||||
val shouldSetFromCategory = preferences.categorisedDisplaySettings()
|
||||
val shouldSetFromCategory = preferences.categorizedDisplaySettings()
|
||||
return db.getLibraryMangas().asRxObservable()
|
||||
.map { list ->
|
||||
list.map { libraryManga ->
|
||||
|
@ -293,7 +293,7 @@ class LibrarySettingsSheet(
|
||||
SortDirectionSetting.DESCENDING
|
||||
}
|
||||
|
||||
if (preferences.categorisedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
if (preferences.categorizedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
currentCategory?.sortDirection = flag.flag
|
||||
|
||||
db.insertCategory(currentCategory!!).executeAsBlocking()
|
||||
@ -319,7 +319,7 @@ class LibrarySettingsSheet(
|
||||
else -> throw NotImplementedError("Unknown display mode")
|
||||
}
|
||||
|
||||
if (preferences.categorisedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
if (preferences.categorizedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
currentCategory?.sortMode = flag.flag
|
||||
|
||||
db.insertCategory(currentCategory!!).executeAsBlocking()
|
||||
@ -364,7 +364,7 @@ class LibrarySettingsSheet(
|
||||
|
||||
// Gets user preference of currently selected display mode at current category
|
||||
private fun getDisplayModePreference(): DisplayModeSetting {
|
||||
return if (preferences.categorisedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
return if (preferences.categorizedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
DisplayModeSetting.fromFlag(currentCategory?.displayMode)
|
||||
} else {
|
||||
preferences.libraryDisplayMode().get()
|
||||
@ -424,7 +424,7 @@ class LibrarySettingsSheet(
|
||||
else -> throw NotImplementedError("Unknown display mode")
|
||||
}
|
||||
|
||||
if (preferences.categorisedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
if (preferences.categorizedDisplaySettings().get() && currentCategory != null && currentCategory?.id != 0 /* SY --> */ && preferences.groupLibraryBy().get() == LibraryGroup.BY_DEFAULT /* SY <-- */) {
|
||||
currentCategory?.displayMode = flag.flag
|
||||
|
||||
db.insertCategory(currentCategory!!).executeAsBlocking()
|
||||
|
@ -15,7 +15,7 @@ enum class SortDirectionSetting(val flag: Int) {
|
||||
}
|
||||
|
||||
fun get(preferences: PreferencesHelper, category: Category?): SortDirectionSetting {
|
||||
return if (preferences.categorisedDisplaySettings().get() && category != null && category.id != 0) {
|
||||
return if (preferences.categorizedDisplaySettings().get() && category != null && category.id != 0) {
|
||||
fromFlag(category.sortDirection)
|
||||
} else {
|
||||
preferences.librarySortingAscending().get()
|
||||
|
@ -24,7 +24,7 @@ enum class SortModeSetting(val flag: Int) {
|
||||
}
|
||||
|
||||
fun get(preferences: PreferencesHelper, category: Category?): SortModeSetting {
|
||||
return if (preferences.categorisedDisplaySettings().get() && category != null && category.id != 0) {
|
||||
return if (preferences.categorizedDisplaySettings().get() && category != null && category.id != 0) {
|
||||
fromFlag(category.sortMode)
|
||||
} else {
|
||||
preferences.librarySortingMode().get()
|
||||
|
@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.ui.setting.SettingsBackupController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||
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.iconTint
|
||||
import eu.kanade.tachiyomi.util.preference.onClick
|
||||
@ -39,7 +39,6 @@ import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.subscriptions.CompositeSubscription
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class MoreController :
|
||||
SettingsController(),
|
||||
@ -61,7 +60,7 @@ class MoreController :
|
||||
add(MoreHeaderPreference(context))
|
||||
|
||||
switchPreference {
|
||||
key = Keys.downloadedOnly
|
||||
bindTo(preferences.downloadedOnly())
|
||||
titleRes = R.string.label_downloaded_only
|
||||
summaryRes = R.string.downloaded_only_summary
|
||||
iconRes = R.drawable.ic_cloud_off_24dp
|
||||
@ -69,12 +68,11 @@ class MoreController :
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.incognitoMode
|
||||
bindTo(preferences.incognitoMode())
|
||||
summaryRes = R.string.pref_incognito_mode_summary
|
||||
titleRes = R.string.pref_incognito_mode
|
||||
iconRes = R.drawable.ic_glasses_24dp
|
||||
iconTint = tintColor
|
||||
defaultValue = false
|
||||
|
||||
preferences.incognitoMode().asFlow()
|
||||
.onEach { isChecked = it }
|
||||
|
@ -76,7 +76,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
||||
|
||||
private val threshold: Int =
|
||||
Injekt.get<PreferencesHelper>()
|
||||
.readerHideTreshold()
|
||||
.readerHideThreshold()
|
||||
.get()
|
||||
.threshold
|
||||
|
||||
|
@ -32,6 +32,7 @@ import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController
|
||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
import eu.kanade.tachiyomi.util.lang.withUIContext
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.editTextPreference
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
@ -45,7 +46,6 @@ import eu.kanade.tachiyomi.util.preference.summaryRes
|
||||
import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isPackageInstalled
|
||||
import eu.kanade.tachiyomi.util.system.powerManager
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
@ -215,7 +215,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
titleRes = R.string.label_extensions
|
||||
|
||||
listPreference {
|
||||
key = Keys.extensionInstaller
|
||||
bindTo(preferences.extensionInstaller())
|
||||
titleRes = R.string.ext_installer_pref
|
||||
summary = "%s"
|
||||
entriesRes = arrayOf(
|
||||
@ -224,11 +224,6 @@ class SettingsAdvancedController : SettingsController() {
|
||||
R.string.ext_installer_shizuku,
|
||||
)
|
||||
entryValues = PreferenceValues.ExtensionInstaller.values().map { it.name }.toTypedArray()
|
||||
defaultValue = if (DeviceUtil.isMiui) {
|
||||
PreferenceValues.ExtensionInstaller.LEGACY
|
||||
} else {
|
||||
PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER
|
||||
}.name
|
||||
|
||||
onChange {
|
||||
if (it == PreferenceValues.ExtensionInstaller.SHIZUKU.name &&
|
||||
@ -254,12 +249,11 @@ class SettingsAdvancedController : SettingsController() {
|
||||
titleRes = R.string.pref_category_display
|
||||
|
||||
listPreference {
|
||||
key = Keys.tabletUiMode
|
||||
bindTo(preferences.tabletUiMode())
|
||||
titleRes = R.string.pref_tablet_ui_mode
|
||||
summary = "%s"
|
||||
entriesRes = arrayOf(R.string.automatic_background, R.string.lock_always, R.string.landscape, R.string.lock_never)
|
||||
entryValues = PreferenceValues.TabletUiMode.values().map { it.name }.toTypedArray()
|
||||
defaultValue = PreferenceValues.TabletUiMode.AUTOMATIC.name
|
||||
|
||||
onChange {
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
@ -289,60 +283,52 @@ class SettingsAdvancedController : SettingsController() {
|
||||
titleRes = R.string.data_saver
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.dataSaver())
|
||||
titleRes = R.string.data_saver
|
||||
summaryRes = R.string.data_saver_summary
|
||||
key = Keys.dataSaver
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
editTextPreference {
|
||||
bindTo(preferences.dataSaverServer())
|
||||
titleRes = R.string.data_saver_server
|
||||
key = Keys.dataSaverServer
|
||||
defaultValue = ""
|
||||
summaryRes = R.string.data_saver_server_summary
|
||||
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.dataSaverDownloader())
|
||||
titleRes = R.string.data_saver_downloader
|
||||
key = Keys.dataSaverDownloaer
|
||||
defaultValue = true
|
||||
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.dataSaverIgnoreJpeg())
|
||||
titleRes = R.string.data_saver_ignore_jpeg
|
||||
key = Keys.ignoreJpeg
|
||||
defaultValue = false
|
||||
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.dataSaverIgnoreGif())
|
||||
titleRes = R.string.data_saver_ignore_gif
|
||||
key = Keys.ignoreGif
|
||||
defaultValue = true
|
||||
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
titleRes = R.string.data_saver_image_quality
|
||||
key = Keys.dataSaverImageQuality
|
||||
bindTo(preferences.dataSaverImageQuality())
|
||||
entries = arrayOf("10", "20", "40", "50", "70", "80", "90", "95")
|
||||
entryValues = entries
|
||||
defaultValue = "80"
|
||||
summaryRes = R.string.data_saver_image_quality_summary
|
||||
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.dataSaverImageFormatJpeg())
|
||||
titleRes = R.string.data_saver_image_format
|
||||
key = Keys.dataSaverImageFormatJpeg
|
||||
defaultValue = false
|
||||
summaryOn = context.getString(R.string.data_saver_image_format_summary_on)
|
||||
summaryOff = context.getString(R.string.data_saver_image_format_summary_off)
|
||||
|
||||
@ -350,9 +336,8 @@ class SettingsAdvancedController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.dataSaverColorBW())
|
||||
titleRes = R.string.data_saver_color_bw
|
||||
key = Keys.dataSaverColorBW
|
||||
defaultValue = false
|
||||
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
@ -363,10 +348,9 @@ class SettingsAdvancedController : SettingsController() {
|
||||
isPersistent = false
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.isHentaiEnabled())
|
||||
titleRes = R.string.toggle_hentai_features
|
||||
summaryRes = R.string.toggle_hentai_features_summary
|
||||
key = Keys.eh_is_hentai_enabled
|
||||
defaultValue = true
|
||||
|
||||
onChange {
|
||||
if (preferences.isHentaiEnabled().get()) {
|
||||
@ -381,29 +365,26 @@ class SettingsAdvancedController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.delegateSources())
|
||||
titleRes = R.string.toggle_delegated_sources
|
||||
key = Keys.eh_delegateSources
|
||||
defaultValue = true
|
||||
summary = context.getString(R.string.toggle_delegated_sources_summary, context.getString(R.string.app_name), DELEGATED_SOURCES.values.map { it.sourceName }.distinct().joinToString())
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
key = Keys.eh_logLevel
|
||||
bindTo(preferences.logLevel())
|
||||
titleRes = R.string.log_level
|
||||
|
||||
entries = EHLogLevel.values().map {
|
||||
"${context.getString(it.nameRes)} (${context.getString(it.description)})"
|
||||
}.toTypedArray()
|
||||
entryValues = EHLogLevel.values().mapIndexed { index, _ -> "$index" }.toTypedArray()
|
||||
defaultValue = "0"
|
||||
|
||||
summaryRes = R.string.log_level_summary
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.enableSourceBlacklist())
|
||||
titleRes = R.string.enable_source_blacklist
|
||||
key = Keys.eh_enableSourceBlacklist
|
||||
defaultValue = true
|
||||
summary = context.getString(R.string.enable_source_blacklist_summary, context.getString(R.string.app_name))
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import androidx.core.app.ActivityCompat
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.color.DynamicColors
|
||||
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.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.initThenAdd
|
||||
@ -33,7 +34,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_theme
|
||||
|
||||
listPreference {
|
||||
key = Keys.themeMode
|
||||
bindTo(preferences.themeMode())
|
||||
titleRes = R.string.pref_theme_mode
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@ -47,7 +48,6 @@ class SettingsAppearanceController : SettingsController() {
|
||||
Values.ThemeMode.light.name,
|
||||
Values.ThemeMode.dark.name
|
||||
)
|
||||
defaultValue = Values.ThemeMode.system.name
|
||||
} else {
|
||||
entriesRes = arrayOf(
|
||||
R.string.theme_light,
|
||||
@ -57,13 +57,12 @@ class SettingsAppearanceController : SettingsController() {
|
||||
Values.ThemeMode.light.name,
|
||||
Values.ThemeMode.dark.name
|
||||
)
|
||||
defaultValue = Values.ThemeMode.light.name
|
||||
}
|
||||
|
||||
summary = "%s"
|
||||
}
|
||||
themesPreference = initThenAdd(ThemesPreference(context)) {
|
||||
key = Keys.appTheme
|
||||
bindTo(preferences.appTheme())
|
||||
titleRes = R.string.pref_app_theme
|
||||
|
||||
val appThemes = Values.AppTheme.values().filter {
|
||||
@ -75,7 +74,6 @@ class SettingsAppearanceController : SettingsController() {
|
||||
it.titleResId != null && monetFilter
|
||||
}
|
||||
entries = appThemes
|
||||
defaultValue = appThemes[0].name
|
||||
|
||||
onChange {
|
||||
activity?.let { ActivityCompat.recreate(it) }
|
||||
@ -83,9 +81,8 @@ class SettingsAppearanceController : SettingsController() {
|
||||
}
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.themeDarkAmoled
|
||||
bindTo(preferences.themeDarkAmoled())
|
||||
titleRes = R.string.pref_dark_theme_pure_black
|
||||
defaultValue = false
|
||||
|
||||
visibleIf(preferences.themeMode()) { it != Values.ThemeMode.light }
|
||||
|
||||
@ -101,7 +98,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
|
||||
if (context.isTablet()) {
|
||||
intListPreference {
|
||||
key = Keys.sideNavIconAlignment
|
||||
bindTo(preferences.sideNavIconAlignment())
|
||||
titleRes = R.string.pref_side_nav_icon_alignment
|
||||
entriesRes = arrayOf(
|
||||
R.string.alignment_top,
|
||||
@ -109,14 +106,12 @@ class SettingsAppearanceController : SettingsController() {
|
||||
R.string.alignment_bottom,
|
||||
)
|
||||
entryValues = arrayOf("0", "1", "2")
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
}
|
||||
} else {
|
||||
switchPreference {
|
||||
key = Keys.hideBottomBarOnScroll
|
||||
bindTo(preferences.hideBottomBarOnScroll())
|
||||
titleRes = R.string.pref_hide_bottom_bar_on_scroll
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,7 +120,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_timestamps
|
||||
|
||||
intListPreference {
|
||||
key = Keys.relativeTime
|
||||
bindTo(preferences.relativeTime())
|
||||
titleRes = R.string.pref_relative_format
|
||||
val values = arrayOf("0", "2", "7")
|
||||
entryValues = values
|
||||
@ -136,7 +131,6 @@ class SettingsAppearanceController : SettingsController() {
|
||||
else -> context.getString(R.string.pref_relative_time_long)
|
||||
}
|
||||
}.toTypedArray()
|
||||
defaultValue = "7"
|
||||
summary = "%s"
|
||||
}
|
||||
|
||||
@ -164,19 +158,16 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_navbar
|
||||
|
||||
switchPreference {
|
||||
key = Keys.showNavUpdates
|
||||
bindTo(preferences.showNavUpdates())
|
||||
titleRes = R.string.pref_hide_updates_button
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.showNavHistory
|
||||
bindTo(preferences.showNavHistory())
|
||||
titleRes = R.string.pref_hide_history_button
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.bottomBarLabels
|
||||
bindTo(preferences.bottomBarLabels())
|
||||
titleRes = R.string.pref_show_bottom_bar_labels
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import eu.kanade.tachiyomi.data.backup.full.models.BackupFull
|
||||
import eu.kanade.tachiyomi.data.backup.legacy.LegacyBackupRestoreValidator
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.infoPreference
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
@ -39,7 +39,6 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
class SettingsBackupController : SettingsController() {
|
||||
|
||||
@ -103,7 +102,7 @@ class SettingsBackupController : SettingsController() {
|
||||
titleRes = R.string.pref_backup_service_category
|
||||
|
||||
intListPreference {
|
||||
key = Keys.backupInterval
|
||||
bindTo(preferences.backupInterval())
|
||||
titleRes = R.string.pref_backup_interval
|
||||
entriesRes = arrayOf(
|
||||
R.string.update_never,
|
||||
@ -114,7 +113,6 @@ class SettingsBackupController : SettingsController() {
|
||||
R.string.update_weekly
|
||||
)
|
||||
entryValues = arrayOf("0", "6", "12", "24", "48", "168")
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
|
||||
onChange { newValue ->
|
||||
@ -124,7 +122,7 @@ class SettingsBackupController : SettingsController() {
|
||||
}
|
||||
}
|
||||
preference {
|
||||
key = Keys.backupDirectory
|
||||
bindTo(preferences.backupsDirectory())
|
||||
titleRes = R.string.pref_backup_directory
|
||||
|
||||
onClick {
|
||||
@ -146,11 +144,10 @@ class SettingsBackupController : SettingsController() {
|
||||
.launchIn(viewScope)
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.numberOfBackups
|
||||
bindTo(preferences.numberOfBackups())
|
||||
titleRes = R.string.pref_backup_slots
|
||||
entries = arrayOf("1", "2", "3", "4", "5")
|
||||
entryValues = entries
|
||||
defaultValue = "1"
|
||||
summary = "%s"
|
||||
|
||||
visibleIf(preferences.backupInterval()) { it > 0 }
|
||||
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.repos.RepoController
|
||||
import eu.kanade.tachiyomi.ui.category.sources.SourceCategoryController
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.infoPreference
|
||||
import eu.kanade.tachiyomi.util.preference.onChange
|
||||
@ -41,22 +42,19 @@ class SettingsBrowseController : SettingsController() {
|
||||
}
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.sources_tab_categories_filter
|
||||
bindTo(preferences.sourcesTabCategoriesFilter())
|
||||
titleRes = R.string.pref_source_source_filtering
|
||||
summaryRes = R.string.pref_source_source_filtering_summery
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.useNewSourceNavigation
|
||||
bindTo(preferences.useNewSourceNavigation())
|
||||
titleRes = R.string.pref_source_navigation
|
||||
summaryRes = R.string.pref_source_navigation_summery
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.allowLocalSourceHiddenFolders
|
||||
bindTo(preferences.allowLocalSourceHiddenFolders())
|
||||
titleRes = R.string.pref_local_source_hidden_folders
|
||||
summaryRes = R.string.pref_local_source_hidden_folders_summery
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,10 +62,9 @@ class SettingsBrowseController : SettingsController() {
|
||||
titleRes = R.string.latest
|
||||
|
||||
switchPreference {
|
||||
key = Keys.latest_tab_position
|
||||
bindTo(preferences.latestTabInFront())
|
||||
titleRes = R.string.pref_latest_position
|
||||
summaryRes = R.string.pref_latest_position_summery
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
@ -76,9 +73,8 @@ class SettingsBrowseController : SettingsController() {
|
||||
titleRes = R.string.label_extensions
|
||||
|
||||
switchPreference {
|
||||
key = Keys.automaticExtUpdates
|
||||
bindTo(preferences.automaticExtUpdates())
|
||||
titleRes = R.string.pref_enable_automatic_extension_updates
|
||||
defaultValue = true
|
||||
|
||||
onChange { newValue ->
|
||||
val checked = newValue as Boolean
|
||||
@ -115,10 +111,9 @@ class SettingsBrowseController : SettingsController() {
|
||||
titleRes = R.string.pref_category_nsfw_content
|
||||
|
||||
switchPreference {
|
||||
key = Keys.showNsfwSource
|
||||
bindTo(preferences.showNsfwSource())
|
||||
titleRes = R.string.pref_show_nsfw_source
|
||||
summaryRes = R.string.requires_app_restart
|
||||
defaultValue = true
|
||||
|
||||
if (context.isAuthenticationSupported() && activity != null) {
|
||||
requireAuthentication(
|
||||
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Category
|
||||
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.intListPreference
|
||||
@ -48,7 +49,7 @@ class SettingsDownloadController : SettingsController() {
|
||||
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||
|
||||
preference {
|
||||
key = Keys.downloadsDirectory
|
||||
bindTo(preferences.downloadsDirectory())
|
||||
titleRes = R.string.pref_download_directory
|
||||
onClick {
|
||||
val ctrl = DownloadDirectoriesDialog()
|
||||
@ -71,17 +72,15 @@ class SettingsDownloadController : SettingsController() {
|
||||
|
||||
// SY -->
|
||||
switchPreference {
|
||||
key = Keys.saveChaptersAsCBZ
|
||||
bindTo(preferences.saveChaptersAsCBZ())
|
||||
titleRes = R.string.save_chapter_as_cbz
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.saveChaptersAsCBZLevel())
|
||||
titleRes = R.string.save_chapter_as_cbz_level
|
||||
key = Keys.saveChaptersAsCBZLevel
|
||||
entries = arrayOf("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
|
||||
entryValues = entries
|
||||
defaultValue = "0"
|
||||
|
||||
visibleIf(preferences.saveChaptersAsCBZ()) { it }
|
||||
}
|
||||
@ -116,7 +115,7 @@ class SettingsDownloadController : SettingsController() {
|
||||
defaultValue = false
|
||||
}
|
||||
multiSelectListPreference {
|
||||
key = Keys.removeExcludeCategories
|
||||
bindTo(preferences.removeExcludeCategories())
|
||||
titleRes = R.string.pref_remove_exclude_categories
|
||||
entries = categories.map { it.name }.toTypedArray()
|
||||
entryValues = categories.map { it.id.toString() }.toTypedArray()
|
||||
@ -140,12 +139,11 @@ class SettingsDownloadController : SettingsController() {
|
||||
titleRes = R.string.pref_category_auto_download
|
||||
|
||||
switchPreference {
|
||||
key = Keys.downloadNew
|
||||
bindTo(preferences.downloadNew())
|
||||
titleRes = R.string.pref_download_new
|
||||
defaultValue = false
|
||||
}
|
||||
preference {
|
||||
key = Keys.downloadNewCategories
|
||||
bindTo(preferences.downloadNewCategories())
|
||||
titleRes = R.string.categories
|
||||
onClick {
|
||||
DownloadCategoriesDialog().showDialog(router)
|
||||
|
@ -19,12 +19,11 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.DEVICE_CHARGING
|
||||
import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
import eu.kanade.tachiyomi.databinding.DialogStubTextinputBinding
|
||||
import eu.kanade.tachiyomi.ui.setting.eh.FrontPageCategoriesDialog
|
||||
import eu.kanade.tachiyomi.ui.setting.eh.LanguagesDialog
|
||||
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.listPreference
|
||||
@ -95,11 +94,10 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.ehentai_prefs_account_settings
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.enableExhentai())
|
||||
titleRes = R.string.enable_exhentai
|
||||
summaryOff = context.getString(R.string.requires_login)
|
||||
key = PreferenceKeys.eh_enableExHentai
|
||||
isPersistent = false
|
||||
defaultValue = false
|
||||
preferences.enableExhentai()
|
||||
.asFlow()
|
||||
.onEach {
|
||||
@ -120,9 +118,8 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.useHentaiAtHome())
|
||||
titleRes = R.string.use_hentai_at_home
|
||||
|
||||
key = PreferenceKeys.eh_enable_hah
|
||||
summaryRes = R.string.use_hentai_at_home_summary
|
||||
entriesRes = arrayOf(
|
||||
R.string.use_hentai_at_home_option_1,
|
||||
@ -136,11 +133,10 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.useJapaneseTitle())
|
||||
titleRes = R.string.show_japanese_titles
|
||||
summaryOn = context.getString(R.string.show_japanese_titles_option_1)
|
||||
summaryOff = context.getString(R.string.show_japanese_titles_option_2)
|
||||
key = "use_jp_title"
|
||||
defaultValue = false
|
||||
|
||||
onChange { preferences.useJapaneseTitle().reconfigure() }
|
||||
|
||||
@ -148,11 +144,10 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhUseOriginalImages())
|
||||
titleRes = R.string.use_original_images
|
||||
summaryOn = context.getString(R.string.use_original_images_on)
|
||||
summaryOff = context.getString(R.string.use_original_images_off)
|
||||
key = PreferenceKeys.eh_useOrigImages
|
||||
defaultValue = false
|
||||
|
||||
onChange { preferences.exhUseOriginalImages().reconfigure() }
|
||||
|
||||
@ -176,10 +171,8 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
preference {
|
||||
bindTo(preferences.ehTagFilterValue())
|
||||
titleRes = R.string.tag_filtering_threshold
|
||||
key = PreferenceKeys.eh_tag_filtering_value
|
||||
defaultValue = 0
|
||||
|
||||
summary = context.getString(R.string.tag_filtering_threshhold_summary, preferences.ehTagFilterValue().get())
|
||||
|
||||
onClick {
|
||||
@ -220,10 +213,8 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
preference {
|
||||
bindTo(preferences.ehTagWatchingValue())
|
||||
titleRes = R.string.tag_watching_threshhold
|
||||
key = PreferenceKeys.eh_tag_watching_value
|
||||
defaultValue = 0
|
||||
|
||||
summary = context.getString(R.string.tag_watching_threshhold_summary, preferences.ehTagWatchingValue().get())
|
||||
|
||||
onClick {
|
||||
@ -265,7 +256,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
preference {
|
||||
key = PreferenceKeys.eh_settings_languages
|
||||
bindTo(preferences.exhSettingsLanguages())
|
||||
titleRes = R.string.language_filtering
|
||||
summaryRes = R.string.language_filtering_summary
|
||||
|
||||
@ -279,7 +270,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
preference {
|
||||
key = PreferenceKeys.eh_enabled_categories
|
||||
bindTo(preferences.exhEnabledCategories())
|
||||
titleRes = R.string.frong_page_categories
|
||||
summaryRes = R.string.fromt_page_categories_summary
|
||||
|
||||
@ -293,8 +284,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
defaultValue = false
|
||||
key = PreferenceKeys.eh_watched_list_default_state
|
||||
bindTo(preferences.exhWatchedListDefaultState())
|
||||
titleRes = R.string.watched_list_default
|
||||
summaryRes = R.string.watched_list_state_summary
|
||||
|
||||
@ -302,8 +292,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
listPreference {
|
||||
defaultValue = "auto"
|
||||
key = PreferenceKeys.eh_ehentai_quality
|
||||
bindTo(preferences.imageQuality())
|
||||
summaryRes = R.string.eh_image_quality_summary
|
||||
titleRes = R.string.eh_image_quality
|
||||
entriesRes = arrayOf(
|
||||
@ -329,10 +318,9 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.enhancedEHentaiView())
|
||||
titleRes = R.string.pref_enhanced_e_hentai_view
|
||||
summaryRes = R.string.pref_enhanced_e_hentai_view_summary
|
||||
key = PreferenceKeys.enhancedEHentaiView
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,10 +328,9 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.favorites_sync
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhReadOnlySync())
|
||||
titleRes = R.string.disable_favorites_uploading
|
||||
summaryRes = R.string.disable_favorites_uploading_summary
|
||||
key = PreferenceKeys.eh_readOnlySync
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -359,10 +346,9 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhLenientSync())
|
||||
titleRes = R.string.ignore_sync_errors
|
||||
summaryRes = R.string.ignore_sync_errors_summary
|
||||
key = PreferenceKeys.eh_lenientSync
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -397,7 +383,7 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.gallery_update_checker
|
||||
|
||||
intListPreference {
|
||||
key = PreferenceKeys.eh_autoUpdateFrequency
|
||||
bindTo(preferences.exhAutoUpdateFrequency())
|
||||
titleRes = R.string.time_between_batches
|
||||
entriesRes = arrayOf(
|
||||
R.string.time_between_batches_never,
|
||||
@ -410,7 +396,6 @@ class SettingsEhController : SettingsController() {
|
||||
R.string.time_between_batches_48_hours
|
||||
)
|
||||
entryValues = arrayOf("0", "1", "2", "3", "6", "12", "24", "48")
|
||||
defaultValue = "0"
|
||||
|
||||
preferences.exhAutoUpdateFrequency().asFlow()
|
||||
.onEach { newVal ->
|
||||
@ -430,7 +415,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
multiSelectListPreference {
|
||||
key = PreferenceKeys.eh_autoUpdateRestrictions
|
||||
bindTo(preferences.exhAutoUpdateRequirements())
|
||||
titleRes = R.string.auto_update_restrictions
|
||||
entriesRes = arrayOf(R.string.connected_to_wifi, R.string.charging)
|
||||
entryValues = arrayOf(DEVICE_ONLY_ON_WIFI, DEVICE_CHARGING)
|
||||
|
@ -5,6 +5,7 @@ import android.os.Build
|
||||
import android.provider.Settings
|
||||
import androidx.preference.PreferenceScreen
|
||||
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.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
@ -35,9 +36,8 @@ class SettingsGeneralController : SettingsController() {
|
||||
summary = "%s"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.showUpdatesNavBadge
|
||||
bindTo(preferences.showUpdatesNavBadge())
|
||||
titleRes = R.string.pref_library_update_show_tab_badge
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.confirmExit
|
||||
@ -61,23 +61,20 @@ class SettingsGeneralController : SettingsController() {
|
||||
titleRes = R.string.pref_category_fork
|
||||
|
||||
switchPreference {
|
||||
key = Keys.eh_expandFilters
|
||||
bindTo(preferences.expandFilters())
|
||||
titleRes = R.string.toggle_expand_search_filters
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.eh_autoSolveCaptchas
|
||||
bindTo(preferences.autoSolveCaptcha())
|
||||
titleRes = R.string.auto_solve_captchas
|
||||
summaryRes = R.string.auto_solve_captchas_summary
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.recommendsInOverflow
|
||||
bindTo(preferences.recommendsInOverflow())
|
||||
titleRes = R.string.put_recommends_in_overflow
|
||||
summaryRes = R.string.put_recommends_in_overflow_summary
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
// <-- EXH
|
||||
|
@ -5,7 +5,6 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.tachiyomi.R
|
||||
@ -25,6 +24,7 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||
import eu.kanade.tachiyomi.ui.category.genre.SortTagController
|
||||
import eu.kanade.tachiyomi.ui.library.LibrarySettingsSheet
|
||||
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
|
||||
@ -153,9 +153,8 @@ class SettingsLibraryController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.categorizedDisplay
|
||||
bindTo(preferences.categorizedDisplaySettings())
|
||||
titleRes = R.string.categorized_display_settings
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +162,7 @@ class SettingsLibraryController : SettingsController() {
|
||||
titleRes = R.string.pref_category_library_update
|
||||
|
||||
intListPreference {
|
||||
key = Keys.libraryUpdateInterval
|
||||
bindTo(preferences.libraryUpdateInterval())
|
||||
titleRes = R.string.pref_library_update_interval
|
||||
entriesRes = arrayOf(
|
||||
R.string.update_never,
|
||||
@ -174,7 +173,6 @@ class SettingsLibraryController : SettingsController() {
|
||||
R.string.update_weekly
|
||||
)
|
||||
entryValues = arrayOf("0", "12", "24", "48", "72", "168")
|
||||
defaultValue = "24"
|
||||
summary = "%s"
|
||||
|
||||
onChange { newValue ->
|
||||
@ -184,13 +182,12 @@ class SettingsLibraryController : SettingsController() {
|
||||
}
|
||||
}
|
||||
multiSelectListPreference {
|
||||
key = Keys.libraryUpdateDeviceRestriction
|
||||
bindTo(preferences.libraryUpdateDeviceRestriction())
|
||||
titleRes = R.string.pref_library_update_restriction
|
||||
entriesRes = arrayOf(R.string.connected_to_wifi, R.string.charging)
|
||||
entryValues = arrayOf(DEVICE_ONLY_ON_WIFI, DEVICE_CHARGING)
|
||||
defaultValue = preferences.libraryUpdateDeviceRestriction().defaultValue
|
||||
|
||||
visibleIfGlobalUpdateEnabled()
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
|
||||
onChange {
|
||||
// Post to event looper to allow the preference to be updated.
|
||||
@ -222,11 +219,10 @@ class SettingsLibraryController : SettingsController() {
|
||||
.launchIn(viewScope)
|
||||
}
|
||||
multiSelectListPreference {
|
||||
key = Keys.libraryUpdateMangaRestriction
|
||||
bindTo(preferences.libraryUpdateMangaRestriction())
|
||||
titleRes = R.string.pref_library_update_manga_restriction
|
||||
entriesRes = arrayOf(R.string.pref_update_only_completely_read, R.string.pref_update_only_non_completed)
|
||||
entryValues = arrayOf(MANGA_FULLY_READ, MANGA_ONGOING)
|
||||
defaultValue = preferences.libraryUpdateMangaRestriction().defaultValue
|
||||
|
||||
fun updateSummary() {
|
||||
val restrictions = preferences.libraryUpdateMangaRestriction().get()
|
||||
@ -252,7 +248,7 @@ class SettingsLibraryController : SettingsController() {
|
||||
.launchIn(viewScope)
|
||||
}
|
||||
preference {
|
||||
key = Keys.libraryUpdateCategories
|
||||
bindTo(preferences.libraryUpdateCategories())
|
||||
titleRes = R.string.categories
|
||||
|
||||
onClick {
|
||||
@ -301,7 +297,7 @@ class SettingsLibraryController : SettingsController() {
|
||||
}
|
||||
// SY -->
|
||||
listPreference {
|
||||
key = Keys.groupLibraryUpdateType
|
||||
bindTo(preferences.groupLibraryUpdateType())
|
||||
titleRes = R.string.library_group_updates
|
||||
entriesRes = arrayOf(
|
||||
R.string.library_group_updates_global,
|
||||
@ -313,7 +309,6 @@ class SettingsLibraryController : SettingsController() {
|
||||
GroupLibraryMode.ALL_BUT_UNGROUPED.name,
|
||||
GroupLibraryMode.ALL.name
|
||||
)
|
||||
defaultValue = GroupLibraryMode.GLOBAL.name
|
||||
summary = "%s"
|
||||
}
|
||||
// SY <--
|
||||
@ -354,20 +349,15 @@ class SettingsLibraryController : SettingsController() {
|
||||
titleRes = R.string.migration
|
||||
|
||||
switchPreference {
|
||||
key = Keys.skipPreMigration
|
||||
bindTo(preferences.skipPreMigration())
|
||||
titleRes = R.string.skip_pre_migration
|
||||
summaryRes = R.string.pref_skip_pre_migration_summary
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
}
|
||||
|
||||
private inline fun Preference.visibleIfGlobalUpdateEnabled() {
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
}
|
||||
|
||||
class LibraryColumnsDialog : DialogController() {
|
||||
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
|
@ -4,8 +4,8 @@ import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.listPreference
|
||||
import eu.kanade.tachiyomi.util.preference.onClick
|
||||
import eu.kanade.tachiyomi.util.preference.preference
|
||||
@ -45,21 +45,14 @@ class SettingsMangaDexController :
|
||||
addPreference(sourcePreference)
|
||||
|
||||
listPreference {
|
||||
bindTo(preferences.preferredMangaDexId())
|
||||
titleRes = R.string.mangadex_preffered_source
|
||||
summaryRes = R.string.mangadex_preffered_source_summary
|
||||
key = PreferenceKeys.preferredMangaDexId
|
||||
val mangaDexs = MdUtil.getEnabledMangaDexs(preferences)
|
||||
entries = mangaDexs.map { it.toString() }.toTypedArray()
|
||||
entryValues = mangaDexs.map { it.id.toString() }.toTypedArray()
|
||||
}
|
||||
|
||||
/*switchPreference {
|
||||
key = PreferenceKeys.mangaDexForceLatestCovers
|
||||
titleRes = R.string.mangadex_use_latest_cover
|
||||
summaryRes = R.string.mangadex_use_latest_cover_summary
|
||||
defaultValue = false
|
||||
}*/
|
||||
|
||||
preference {
|
||||
key = "pref_sync_mangadex_into_this"
|
||||
titleRes = R.string.mangadex_sync_follows_to_library
|
||||
|
@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||
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
|
||||
@ -50,11 +51,10 @@ class SettingsReaderController : SettingsController() {
|
||||
summary = "%s"
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.doubleTapAnimationSpeed
|
||||
bindTo(preferences.doubleTapAnimSpeed())
|
||||
titleRes = R.string.pref_double_tap_anim_speed
|
||||
entries = arrayOf(context.getString(R.string.double_tap_anim_speed_0), context.getString(R.string.double_tap_anim_speed_normal), context.getString(R.string.double_tap_anim_speed_fast))
|
||||
entryValues = arrayOf("1", "500", "250") // using a value of 0 breaks the image viewer, so min is 1
|
||||
defaultValue = "500"
|
||||
summary = "%s"
|
||||
}
|
||||
switchPreference {
|
||||
@ -64,39 +64,34 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.showNavigationOverlayOnStart
|
||||
bindTo(preferences.showNavigationOverlayOnStart())
|
||||
titleRes = R.string.pref_show_navigation_mode
|
||||
summaryRes = R.string.pref_show_navigation_mode_summary
|
||||
defaultValue = false
|
||||
}
|
||||
// SY -->
|
||||
switchPreference {
|
||||
key = Keys.forceHorizontalSeekbar
|
||||
bindTo(preferences.forceHorizontalSeekbar())
|
||||
titleRes = R.string.pref_force_horz_seekbar
|
||||
summaryRes = R.string.pref_force_horz_seekbar_summary
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.landscapeVerticalSeekbar
|
||||
bindTo(preferences.landscapeVerticalSeekbar())
|
||||
titleRes = R.string.pref_show_vert_seekbar_landscape
|
||||
summaryRes = R.string.pref_show_vert_seekbar_landscape_summary
|
||||
defaultValue = false
|
||||
visibleIf(preferences.forceHorizontalSeekbar()) { !it }
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.leftVerticalSeekbar
|
||||
bindTo(preferences.leftVerticalSeekbar())
|
||||
titleRes = R.string.pref_left_handed_vertical_seekbar
|
||||
summaryRes = R.string.pref_left_handed_vertical_seekbar_summary
|
||||
defaultValue = false
|
||||
visibleIf(preferences.forceHorizontalSeekbar()) { !it }
|
||||
}
|
||||
// SY <--
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
switchPreference {
|
||||
key = Keys.trueColor
|
||||
bindTo(preferences.trueColor())
|
||||
titleRes = R.string.pref_true_color
|
||||
summaryRes = R.string.pref_true_color_summary
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,38 +114,33 @@ class SettingsReaderController : SettingsController() {
|
||||
summary = "%s"
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.readerTheme
|
||||
bindTo(preferences.readerTheme())
|
||||
titleRes = R.string.pref_reader_theme
|
||||
entriesRes = arrayOf(R.string.black_background, R.string.gray_background, R.string.white_background, R.string.automatic_background)
|
||||
entryValues = arrayOf("1", "2", "0", "3")
|
||||
defaultValue = "3"
|
||||
summary = "%s"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.fullscreen
|
||||
bindTo(preferences.fullscreen())
|
||||
titleRes = R.string.pref_fullscreen
|
||||
defaultValue = true
|
||||
}
|
||||
|
||||
if (activity?.hasDisplayCutout() == true) {
|
||||
switchPreference {
|
||||
key = Keys.cutoutShort
|
||||
bindTo(preferences.cutoutShort())
|
||||
titleRes = R.string.pref_cutout_short
|
||||
defaultValue = true
|
||||
|
||||
visibleIf(preferences.fullscreen()) { it }
|
||||
}
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.keepScreenOn
|
||||
bindTo(preferences.keepScreenOn())
|
||||
titleRes = R.string.pref_keep_screen_on
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.showPageNumber
|
||||
bindTo(preferences.showPageNumber())
|
||||
titleRes = R.string.pref_show_page_number
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,9 +158,8 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.alwaysShowChapterTransition
|
||||
bindTo(preferences.alwaysShowChapterTransition())
|
||||
titleRes = R.string.pref_always_show_chapter_transition
|
||||
defaultValue = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,18 +167,17 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pager_viewer
|
||||
|
||||
intListPreference {
|
||||
key = Keys.navigationModePager
|
||||
bindTo(preferences.navigationModePager())
|
||||
titleRes = R.string.pref_viewer_nav
|
||||
entries = context.resources.getStringArray(R.array.pager_nav).also { values ->
|
||||
entryValues = values.indices.map { index -> "$index" }.toTypedArray()
|
||||
}
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
listPreference {
|
||||
key = Keys.pagerNavInverted
|
||||
bindTo(preferences.pagerNavInverted())
|
||||
titleRes = R.string.pref_read_with_tapping_inverted
|
||||
entriesRes = arrayOf(
|
||||
R.string.tapping_inverted_none,
|
||||
@ -203,13 +191,12 @@ class SettingsReaderController : SettingsController() {
|
||||
TappingInvertMode.VERTICAL.name,
|
||||
TappingInvertMode.BOTH.name
|
||||
)
|
||||
defaultValue = TappingInvertMode.NONE.name
|
||||
summary = "%s"
|
||||
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.imageScaleType
|
||||
bindTo(preferences.imageScaleType())
|
||||
titleRes = R.string.pref_image_scale_type
|
||||
entriesRes = arrayOf(
|
||||
R.string.scale_type_fit_screen,
|
||||
@ -220,11 +207,10 @@ class SettingsReaderController : SettingsController() {
|
||||
R.string.scale_type_smart_fit
|
||||
)
|
||||
entryValues = arrayOf("1", "2", "3", "4", "5", "6")
|
||||
defaultValue = "1"
|
||||
summary = "%s"
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.zoomStart
|
||||
bindTo(preferences.zoomStart())
|
||||
titleRes = R.string.pref_zoom_start
|
||||
entriesRes = arrayOf(
|
||||
R.string.zoom_start_automatic,
|
||||
@ -233,31 +219,26 @@ class SettingsReaderController : SettingsController() {
|
||||
R.string.zoom_start_center
|
||||
)
|
||||
entryValues = arrayOf("1", "2", "3", "4")
|
||||
defaultValue = "1"
|
||||
summary = "%s"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.cropBorders
|
||||
bindTo(preferences.cropBorders())
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
// SY -->
|
||||
switchPreference {
|
||||
key = Keys.enableTransitionsPager
|
||||
bindTo(preferences.pageTransitionsPager())
|
||||
titleRes = R.string.pref_page_transitions
|
||||
defaultValue = true
|
||||
}
|
||||
// SY <--
|
||||
switchPreference {
|
||||
key = Keys.dualPageSplitPaged
|
||||
bindTo(preferences.dualPageSplitPaged())
|
||||
titleRes = R.string.pref_dual_page_split
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.dualPageInvertPaged
|
||||
bindTo(preferences.dualPageInvertPaged())
|
||||
titleRes = R.string.pref_dual_page_invert
|
||||
summaryRes = R.string.pref_dual_page_invert_summary
|
||||
defaultValue = false
|
||||
visibleIf(preferences.dualPageSplitPaged()) { it }
|
||||
}
|
||||
}
|
||||
@ -266,18 +247,16 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.webtoon_viewer
|
||||
|
||||
intListPreference {
|
||||
key = Keys.navigationModeWebtoon
|
||||
bindTo(preferences.navigationModeWebtoon())
|
||||
titleRes = R.string.pref_viewer_nav
|
||||
entries = context.resources.getStringArray(R.array.webtoon_nav).also { values ->
|
||||
entryValues = values.indices.map { index -> "$index" }.toTypedArray()
|
||||
}
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
listPreference {
|
||||
key = Keys.webtoonNavInverted
|
||||
bindTo(preferences.webtoonNavInverted())
|
||||
titleRes = R.string.pref_read_with_tapping_inverted
|
||||
entriesRes = arrayOf(
|
||||
R.string.tapping_inverted_none,
|
||||
@ -291,13 +270,12 @@ class SettingsReaderController : SettingsController() {
|
||||
TappingInvertMode.VERTICAL.name,
|
||||
TappingInvertMode.BOTH.name
|
||||
)
|
||||
defaultValue = TappingInvertMode.NONE.name
|
||||
summary = "%s"
|
||||
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.webtoonSidePadding
|
||||
bindTo(preferences.webtoonSidePadding())
|
||||
titleRes = R.string.pref_webtoon_side_padding
|
||||
entriesRes = arrayOf(
|
||||
R.string.webtoon_side_padding_0,
|
||||
@ -307,11 +285,10 @@ class SettingsReaderController : SettingsController() {
|
||||
R.string.webtoon_side_padding_25
|
||||
)
|
||||
entryValues = arrayOf("0", "10", "15", "20", "25")
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
}
|
||||
listPreference {
|
||||
key = Keys.readerHideThreshold
|
||||
bindTo(preferences.readerHideThreshold())
|
||||
titleRes = R.string.pref_hide_threshold
|
||||
entriesRes = arrayOf(
|
||||
R.string.pref_highest,
|
||||
@ -322,36 +299,30 @@ class SettingsReaderController : SettingsController() {
|
||||
entryValues = PreferenceValues.ReaderHideThreshold.values()
|
||||
.map { it.name }
|
||||
.toTypedArray()
|
||||
defaultValue = "${PreferenceValues.ReaderHideThreshold.LOW}"
|
||||
summary = "%s"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.cropBordersWebtoon
|
||||
bindTo(preferences.cropBordersWebtoon())
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.dualPageSplitWebtoon
|
||||
bindTo(preferences.dualPageSplitWebtoon())
|
||||
titleRes = R.string.pref_dual_page_split
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.dualPageInvertWebtoon
|
||||
bindTo(preferences.dualPageInvertWebtoon())
|
||||
titleRes = R.string.pref_dual_page_invert
|
||||
summaryRes = R.string.pref_dual_page_invert_summary
|
||||
defaultValue = false
|
||||
visibleIf(preferences.dualPageSplitWebtoon()) { it }
|
||||
}
|
||||
// SY -->
|
||||
switchPreference {
|
||||
key = Keys.enableTransitionsWebtoon
|
||||
bindTo(preferences.pageTransitionsWebtoon())
|
||||
titleRes = R.string.pref_page_transitions
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.webtoonEnableZoomOut
|
||||
bindTo(preferences.webtoonEnableZoomOut())
|
||||
titleRes = R.string.enable_zoom_out
|
||||
defaultValue = false
|
||||
}
|
||||
// SY <--
|
||||
}
|
||||
@ -361,15 +332,13 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.vertical_plus_viewer
|
||||
|
||||
switchPreference {
|
||||
key = Keys.continuousVerticalTappingByPage
|
||||
bindTo(preferences.continuousVerticalTappingByPage())
|
||||
titleRes = R.string.tap_scroll_page
|
||||
summaryRes = R.string.tap_scroll_page_summary
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.cropBordersContinuousVertical
|
||||
bindTo(preferences.cropBordersContinuousVertical())
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
@ -378,19 +347,16 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_reader_navigation
|
||||
|
||||
switchPreference {
|
||||
key = Keys.readWithTapping
|
||||
bindTo(preferences.readWithTapping())
|
||||
titleRes = R.string.pref_read_with_tapping
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.readWithVolumeKeys
|
||||
bindTo(preferences.readWithVolumeKeys())
|
||||
titleRes = R.string.pref_read_with_volume_keys
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.readWithVolumeKeysInverted
|
||||
bindTo(preferences.readWithVolumeKeysInverted())
|
||||
titleRes = R.string.pref_read_with_volume_keys_inverted
|
||||
defaultValue = false
|
||||
visibleIf(preferences.readWithVolumeKeys()) { it }
|
||||
}
|
||||
}
|
||||
@ -399,9 +365,8 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_reader_actions
|
||||
|
||||
switchPreference {
|
||||
key = Keys.readWithLongTap
|
||||
bindTo(preferences.readWithLongTap())
|
||||
titleRes = R.string.pref_read_with_long_tap
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.folderPerManga
|
||||
@ -416,7 +381,7 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.page_downloading
|
||||
|
||||
intListPreference {
|
||||
key = Keys.eh_preload_size
|
||||
bindTo(preferences.preloadSize())
|
||||
titleRes = R.string.reader_preload_amount
|
||||
entryValues = arrayOf(
|
||||
"4",
|
||||
@ -438,21 +403,19 @@ class SettingsReaderController : SettingsController() {
|
||||
R.string.reader_preload_amount_16_pages,
|
||||
R.string.reader_preload_amount_20_pages
|
||||
)
|
||||
defaultValue = "10"
|
||||
summaryRes = R.string.reader_preload_amount_summary
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
key = Keys.eh_readerThreads
|
||||
bindTo(preferences.readerThreads())
|
||||
titleRes = R.string.download_threads
|
||||
entries = arrayOf("1", "2", "3", "4", "5")
|
||||
entryValues = entries
|
||||
defaultValue = "2"
|
||||
summaryRes = R.string.download_threads_summary
|
||||
}
|
||||
|
||||
listPreference {
|
||||
key = Keys.eh_cacheSize
|
||||
bindTo(preferences.cacheSize())
|
||||
titleRes = R.string.reader_cache_size
|
||||
entryValues = arrayOf(
|
||||
"50",
|
||||
@ -490,14 +453,12 @@ class SettingsReaderController : SettingsController() {
|
||||
"4.5 GB",
|
||||
"5 GB"
|
||||
)
|
||||
defaultValue = "75"
|
||||
summaryRes = R.string.reader_cache_size_summary
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.eh_aggressivePageLoading
|
||||
bindTo(preferences.aggressivePageLoading())
|
||||
titleRes = R.string.aggressively_load_pages
|
||||
summaryRes = R.string.aggressively_load_pages_summary
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,22 +466,19 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_category_fork
|
||||
|
||||
switchPreference {
|
||||
key = Keys.eh_readerInstantRetry
|
||||
bindTo(preferences.readerInstantRetry())
|
||||
titleRes = R.string.skip_queue_on_retry
|
||||
summaryRes = R.string.skip_queue_on_retry_summary
|
||||
defaultValue = true
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.eh_preserveReadingPosition
|
||||
bindTo(preferences.preserveReadingPosition())
|
||||
titleRes = R.string.preserve_reading_position
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.eh_use_auto_webtoon
|
||||
bindTo(preferences.useAutoWebtoon())
|
||||
titleRes = R.string.auto_webtoon_mode
|
||||
summaryRes = R.string.auto_webtoon_mode_summary
|
||||
defaultValue = true
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -533,7 +491,7 @@ class SettingsReaderController : SettingsController() {
|
||||
}
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.pageLayout
|
||||
bindTo(preferences.pageLayout())
|
||||
titleRes = R.string.page_layout
|
||||
summaryRes = R.string.automatic_can_still_switch
|
||||
entriesRes = arrayOf(
|
||||
@ -542,12 +500,10 @@ class SettingsReaderController : SettingsController() {
|
||||
R.string.automatic_orientation
|
||||
)
|
||||
entryValues = arrayOf("0", "1", "2")
|
||||
defaultValue = "2"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.invertDoublePages
|
||||
bindTo(preferences.invertDoublePages())
|
||||
titleRes = R.string.invert_double_pages
|
||||
defaultValue = false
|
||||
visibleIf(preferences.pageLayout()) { it != PagerConfig.PageLayout.SINGLE_PAGE }
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.biometric.BiometricTimesController
|
||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.onClick
|
||||
@ -35,9 +36,8 @@ class SettingsSecurityController : SettingsController() {
|
||||
|
||||
if (context.isAuthenticationSupported()) {
|
||||
switchPreference {
|
||||
key = Keys.useAuthenticator
|
||||
bindTo(preferences.useAuthenticator())
|
||||
titleRes = R.string.lock_with_biometrics
|
||||
defaultValue = false
|
||||
|
||||
requireAuthentication(
|
||||
activity as? FragmentActivity,
|
||||
@ -47,7 +47,7 @@ class SettingsSecurityController : SettingsController() {
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
key = Keys.lockAppAfter
|
||||
bindTo(preferences.lockAppAfter())
|
||||
titleRes = R.string.lock_when_idle
|
||||
val values = arrayOf("0", "1", "2", "5", "10", "-1")
|
||||
entries = values.mapNotNull {
|
||||
@ -58,7 +58,6 @@ class SettingsSecurityController : SettingsController() {
|
||||
}
|
||||
}.toTypedArray()
|
||||
entryValues = values
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
if (value == newValue) return@OnPreferenceChangeListener false
|
||||
@ -93,10 +92,9 @@ class SettingsSecurityController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.secureScreen
|
||||
bindTo(preferences.secureScreen())
|
||||
titleRes = R.string.secure_screen
|
||||
summaryRes = R.string.secure_screen_summary
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
|
@ -123,6 +123,11 @@ inline fun <P : Preference> PreferenceGroup.addThenInit(p: P, block: P.() -> Uni
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T> Preference.bindTo(preference: com.tfcporciuncula.flow.Preference<T>) {
|
||||
key = preference.key
|
||||
defaultValue = preference.defaultValue
|
||||
}
|
||||
|
||||
inline fun Preference.onClick(crossinline block: () -> Unit) {
|
||||
setOnPreferenceClickListener { block(); true }
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ fun DataSaver(source: Source, preferences: PreferencesHelper): DataSaver {
|
||||
private class DataSaverImpl(preferences: PreferencesHelper) : DataSaver {
|
||||
private val dataSavedServer = preferences.dataSaverServer().get().trimEnd('/')
|
||||
|
||||
private val ignoreJpg = preferences.ignoreJpeg().get()
|
||||
private val ignoreGif = preferences.ignoreGif().get()
|
||||
private val ignoreJpg = preferences.dataSaverIgnoreJpeg().get()
|
||||
private val ignoreGif = preferences.dataSaverIgnoreGif().get()
|
||||
|
||||
private val format = preferences.dataSaverImageFormatJpeg().toIntRepresentation()
|
||||
private val quality = preferences.dataSaverImageQuality().get()
|
||||
|
Loading…
x
Reference in New Issue
Block a user