Settings cleanup (#7126)

* Settings cleanup

* Oops

* Also hide "Invert tap zones" if tap zones is set to "Disabled" in ReaderReadingModeSettings
This commit is contained in:
CVIUS 2022-05-15 21:37:52 +08:00 committed by GitHub
parent 6fb5552d57
commit 4c9331c4e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View File

@ -72,7 +72,9 @@ class ReaderReadingModeSettings @JvmOverloads constructor(context: Context, attr
binding.pagerPrefsGroup.tappingInverted.bindToPreference(preferences.pagerNavInverted())
binding.pagerPrefsGroup.pagerNav.bindToPreference(preferences.navigationModePager())
preferences.navigationModePager()
.asImmediateFlow { binding.pagerPrefsGroup.tappingInverted.isVisible = it != 5 }
.launchIn((context as ReaderActivity).lifecycleScope)
// Makes so that landscape zoom gets hidden away when image scale type is not fit screen
binding.pagerPrefsGroup.scaleType.bindToPreference(preferences.imageScaleType(), 1)
preferences.imageScaleType()
@ -102,6 +104,9 @@ class ReaderReadingModeSettings @JvmOverloads constructor(context: Context, attr
binding.webtoonPrefsGroup.tappingInverted.bindToPreference(preferences.webtoonNavInverted())
binding.webtoonPrefsGroup.webtoonNav.bindToPreference(preferences.navigationModeWebtoon())
preferences.navigationModeWebtoon()
.asImmediateFlow { binding.webtoonPrefsGroup.tappingInverted.isVisible = it != 5 }
.launchIn((context as ReaderActivity).lifecycleScope)
binding.webtoonPrefsGroup.cropBordersWebtoon.bindToPreference(preferences.cropBordersWebtoon())
binding.webtoonPrefsGroup.webtoonSidePadding.bindToIntPreference(preferences.webtoonSidePadding(), R.array.webtoon_side_padding_values)

View File

@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.data.cache.ChapterCache
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.track.TrackManager
import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.network.PREF_DOH_ADGUARD
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
@ -59,6 +60,7 @@ class SettingsAdvancedController(
private val network: NetworkHelper by injectLazy()
private val chapterCache: ChapterCache by injectLazy()
private val trackManager: TrackManager by injectLazy()
@SuppressLint("BatteryLife")
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
@ -212,6 +214,7 @@ class SettingsAdvancedController(
onClick { LibraryUpdateService.start(context, target = Target.COVERS) }
}
if (trackManager.hasLoggedServices()) {
preference {
key = "pref_refresh_library_tracking"
titleRes = R.string.pref_refresh_library_tracking
@ -219,6 +222,7 @@ class SettingsAdvancedController(
onClick { LibraryUpdateService.start(context, target = Target.TRACKING) }
}
}
preference {
key = "pref_reset_viewer_flags"
titleRes = R.string.pref_reset_viewer_flags

View File

@ -165,6 +165,7 @@ class SettingsReaderController : SettingsController() {
TappingInvertMode.BOTH.name,
)
summary = "%s"
visibleIf(preferences.navigationModePager()) { it != 5 }
}
intListPreference {
bindTo(preferences.imageScaleType())
@ -244,6 +245,7 @@ class SettingsReaderController : SettingsController() {
TappingInvertMode.BOTH.name,
)
summary = "%s"
visibleIf(preferences.navigationModeWebtoon()) { it != 5 }
}
intListPreference {
bindTo(preferences.webtoonSidePadding())