From 0861c5618c097f89bec75ffeed1359e345532d89 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Sun, 8 Jan 2023 03:25:30 +0800 Subject: [PATCH] Fix reader settings sheet not updated (#8854) * Revert "Recreate reader settings when opening sheet (#8054)" This reverts commit acb8ab15b2e73ba2f161eb201e93ba3a36df2867. * Revert "Fix stacking of Settings menu in the reader on multiple taps (#8002)" This reverts commit 30ac94181b2c410aedead964a815b080ef3e62ee. * Fix reader settings sheet not updated --- .../tachiyomi/ui/reader/ReaderActivity.kt | 12 ++++++----- .../ui/reader/setting/ReaderSettingsSheet.kt | 21 +++---------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 4c3aa75507..d47f0d0e55 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -558,15 +558,17 @@ class ReaderActivity : BaseActivity() { // Settings sheet with(binding.actionSettings) { setTooltip(R.string.action_settings) - val readerSettingSheetDialog = ReaderSettingsSheet(this@ReaderActivity) + + var readerSettingSheet: ReaderSettingsSheet? = null + setOnClickListener { - if (!readerSettingSheetDialog.isShowing()) { - readerSettingSheetDialog.show() - } + if (readerSettingSheet?.isShowing == true) return@setOnClickListener + readerSettingSheet = ReaderSettingsSheet(this@ReaderActivity).apply { show() } } setOnLongClickListener { - ReaderSettingsSheet(this@ReaderActivity, showColorFilterSettings = true).show() + if (readerSettingSheet?.isShowing == true) return@setOnLongClickListener false + readerSettingSheet = ReaderSettingsSheet(this@ReaderActivity, showColorFilterSettings = true).apply { show() } true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderSettingsSheet.kt index 5d6dd6167c..14386d3c55 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderSettingsSheet.kt @@ -13,19 +13,9 @@ class ReaderSettingsSheet( private val showColorFilterSettings: Boolean = false, ) : TabbedBottomSheetDialog(activity) { - private lateinit var readingModeSettings: ReaderReadingModeSettings - private lateinit var generalSettings: ReaderGeneralSettings - private lateinit var colorFilterSettings: ReaderColorFilterSettings - - init { - initSettings() - } - - private fun initSettings() { - readingModeSettings = ReaderReadingModeSettings(activity) - generalSettings = ReaderGeneralSettings(activity) - colorFilterSettings = ReaderColorFilterSettings(activity) - } + private val readingModeSettings = ReaderReadingModeSettings(activity) + private val generalSettings = ReaderGeneralSettings(activity) + private val colorFilterSettings = ReaderColorFilterSettings(activity) private val backgroundDimAnimator by lazy { val sheetBackgroundDim = window?.attributes?.dimAmount ?: 0.25f @@ -84,9 +74,4 @@ class ReaderSettingsSheet( R.string.pref_category_general, R.string.custom_filter, ) - - override fun show() { - initSettings() - super.show() - } }