Hide option if tapping disabled

This commit is contained in:
Andreas E 2020-06-25 18:01:45 +02:00
parent 1681437206
commit e6ace844b6
No known key found for this signature in database
GPG Key ID: D7D48B26482380B8

View File

@ -5,6 +5,7 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
import eu.kanade.tachiyomi.data.preference.PreferenceValues.TappingInvertMode import eu.kanade.tachiyomi.data.preference.PreferenceValues.TappingInvertMode
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
import eu.kanade.tachiyomi.util.preference.defaultValue import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.preference.entriesRes import eu.kanade.tachiyomi.util.preference.entriesRes
import eu.kanade.tachiyomi.util.preference.intListPreference import eu.kanade.tachiyomi.util.preference.intListPreference
@ -14,6 +15,7 @@ import eu.kanade.tachiyomi.util.preference.summaryRes
import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes import eu.kanade.tachiyomi.util.preference.titleRes
import eu.kanade.tachiyomi.util.system.hasDisplayCutout import eu.kanade.tachiyomi.util.system.hasDisplayCutout
import kotlinx.coroutines.flow.launchIn
class SettingsReaderController : SettingsController() { class SettingsReaderController : SettingsController() {
@ -209,7 +211,9 @@ class SettingsReaderController : SettingsController() {
) )
defaultValue = TappingInvertMode.NONE.name defaultValue = TappingInvertMode.NONE.name
summary = "%s" summary = "%s"
}.apply { dependency = Keys.readWithTapping }
preferences.readWithTapping().asImmediateFlow { isVisible = it }.launchIn(scope)
}
switchPreference { switchPreference {
key = Keys.readWithLongTap key = Keys.readWithLongTap
titleRes = R.string.pref_read_with_long_tap titleRes = R.string.pref_read_with_long_tap