mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Rename asFlow helper method
for asImmediateFlow with scope to asImmediateFlowIn
This commit is contained in:
parent
ec87df7056
commit
a33f339c19
@ -36,7 +36,7 @@ fun <T> com.tfcporciuncula.flow.Preference<T>.asImmediateFlow(block: (value: T)
|
||||
.onEach { block(it) }
|
||||
}
|
||||
|
||||
fun <T> com.tfcporciuncula.flow.Preference<T>.asImmediateFlow(scope: CoroutineScope, block: (value: T) -> Unit): Job {
|
||||
fun <T> com.tfcporciuncula.flow.Preference<T>.asImmediateFlowIn(scope: CoroutineScope, block: (value: T) -> Unit): Job {
|
||||
block(get())
|
||||
return asFlow()
|
||||
.onEach { block(it) }
|
||||
|
@ -42,7 +42,7 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlowIn
|
||||
import eu.kanade.tachiyomi.data.preference.toggle
|
||||
import eu.kanade.tachiyomi.databinding.ReaderActivityBinding
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
@ -1432,51 +1432,31 @@ class ReaderActivity :
|
||||
}
|
||||
.launchIn(scope)
|
||||
|
||||
preferences.showPageNumber().asFlow()
|
||||
.onEach { setPageNumberVisibility(it) }
|
||||
.launchIn(scope)
|
||||
preferences.showPageNumber().asImmediateFlowIn(scope) { setPageNumberVisibility(it) }
|
||||
|
||||
preferences.trueColor().asFlow()
|
||||
.onEach { setTrueColor(it) }
|
||||
.launchIn(scope)
|
||||
preferences.trueColor().asImmediateFlowIn(scope) { setTrueColor(it) }
|
||||
|
||||
preferences.fullscreen().asFlow()
|
||||
.onEach { setFullscreen(it) }
|
||||
.launchIn(scope)
|
||||
preferences.fullscreen().asImmediateFlowIn(scope) { setFullscreen(it) }
|
||||
|
||||
preferences.keepScreenOn().asFlow()
|
||||
.onEach { setKeepScreenOn(it) }
|
||||
.launchIn(scope)
|
||||
preferences.keepScreenOn().asImmediateFlowIn(scope) { setKeepScreenOn(it) }
|
||||
|
||||
preferences.customBrightness().asFlow()
|
||||
.onEach { setCustomBrightness(it) }
|
||||
.launchIn(scope)
|
||||
preferences.customBrightness().asImmediateFlowIn(scope) { setCustomBrightness(it) }
|
||||
|
||||
preferences.colorFilter().asFlow()
|
||||
.onEach { setColorFilter(it) }
|
||||
.launchIn(scope)
|
||||
preferences.colorFilter().asImmediateFlowIn(scope) { setColorFilter(it) }
|
||||
|
||||
preferences.colorFilterMode().asFlow()
|
||||
.onEach { setColorFilter(preferences.colorFilter().get()) }
|
||||
.launchIn(scope)
|
||||
|
||||
preferences.alwaysShowChapterTransition().asFlow()
|
||||
.onEach { showNewChapter = it }
|
||||
.launchIn(scope)
|
||||
|
||||
preferences.pageLayout().asFlow()
|
||||
.onEach {
|
||||
setBottomNavButtons(it)
|
||||
preferences.colorFilterMode().asImmediateFlowIn(scope) {
|
||||
setColorFilter(preferences.colorFilter().get())
|
||||
}
|
||||
.launchIn(scope)
|
||||
|
||||
preferences.readerBottomButtons().asFlow()
|
||||
.onEach {
|
||||
updateBottomShortcuts()
|
||||
preferences.alwaysShowChapterTransition().asImmediateFlowIn(scope) {
|
||||
showNewChapter = it
|
||||
}
|
||||
.launchIn(scope)
|
||||
|
||||
preferences.readWithTapping().asImmediateFlow(scope) {
|
||||
preferences.pageLayout().asImmediateFlowIn(scope) { setBottomNavButtons(it) }
|
||||
|
||||
preferences.readerBottomButtons().asImmediateFlowIn(scope) { updateBottomShortcuts() }
|
||||
|
||||
preferences.readWithTapping().asImmediateFlowIn(scope) {
|
||||
binding?.navigationOverlay.tappingEnabled = it
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import com.hippo.unifile.UniFile
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlowIn
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.util.system.getFilePicker
|
||||
@ -94,7 +94,7 @@ class SettingsDownloadController : SettingsController() {
|
||||
entryValues = dbCategories.map { it.id.toString() }
|
||||
allSelectionRes = R.string.all
|
||||
|
||||
preferences.downloadNew().asImmediateFlow(viewScope) { isVisible = it }
|
||||
preferences.downloadNew().asImmediateFlowIn(viewScope) { isVisible = it }
|
||||
}
|
||||
preferenceCategory {
|
||||
intListPreference(activity) {
|
||||
|
@ -4,6 +4,7 @@ import android.os.Build
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlowIn
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
|
||||
@ -260,13 +261,13 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = 2
|
||||
}
|
||||
infoPreference(R.string.automatic_can_still_switch).apply {
|
||||
preferences.pageLayout().asImmediateFlow(viewScope) { isVisible = it == PageLayout.AUTOMATIC }
|
||||
preferences.pageLayout().asImmediateFlowIn(viewScope) { isVisible = it == PageLayout.AUTOMATIC }
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.invertDoublePages
|
||||
titleRes = R.string.invert_double_pages
|
||||
defaultValue = false
|
||||
preferences.pageLayout().asImmediateFlow(viewScope) { isVisible = it != PageLayout.SINGLE_PAGE }
|
||||
preferences.pageLayout().asImmediateFlowIn(viewScope) { isVisible = it != PageLayout.SINGLE_PAGE }
|
||||
}
|
||||
}
|
||||
preferenceCategory {
|
||||
|
Loading…
Reference in New Issue
Block a user