Hide cutout toggle button if fullscreen is off (#6150)

(cherry picked from commit 33a02b47d5e54b207fe2d50cfe0b754db22a6c4b)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderGeneralSettings.kt
This commit is contained in:
Riztard Lanthorn 2021-10-30 23:19:15 +07:00 committed by Jobobby04
parent ec6b6ae779
commit af6b42cec7
2 changed files with 9 additions and 6 deletions

View File

@ -39,17 +39,19 @@ class ReaderGeneralSettings @JvmOverloads constructor(context: Context, attrs: A
binding.backgroundColor.bindToIntPreference(preferences.readerTheme(), R.array.reader_themes_values) binding.backgroundColor.bindToIntPreference(preferences.readerTheme(), R.array.reader_themes_values)
binding.showPageNumber.bindToPreference(preferences.showPageNumber()) binding.showPageNumber.bindToPreference(preferences.showPageNumber())
binding.fullscreen.bindToPreference(preferences.fullscreen()) binding.fullscreen.bindToPreference(preferences.fullscreen())
preferences.fullscreen()
.asImmediateFlow {
// If the preference is explicitly disabled, that means the setting was configured since there is a cutout
binding.cutoutShort.isVisible = it && ((context as ReaderActivity).hasCutout || !preferences.cutoutShort().get())
binding.cutoutShort.bindToPreference(preferences.cutoutShort())
}
.launchIn((context as ReaderActivity).lifecycleScope)
binding.keepscreen.bindToPreference(preferences.keepScreenOn()) binding.keepscreen.bindToPreference(preferences.keepScreenOn())
binding.longTap.bindToPreference(preferences.readWithLongTap()) binding.longTap.bindToPreference(preferences.readWithLongTap())
binding.alwaysShowChapterTransition.bindToPreference(preferences.alwaysShowChapterTransition()) binding.alwaysShowChapterTransition.bindToPreference(preferences.alwaysShowChapterTransition())
// binding.pageTransitions.bindToPreference(preferences.pageTransitions()) // binding.pageTransitions.bindToPreference(preferences.pageTransitions())
// If the preference is explicitly disabled, that means the setting was configured since there is a cutout
if ((context as ReaderActivity).hasCutout || !preferences.cutoutShort().get()) {
binding.cutoutShort.isVisible = true
binding.cutoutShort.bindToPreference(preferences.cutoutShort())
}
// SY --> // SY -->
binding.forceHorzSeekbar.bindToPreference(preferences.forceHorizontalSeekbar()) binding.forceHorzSeekbar.bindToPreference(preferences.forceHorizontalSeekbar())
binding.landscapeVerticalSeekbar.bindToPreference(preferences.landscapeVerticalSeekbar()) binding.landscapeVerticalSeekbar.bindToPreference(preferences.landscapeVerticalSeekbar())

View File

@ -139,6 +139,7 @@ class SettingsReaderController : SettingsController() {
key = Keys.cutoutShort key = Keys.cutoutShort
titleRes = R.string.pref_cutout_short titleRes = R.string.pref_cutout_short
defaultValue = true defaultValue = true
preferences.fullscreen().asImmediateFlow { isVisible = it }.launchIn(viewScope)
} }
} }