Remove reader tapping option in favor of disabled nav layouts

(cherry picked from commit 2dfafa387baa4bee5f0524b1e0c5cf98c21f6b2d)

# Conflicts:
#	app/build.gradle.kts
This commit is contained in:
arkon 2022-04-08 16:44:13 -04:00 committed by Jobobby04
parent 0a110d149a
commit f3e17edd6c
11 changed files with 21 additions and 36 deletions

View File

@ -25,7 +25,7 @@ android {
applicationId = "eu.kanade.tachiyomi.sy" applicationId = "eu.kanade.tachiyomi.sy"
minSdk = AndroidConfig.minSdk minSdk = AndroidConfig.minSdk
targetSdk = AndroidConfig.targetSdk targetSdk = AndroidConfig.targetSdk
versionCode = 31 versionCode = 32
versionName = "1.8.1" versionName = "1.8.1"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")

View File

@ -261,6 +261,13 @@ object Migrations {
if (oldVersion < 76) { if (oldVersion < 76) {
BackupCreatorJob.setupTask(context) BackupCreatorJob.setupTask(context)
} }
if (oldVersion < 77) {
val oldReaderTap = prefs.getBoolean("reader_tap", false)
if (!oldReaderTap) {
preferences.navigationModePager().set(5)
preferences.navigationModeWebtoon().set(5)
}
}
return true return true
} }

View File

@ -11,6 +11,7 @@ import android.view.ViewPropertyAnimator
import androidx.core.graphics.withSave import androidx.core.graphics.withSave
import androidx.core.view.isVisible import androidx.core.view.isVisible
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.DisabledNavigation
import kotlin.math.abs import kotlin.math.abs
class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) { class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) {
@ -19,12 +20,12 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet)
private var navigation: ViewerNavigation? = null private var navigation: ViewerNavigation? = null
fun setNavigation(navigation: ViewerNavigation, tappingEnabled: Boolean, showOnStart: Boolean) { fun setNavigation(navigation: ViewerNavigation, showOnStart: Boolean) {
val firstLaunch = this.navigation == null val firstLaunch = this.navigation == null
this.navigation = navigation this.navigation = navigation
invalidate() invalidate()
if (isVisible || (!showOnStart && firstLaunch) || !tappingEnabled) { if (isVisible || (!showOnStart && firstLaunch) || navigation is DisabledNavigation) {
return return
} }

View File

@ -69,8 +69,6 @@ class ReaderReadingModeSettings @JvmOverloads constructor(context: Context, attr
binding.webtoonPrefsGroup.root.isVisible = false binding.webtoonPrefsGroup.root.isVisible = false
binding.pagerPrefsGroup.root.isVisible = true binding.pagerPrefsGroup.root.isVisible = true
binding.pagerPrefsGroup.tappingPrefsGroup.isVisible = preferences.readWithTapping().get()
binding.pagerPrefsGroup.tappingInverted.bindToPreference(preferences.pagerNavInverted()) binding.pagerPrefsGroup.tappingInverted.bindToPreference(preferences.pagerNavInverted())
binding.pagerPrefsGroup.pagerNav.bindToPreference(preferences.navigationModePager()) binding.pagerPrefsGroup.pagerNav.bindToPreference(preferences.navigationModePager())
@ -107,8 +105,6 @@ class ReaderReadingModeSettings @JvmOverloads constructor(context: Context, attr
binding.pagerPrefsGroup.root.isVisible = false binding.pagerPrefsGroup.root.isVisible = false
binding.webtoonPrefsGroup.root.isVisible = true binding.webtoonPrefsGroup.root.isVisible = true
binding.webtoonPrefsGroup.tappingPrefsGroup.isVisible = preferences.readWithTapping().get()
binding.webtoonPrefsGroup.tappingInverted.bindToPreference(preferences.webtoonNavInverted()) binding.webtoonPrefsGroup.tappingInverted.bindToPreference(preferences.webtoonNavInverted())
binding.webtoonPrefsGroup.webtoonNav.bindToPreference(preferences.navigationModeWebtoon()) binding.webtoonPrefsGroup.webtoonNav.bindToPreference(preferences.navigationModeWebtoon())

View File

@ -17,7 +17,6 @@ abstract class ViewerConfig(preferences: PreferencesHelper, private val scope: C
var navigationModeChangedListener: (() -> Unit)? = null var navigationModeChangedListener: (() -> Unit)? = null
var tappingEnabled = true
var tappingInverted = TappingInvertMode.NONE var tappingInverted = TappingInvertMode.NONE
var longTapEnabled = true var longTapEnabled = true
var doubleTapAnimDuration = 500 var doubleTapAnimDuration = 500
@ -42,9 +41,6 @@ abstract class ViewerConfig(preferences: PreferencesHelper, private val scope: C
protected set protected set
init { init {
preferences.readWithTapping()
.register({ tappingEnabled = it })
preferences.readWithLongTap() preferences.readWithLongTap()
.register({ longTapEnabled = it }) .register({ longTapEnabled = it })

View File

@ -14,5 +14,5 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
*/ */
class DisabledNavigation : ViewerNavigation() { class DisabledNavigation : ViewerNavigation() {
override var regions: List<Region> = listOf() override var regions: List<Region> = emptyList()
} }

View File

@ -100,11 +100,6 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
// SY <-- // SY <--
) )
pager.tapListener = f@{ event -> pager.tapListener = f@{ event ->
if (!config.tappingEnabled) {
activity.toggleMenu()
return@f
}
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height) val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
val navigator = config.navigator val navigator = config.navigator
@ -145,7 +140,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
config.navigationModeChangedListener = { config.navigationModeChangedListener = {
val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay
activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart) activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart)
} }
} }

View File

@ -108,11 +108,6 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
}, },
) )
recycler.tapListener = f@{ event -> recycler.tapListener = f@{ event ->
if (!config.tappingEnabled) {
activity.toggleMenu()
return@f
}
val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height) val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height)
val navigator = config.navigator val navigator = config.navigator
@ -147,7 +142,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
config.navigationModeChangedListener = { config.navigationModeChangedListener = {
val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay
activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart) activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart)
} }
// SY --> // SY -->

