Refactor dependant preference visibility flows
(cherry picked from commit 945afc71ef7aa753ec09640cbf9859ff98770c5a) # Conflicts: # 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
b19c178eae
commit
2bd9d2844f
@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.PREF_DOH_ADGUARD
|
||||
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
|
||||
@ -303,8 +302,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
defaultValue = ""
|
||||
summaryRes = R.string.data_saver_server_summary
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -312,8 +310,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
key = Keys.dataSaverDownloaer
|
||||
defaultValue = true
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -321,8 +318,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
key = Keys.ignoreJpeg
|
||||
defaultValue = false
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -330,8 +326,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
key = Keys.ignoreGif
|
||||
defaultValue = true
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
@ -342,8 +337,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
defaultValue = "80"
|
||||
summaryRes = R.string.data_saver_image_quality_summary
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -353,8 +347,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
summaryOn = context.getString(R.string.data_saver_image_format_summary_on)
|
||||
summaryOff = context.getString(R.string.data_saver_image_format_summary_off)
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -362,8 +355,7 @@ class SettingsAdvancedController : SettingsController() {
|
||||
key = Keys.dataSaverColorBW
|
||||
defaultValue = false
|
||||
|
||||
preferences.dataSaver().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.dataSaver()) { it }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ 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.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.initThenAdd
|
||||
@ -19,7 +18,6 @@ import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||
import eu.kanade.tachiyomi.util.system.isTablet
|
||||
import eu.kanade.tachiyomi.widget.preference.ThemesPreference
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import java.util.Date
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||
@ -89,8 +87,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_dark_theme_pure_black
|
||||
defaultValue = false
|
||||
|
||||
preferences.themeMode().asImmediateFlow { isVisible = it != Values.ThemeMode.light }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.themeMode()) { it != Values.ThemeMode.light }
|
||||
|
||||
onChange {
|
||||
activity?.let { ActivityCompat.recreate(it) }
|
||||
|
@ -23,7 +23,6 @@ import eu.kanade.tachiyomi.data.backup.BackupRestoreService
|
||||
import eu.kanade.tachiyomi.data.backup.full.FullBackupRestoreValidator
|
||||
import eu.kanade.tachiyomi.data.backup.full.models.BackupFull
|
||||
import eu.kanade.tachiyomi.data.backup.legacy.LegacyBackupRestoreValidator
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
@ -137,8 +136,7 @@ class SettingsBackupController : SettingsController() {
|
||||
}
|
||||
}
|
||||
|
||||
preferences.backupInterval().asImmediateFlow { isVisible = it > 0 }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.backupInterval()) { it > 0 }
|
||||
|
||||
preferences.backupsDirectory().asFlow()
|
||||
.onEach { path ->
|
||||
@ -155,8 +153,7 @@ class SettingsBackupController : SettingsController() {
|
||||
defaultValue = "1"
|
||||
summary = "%s"
|
||||
|
||||
preferences.backupInterval().asImmediateFlow { isVisible = it > 0 }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.backupInterval()) { it > 0 }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceController
|
||||
import androidx.preference.PreferenceGroup
|
||||
import androidx.preference.PreferenceScreen
|
||||
@ -21,12 +22,14 @@ import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import dev.chrisbanes.insetter.applyInsetter
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
@ -133,4 +136,9 @@ abstract class SettingsController : PreferenceController() {
|
||||
|
||||
(activity as? AppCompatActivity)?.supportActionBar?.title = getTitle()
|
||||
}
|
||||
|
||||
inline fun <T> Preference.visibleIf(preference: com.tfcporciuncula.flow.Preference<T>, crossinline block: (T) -> Boolean) {
|
||||
preference.asImmediateFlow { isVisible = block(it) }
|
||||
.launchIn(viewScope)
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import eu.kanade.tachiyomi.R
|
||||
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.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
@ -84,8 +83,7 @@ class SettingsDownloadController : SettingsController() {
|
||||
entryValues = entries
|
||||
defaultValue = "0"
|
||||
|
||||
preferences.saveChaptersAsCBZ().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.saveChaptersAsCBZ()) { it }
|
||||
}
|
||||
// SY <--
|
||||
|
||||
@ -153,8 +151,7 @@ class SettingsDownloadController : SettingsController() {
|
||||
DownloadCategoriesDialog().showDialog(router)
|
||||
}
|
||||
|
||||
preferences.downloadNew().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.downloadNew()) { it }
|
||||
|
||||
fun updateSummary() {
|
||||
val selectedCategories = preferences.downloadNewCategories().get()
|
||||
|
@ -20,7 +20,6 @@ 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.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.databinding.DialogStubTextinputBinding
|
||||
import eu.kanade.tachiyomi.ui.setting.eh.FrontPageCategoriesDialog
|
||||
import eu.kanade.tachiyomi.ui.setting.eh.LanguagesDialog
|
||||
@ -133,8 +132,7 @@ class SettingsEhController : SettingsController() {
|
||||
|
||||
onChange { preferences.useHentaiAtHome().reconfigure() }
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -146,8 +144,7 @@ class SettingsEhController : SettingsController() {
|
||||
|
||||
onChange { preferences.useJapaneseTitle().reconfigure() }
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -159,8 +156,7 @@ class SettingsEhController : SettingsController() {
|
||||
|
||||
onChange { preferences.exhUseOriginalImages().reconfigure() }
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -176,8 +172,7 @@ class SettingsEhController : SettingsController() {
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -221,8 +216,7 @@ class SettingsEhController : SettingsController() {
|
||||
.show()
|
||||
}
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -267,8 +261,7 @@ class SettingsEhController : SettingsController() {
|
||||
.show()
|
||||
}
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -282,8 +275,7 @@ class SettingsEhController : SettingsController() {
|
||||
dialog.showDialog(router)
|
||||
}
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -297,8 +289,7 @@ class SettingsEhController : SettingsController() {
|
||||
dialog.showDialog(router)
|
||||
}
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -307,8 +298,7 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.watched_list_default
|
||||
summaryRes = R.string.watched_list_state_summary
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
listPreference {
|
||||
@ -335,8 +325,7 @@ class SettingsEhController : SettingsController() {
|
||||
|
||||
onChange { preferences.imageQuality().reconfigure() }
|
||||
|
||||
preferences.enableExhentai().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
@ -465,9 +454,7 @@ class SettingsEhController : SettingsController() {
|
||||
summary = context.getString(R.string.restrictions, restrictionsText)
|
||||
}
|
||||
|
||||
preferences.exhAutoUpdateFrequency().asFlow()
|
||||
.onEach { isVisible = it > 0 }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.exhAutoUpdateFrequency()) { it > 0 }
|
||||
|
||||
onChange {
|
||||
// Post to event looper to allow the preference to be updated.
|
||||
|
@ -17,7 +17,6 @@ import eu.kanade.tachiyomi.data.preference.MANGA_FULLY_READ
|
||||
import eu.kanade.tachiyomi.data.preference.MANGA_ONGOING
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues.GroupLibraryMode
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.databinding.PrefLibraryColumnsBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
@ -190,8 +189,7 @@ class SettingsLibraryController : SettingsController() {
|
||||
entryValues = arrayOf(DEVICE_ONLY_ON_WIFI, DEVICE_CHARGING)
|
||||
defaultValue = preferences.libraryUpdateDeviceRestriction().defaultValue
|
||||
|
||||
preferences.libraryUpdateInterval().asImmediateFlow { isVisible = it > 0 }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
|
||||
onChange {
|
||||
// Post to event looper to allow the preference to be updated.
|
||||
@ -229,8 +227,7 @@ class SettingsLibraryController : SettingsController() {
|
||||
entryValues = arrayOf(MANGA_FULLY_READ, MANGA_ONGOING)
|
||||
defaultValue = preferences.libraryUpdateMangaRestriction().defaultValue
|
||||
|
||||
preferences.libraryUpdateInterval().asImmediateFlow { isVisible = it > 0 }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.libraryUpdateInterval()) { it > 0 }
|
||||
|
||||
fun updateSummary() {
|
||||
val restrictions = preferences.libraryUpdateMangaRestriction().get()
|
||||
|
@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues.TappingInvertMode
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderBottomButton
|
||||
@ -26,7 +25,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.system.hasDisplayCutout
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
@ -83,14 +81,14 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_show_vert_seekbar_landscape
|
||||
summaryRes = R.string.pref_show_vert_seekbar_landscape_summary
|
||||
defaultValue = false
|
||||
preferences.forceHorizontalSeekbar().asImmediateFlow { isVisible = !it }.launchIn(viewScope)
|
||||
visibleIf(preferences.forceHorizontalSeekbar()) { !it }
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.leftVerticalSeekbar
|
||||
titleRes = R.string.pref_left_handed_vertical_seekbar
|
||||
summaryRes = R.string.pref_left_handed_vertical_seekbar_summary
|
||||
defaultValue = false
|
||||
preferences.forceHorizontalSeekbar().asImmediateFlow { isVisible = !it }.launchIn(viewScope)
|
||||
visibleIf(preferences.forceHorizontalSeekbar()) { !it }
|
||||
}
|
||||
// SY <--
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@ -139,7 +137,8 @@ class SettingsReaderController : SettingsController() {
|
||||
key = Keys.cutoutShort
|
||||
titleRes = R.string.pref_cutout_short
|
||||
defaultValue = true
|
||||
preferences.fullscreen().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
|
||||
visibleIf(preferences.fullscreen()) { it }
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +186,7 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
|
||||
preferences.readWithTapping().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
listPreference {
|
||||
key = Keys.pagerNavInverted
|
||||
@ -207,7 +206,7 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = TappingInvertMode.NONE.name
|
||||
summary = "%s"
|
||||
|
||||
preferences.readWithTapping().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.imageScaleType
|
||||
@ -259,7 +258,7 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_dual_page_invert
|
||||
summaryRes = R.string.pref_dual_page_invert_summary
|
||||
defaultValue = false
|
||||
preferences.dualPageSplitPaged().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.dualPageSplitPaged()) { it }
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +274,7 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
|
||||
preferences.readWithTapping().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
listPreference {
|
||||
key = Keys.webtoonNavInverted
|
||||
@ -295,7 +294,7 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = TappingInvertMode.NONE.name
|
||||
summary = "%s"
|
||||
|
||||
preferences.readWithTapping().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.readWithTapping()) { it }
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.webtoonSidePadding
|
||||
@ -341,7 +340,7 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_dual_page_invert
|
||||
summaryRes = R.string.pref_dual_page_invert_summary
|
||||
defaultValue = false
|
||||
preferences.dualPageSplitWebtoon().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.dualPageSplitWebtoon()) { it }
|
||||
}
|
||||
// SY -->
|
||||
switchPreference {
|
||||
@ -392,8 +391,7 @@ class SettingsReaderController : SettingsController() {
|
||||
key = Keys.readWithVolumeKeysInverted
|
||||
titleRes = R.string.pref_read_with_volume_keys_inverted
|
||||
defaultValue = false
|
||||
|
||||
preferences.readWithVolumeKeys().asImmediateFlow { isVisible = it }.launchIn(viewScope)
|
||||
visibleIf(preferences.readWithVolumeKeys()) { it }
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,7 +548,7 @@ class SettingsReaderController : SettingsController() {
|
||||
key = Keys.invertDoublePages
|
||||
titleRes = R.string.invert_double_pages
|
||||
defaultValue = false
|
||||
preferences.pageLayout().asImmediateFlow { isVisible = it != PagerConfig.PageLayout.SINGLE_PAGE }
|
||||
visibleIf(preferences.pageLayout()) { it != PagerConfig.PageLayout.SINGLE_PAGE }
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
|
@ -9,7 +9,6 @@ import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.biometric.BiometricTimesController
|
||||
@ -26,7 +25,6 @@ import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.startAuthentication
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
@ -90,8 +88,7 @@ class SettingsSecurityController : SettingsController() {
|
||||
false
|
||||
}
|
||||
|
||||
preferences.useAuthenticator().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.useAuthenticator()) { it }
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,8 +112,7 @@ class SettingsSecurityController : SettingsController() {
|
||||
val timeRanges = preferences.authenticatorTimeRanges().get().size
|
||||
summary = context.resources.getQuantityString(R.plurals.num_lock_times, timeRanges, timeRanges)
|
||||
|
||||
preferences.useAuthenticator().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.useAuthenticator()) { it }
|
||||
|
||||
onClick {
|
||||
router.pushController(BiometricTimesController().withFadeTransaction())
|
||||
@ -127,8 +123,7 @@ class SettingsSecurityController : SettingsController() {
|
||||
titleRes = R.string.biometric_lock_days
|
||||
summaryRes = R.string.biometric_lock_days_summary
|
||||
|
||||
preferences.useAuthenticator().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
visibleIf(preferences.useAuthenticator()) { it }
|
||||
|
||||
onClick {
|
||||
SetLockedDaysDialog().showDialog(router)
|
||||
|
Loading…
x
Reference in New Issue
Block a user