|
@@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.R
|
|
|
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
|
|
import eu.kanade.tachiyomi.data.preference.PreferenceValues.TappingInvertMode
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
|
|
+import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
|
|
import eu.kanade.tachiyomi.util.preference.bindTo
|
|
|
import eu.kanade.tachiyomi.util.preference.entriesRes
|
|
@@ -16,14 +17,17 @@ 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.system.hasDisplayCutout
|
|
|
+import uy.kohesive.injekt.injectLazy
|
|
|
|
|
|
class SettingsReaderController : SettingsController() {
|
|
|
|
|
|
+ private val readerPreferences: ReaderPreferences by injectLazy()
|
|
|
+
|
|
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
|
|
titleRes = R.string.pref_category_reader
|
|
|
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.defaultReadingMode())
|
|
|
+ bindTo(readerPreferences.defaultReadingMode())
|
|
|
titleRes = R.string.pref_viewer_type
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.left_to_right_viewer,
|
|
@@ -37,31 +41,31 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.doubleTapAnimSpeed())
|
|
|
+ bindTo(readerPreferences.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
|
|
|
summary = "%s"
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.showReadingMode())
|
|
|
+ bindTo(readerPreferences.showReadingMode())
|
|
|
titleRes = R.string.pref_show_reading_mode
|
|
|
summaryRes = R.string.pref_show_reading_mode_summary
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.showNavigationOverlayOnStart())
|
|
|
+ bindTo(readerPreferences.showNavigationOverlayOnStart())
|
|
|
titleRes = R.string.pref_show_navigation_mode
|
|
|
summaryRes = R.string.pref_show_navigation_mode_summary
|
|
|
}
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.trueColor())
|
|
|
+ bindTo(readerPreferences.trueColor())
|
|
|
titleRes = R.string.pref_true_color
|
|
|
summaryRes = R.string.pref_true_color_summary
|
|
|
}
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.pageTransitions())
|
|
|
+ bindTo(readerPreferences.pageTransitions())
|
|
|
titleRes = R.string.pref_page_transitions
|
|
|
}
|
|
|
|
|
@@ -69,7 +73,7 @@ class SettingsReaderController : SettingsController() {
|
|
|
titleRes = R.string.pref_category_display
|
|
|
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.defaultOrientationType())
|
|
|
+ bindTo(readerPreferences.defaultOrientationType())
|
|
|
titleRes = R.string.pref_rotation_type
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.rotation_free,
|
|
@@ -84,32 +88,32 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.readerTheme())
|
|
|
+ bindTo(readerPreferences.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")
|
|
|
summary = "%s"
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.fullscreen())
|
|
|
+ bindTo(readerPreferences.fullscreen())
|
|
|
titleRes = R.string.pref_fullscreen
|
|
|
}
|
|
|
|
|
|
if (activity?.hasDisplayCutout() == true) {
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.cutoutShort())
|
|
|
+ bindTo(readerPreferences.cutoutShort())
|
|
|
titleRes = R.string.pref_cutout_short
|
|
|
|
|
|
- visibleIf(preferences.fullscreen()) { it }
|
|
|
+ visibleIf(readerPreferences.fullscreen()) { it }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.keepScreenOn())
|
|
|
+ bindTo(readerPreferences.keepScreenOn())
|
|
|
titleRes = R.string.pref_keep_screen_on
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.showPageNumber())
|
|
|
+ bindTo(readerPreferences.showPageNumber())
|
|
|
titleRes = R.string.pref_show_page_number
|
|
|
}
|
|
|
}
|
|
@@ -118,15 +122,15 @@ class SettingsReaderController : SettingsController() {
|
|
|
titleRes = R.string.pref_category_reading
|
|
|
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.skipRead())
|
|
|
+ bindTo(readerPreferences.skipRead())
|
|
|
titleRes = R.string.pref_skip_read_chapters
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.skipFiltered())
|
|
|
+ bindTo(readerPreferences.skipFiltered())
|
|
|
titleRes = R.string.pref_skip_filtered_chapters
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.alwaysShowChapterTransition())
|
|
|
+ bindTo(readerPreferences.alwaysShowChapterTransition())
|
|
|
titleRes = R.string.pref_always_show_chapter_transition
|
|
|
}
|
|
|
}
|
|
@@ -135,7 +139,7 @@ class SettingsReaderController : SettingsController() {
|
|
|
titleRes = R.string.pager_viewer
|
|
|
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.navigationModePager())
|
|
|
+ bindTo(readerPreferences.navigationModePager())
|
|
|
titleRes = R.string.pref_viewer_nav
|
|
|
entries = context.resources.getStringArray(R.array.pager_nav).also { values ->
|
|
|
entryValues = values.indices.map { index -> "$index" }.toTypedArray()
|
|
@@ -143,7 +147,7 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
listPreference {
|
|
|
- bindTo(preferences.pagerNavInverted())
|
|
|
+ bindTo(readerPreferences.pagerNavInverted())
|
|
|
titleRes = R.string.pref_read_with_tapping_inverted
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.tapping_inverted_none,
|
|
@@ -158,10 +162,10 @@ class SettingsReaderController : SettingsController() {
|
|
|
TappingInvertMode.BOTH.name,
|
|
|
)
|
|
|
summary = "%s"
|
|
|
- visibleIf(preferences.navigationModePager()) { it != 5 }
|
|
|
+ visibleIf(readerPreferences.navigationModePager()) { it != 5 }
|
|
|
}
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.imageScaleType())
|
|
|
+ bindTo(readerPreferences.imageScaleType())
|
|
|
titleRes = R.string.pref_image_scale_type
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.scale_type_fit_screen,
|
|
@@ -175,12 +179,12 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.landscapeZoom())
|
|
|
+ bindTo(readerPreferences.landscapeZoom())
|
|
|
titleRes = R.string.pref_landscape_zoom
|
|
|
- visibleIf(preferences.imageScaleType()) { it == 1 }
|
|
|
+ visibleIf(readerPreferences.imageScaleType()) { it == 1 }
|
|
|
}
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.zoomStart())
|
|
|
+ bindTo(readerPreferences.zoomStart())
|
|
|
titleRes = R.string.pref_zoom_start
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.zoom_start_automatic,
|
|
@@ -192,22 +196,22 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.cropBorders())
|
|
|
+ bindTo(readerPreferences.cropBorders())
|
|
|
titleRes = R.string.pref_crop_borders
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.navigateToPan())
|
|
|
+ bindTo(readerPreferences.navigateToPan())
|
|
|
titleRes = R.string.pref_navigate_pan
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.dualPageSplitPaged())
|
|
|
+ bindTo(readerPreferences.dualPageSplitPaged())
|
|
|
titleRes = R.string.pref_dual_page_split
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.dualPageInvertPaged())
|
|
|
+ bindTo(readerPreferences.dualPageInvertPaged())
|
|
|
titleRes = R.string.pref_dual_page_invert
|
|
|
summaryRes = R.string.pref_dual_page_invert_summary
|
|
|
- visibleIf(preferences.dualPageSplitPaged()) { it }
|
|
|
+ visibleIf(readerPreferences.dualPageSplitPaged()) { it }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -215,7 +219,7 @@ class SettingsReaderController : SettingsController() {
|
|
|
titleRes = R.string.webtoon_viewer
|
|
|
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.navigationModeWebtoon())
|
|
|
+ bindTo(readerPreferences.navigationModeWebtoon())
|
|
|
titleRes = R.string.pref_viewer_nav
|
|
|
entries = context.resources.getStringArray(R.array.webtoon_nav).also { values ->
|
|
|
entryValues = values.indices.map { index -> "$index" }.toTypedArray()
|
|
@@ -223,7 +227,7 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
listPreference {
|
|
|
- bindTo(preferences.webtoonNavInverted())
|
|
|
+ bindTo(readerPreferences.webtoonNavInverted())
|
|
|
titleRes = R.string.pref_read_with_tapping_inverted
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.tapping_inverted_none,
|
|
@@ -238,10 +242,10 @@ class SettingsReaderController : SettingsController() {
|
|
|
TappingInvertMode.BOTH.name,
|
|
|
)
|
|
|
summary = "%s"
|
|
|
- visibleIf(preferences.navigationModeWebtoon()) { it != 5 }
|
|
|
+ visibleIf(readerPreferences.navigationModeWebtoon()) { it != 5 }
|
|
|
}
|
|
|
intListPreference {
|
|
|
- bindTo(preferences.webtoonSidePadding())
|
|
|
+ bindTo(readerPreferences.webtoonSidePadding())
|
|
|
titleRes = R.string.pref_webtoon_side_padding
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.webtoon_side_padding_0,
|
|
@@ -255,7 +259,7 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
listPreference {
|
|
|
- bindTo(preferences.readerHideThreshold())
|
|
|
+ bindTo(readerPreferences.readerHideThreshold())
|
|
|
titleRes = R.string.pref_hide_threshold
|
|
|
entriesRes = arrayOf(
|
|
|
R.string.pref_highest,
|
|
@@ -269,21 +273,21 @@ class SettingsReaderController : SettingsController() {
|
|
|
summary = "%s"
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.cropBordersWebtoon())
|
|
|
+ bindTo(readerPreferences.cropBordersWebtoon())
|
|
|
titleRes = R.string.pref_crop_borders
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.dualPageSplitWebtoon())
|
|
|
+ bindTo(readerPreferences.dualPageSplitWebtoon())
|
|
|
titleRes = R.string.pref_dual_page_split
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.dualPageInvertWebtoon())
|
|
|
+ bindTo(readerPreferences.dualPageInvertWebtoon())
|
|
|
titleRes = R.string.pref_dual_page_invert
|
|
|
summaryRes = R.string.pref_dual_page_invert_summary
|
|
|
- visibleIf(preferences.dualPageSplitWebtoon()) { it }
|
|
|
+ visibleIf(readerPreferences.dualPageSplitWebtoon()) { it }
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.longStripSplitWebtoon())
|
|
|
+ bindTo(readerPreferences.longStripSplitWebtoon())
|
|
|
titleRes = R.string.pref_long_strip_split
|
|
|
summaryRes = R.string.split_tall_images_summary
|
|
|
}
|
|
@@ -293,13 +297,13 @@ class SettingsReaderController : SettingsController() {
|
|
|
titleRes = R.string.pref_reader_navigation
|
|
|
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.readWithVolumeKeys())
|
|
|
+ bindTo(readerPreferences.readWithVolumeKeys())
|
|
|
titleRes = R.string.pref_read_with_volume_keys
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.readWithVolumeKeysInverted())
|
|
|
+ bindTo(readerPreferences.readWithVolumeKeysInverted())
|
|
|
titleRes = R.string.pref_read_with_volume_keys_inverted
|
|
|
- visibleIf(preferences.readWithVolumeKeys()) { it }
|
|
|
+ visibleIf(readerPreferences.readWithVolumeKeys()) { it }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -307,11 +311,11 @@ class SettingsReaderController : SettingsController() {
|
|
|
titleRes = R.string.pref_reader_actions
|
|
|
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.readWithLongTap())
|
|
|
+ bindTo(readerPreferences.readWithLongTap())
|
|
|
titleRes = R.string.pref_read_with_long_tap
|
|
|
}
|
|
|
switchPreference {
|
|
|
- bindTo(preferences.folderPerManga())
|
|
|
+ bindTo(readerPreferences.folderPerManga())
|
|
|
titleRes = R.string.pref_create_folder_per_manga
|
|
|
summaryRes = R.string.pref_create_folder_per_manga_summary
|
|
|
}
|