View File

@ -174,8 +174,6 @@ class SettingsReaderController : SettingsController() {
entryValues = values.indices.map { index -> "$index" }.toTypedArray() entryValues = values.indices.map { index -> "$index" }.toTypedArray()
} }
summary = "%s" summary = "%s"
visibleIf(preferences.readWithTapping()) { it }
} }
listPreference { listPreference {
bindTo(preferences.pagerNavInverted()) bindTo(preferences.pagerNavInverted())
@ -193,8 +191,6 @@ class SettingsReaderController : SettingsController() {
TappingInvertMode.BOTH.name, TappingInvertMode.BOTH.name,
) )
summary = "%s" summary = "%s"
visibleIf(preferences.readWithTapping()) { it }
} }
intListPreference { intListPreference {
bindTo(preferences.imageScaleType()) bindTo(preferences.imageScaleType())
@ -263,7 +259,6 @@ class SettingsReaderController : SettingsController() {
entryValues = values.indices.map { index -> "$index" }.toTypedArray() entryValues = values.indices.map { index -> "$index" }.toTypedArray()
} }
summary = "%s" summary = "%s"
visibleIf(preferences.readWithTapping()) { it }
} }
listPreference { listPreference {
bindTo(preferences.webtoonNavInverted()) bindTo(preferences.webtoonNavInverted())
@ -281,8 +276,6 @@ class SettingsReaderController : SettingsController() {
TappingInvertMode.BOTH.name, TappingInvertMode.BOTH.name,
) )
summary = "%s" summary = "%s"
visibleIf(preferences.readWithTapping()) { it }
} }
intListPreference { intListPreference {
bindTo(preferences.webtoonSidePadding()) bindTo(preferences.webtoonSidePadding())
@ -357,10 +350,6 @@ class SettingsReaderController : SettingsController() {
preferenceCategory { preferenceCategory {
titleRes = R.string.pref_reader_navigation titleRes = R.string.pref_reader_navigation
switchPreference {
bindTo(preferences.readWithTapping())
titleRes = R.string.pref_read_with_tapping
}
switchPreference { switchPreference {
bindTo(preferences.readWithVolumeKeys()) bindTo(preferences.readWithVolumeKeys())
titleRes = R.string.pref_read_with_volume_keys titleRes = R.string.pref_read_with_volume_keys

View File

@ -435,6 +435,13 @@ object EXHMigrations {
remove("latest_tab_sources") remove("latest_tab_sources")
} }
} }
if (oldVersion under 32) {
val oldReaderTap = prefs.getBoolean("reader_tap", false)
if (!oldReaderTap) {
preferences.navigationModePager().set(5)
preferences.navigationModeWebtoon().set(5)
}
}
// if (oldVersion under 1) { } (1 is current release version) // if (oldVersion under 1) { } (1 is current release version)
// do stuff here when releasing changed crap // do stuff here when releasing changed crap

View File

@ -315,7 +315,6 @@
<string name="pref_reader_navigation">Navigation</string> <string name="pref_reader_navigation">Navigation</string>
<string name="pref_read_with_volume_keys">Volume keys</string> <string name="pref_read_with_volume_keys">Volume keys</string>
<string name="pref_read_with_volume_keys_inverted">Invert volume keys</string> <string name="pref_read_with_volume_keys_inverted">Invert volume keys</string>
<string name="pref_read_with_tapping">Tapping</string>
<string name="pref_read_with_tapping_inverted">Invert tapping</string> <string name="pref_read_with_tapping_inverted">Invert tapping</string>
<string name="tapping_inverted_none">None</string> <string name="tapping_inverted_none">None</string>
<string name="tapping_inverted_horizontal">Horizontal</string> <string name="tapping_inverted_horizontal">Horizontal</string>