diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderGeneralSettings.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderGeneralSettings.kt index 96c66b76b..263c46059 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderGeneralSettings.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderGeneralSettings.kt @@ -5,11 +5,14 @@ import android.util.AttributeSet import android.view.LayoutInflater import androidx.core.view.isVisible import androidx.core.widget.NestedScrollView +import androidx.lifecycle.lifecycleScope import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper +import eu.kanade.tachiyomi.data.preference.asImmediateFlow import eu.kanade.tachiyomi.databinding.ReaderGeneralSettingsBinding import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.preference.bindToPreference +import kotlinx.coroutines.flow.launchIn import uy.kohesive.injekt.injectLazy /** @@ -35,15 +38,17 @@ class ReaderGeneralSettings @JvmOverloads constructor(context: Context, attrs: A binding.backgroundColor.bindToIntPreference(preferences.readerTheme(), R.array.reader_themes_values) binding.showPageNumber.bindToPreference(preferences.showPageNumber()) 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.longTap.bindToPreference(preferences.readWithLongTap()) binding.alwaysShowChapterTransition.bindToPreference(preferences.alwaysShowChapterTransition()) 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()) - } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt index de2191a9a..cadeb403d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt @@ -111,6 +111,7 @@ class SettingsReaderController : SettingsController() { key = Keys.cutoutShort titleRes = R.string.pref_cutout_short defaultValue = true + preferences.fullscreen().asImmediateFlow { isVisible = it }.launchIn(viewScope) } }