From 2dfafa387baa4bee5f0524b1e0c5cf98c21f6b2d Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 8 Apr 2022 16:44:13 -0400 Subject: [PATCH] Remove reader tapping option in favor of disabled nav layouts --- app/build.gradle.kts | 2 +- app/src/main/java/eu/kanade/tachiyomi/Migrations.kt | 7 +++++++ .../ui/reader/ReaderNavigationOverlayView.kt | 5 +++-- .../ui/reader/setting/ReaderReadingModeSettings.kt | 4 ---- .../kanade/tachiyomi/ui/reader/viewer/ViewerConfig.kt | 4 ---- .../ui/reader/viewer/navigation/DisabledNavigation.kt | 2 +- .../tachiyomi/ui/reader/viewer/pager/PagerViewer.kt | 7 +------ .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 7 +------ .../tachiyomi/ui/setting/SettingsReaderController.kt | 11 ----------- app/src/main/res/values/strings.xml | 1 - 10 files changed, 14 insertions(+), 36 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4e36a73735..1c327d1582 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -24,7 +24,7 @@ android { applicationId = "eu.kanade.tachiyomi" minSdk = AndroidConfig.minSdk targetSdk = AndroidConfig.targetSdk - versionCode = 76 + versionCode = 77 versionName = "0.13.1" buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 3f48a8f232..21470392cf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -259,6 +259,13 @@ object Migrations { if (oldVersion < 76) { 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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt index 3af21d20ab..3cb62e1188 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt @@ -11,6 +11,7 @@ import android.view.ViewPropertyAnimator import androidx.core.graphics.withSave import androidx.core.view.isVisible import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation +import eu.kanade.tachiyomi.ui.reader.viewer.navigation.DisabledNavigation import kotlin.math.abs class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) { @@ -19,12 +20,12 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) private var navigation: ViewerNavigation? = null - fun setNavigation(navigation: ViewerNavigation, tappingEnabled: Boolean, showOnStart: Boolean) { + fun setNavigation(navigation: ViewerNavigation, showOnStart: Boolean) { val firstLaunch = this.navigation == null this.navigation = navigation invalidate() - if (isVisible || (!showOnStart && firstLaunch) || !tappingEnabled) { + if (isVisible || (!showOnStart && firstLaunch) || navigation is DisabledNavigation) { return } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt index e70e585ff6..8cf75a54cb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt @@ -69,8 +69,6 @@ class ReaderReadingModeSettings @JvmOverloads constructor(context: Context, attr binding.webtoonPrefsGroup.root.isVisible = false binding.pagerPrefsGroup.root.isVisible = true - binding.pagerPrefsGroup.tappingPrefsGroup.isVisible = preferences.readWithTapping().get() - binding.pagerPrefsGroup.tappingInverted.bindToPreference(preferences.pagerNavInverted()) binding.pagerPrefsGroup.pagerNav.bindToPreference(preferences.navigationModePager()) @@ -101,8 +99,6 @@ class ReaderReadingModeSettings @JvmOverloads constructor(context: Context, attr binding.pagerPrefsGroup.root.isVisible = false binding.webtoonPrefsGroup.root.isVisible = true - binding.webtoonPrefsGroup.tappingPrefsGroup.isVisible = preferences.readWithTapping().get() - binding.webtoonPrefsGroup.tappingInverted.bindToPreference(preferences.webtoonNavInverted()) binding.webtoonPrefsGroup.webtoonNav.bindToPreference(preferences.navigationModeWebtoon()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerConfig.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerConfig.kt index 427e7950e5..42c594b006 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerConfig.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerConfig.kt @@ -17,7 +17,6 @@ abstract class ViewerConfig(preferences: PreferencesHelper, private val scope: C var navigationModeChangedListener: (() -> Unit)? = null - var tappingEnabled = true var tappingInverted = TappingInvertMode.NONE var longTapEnabled = true var usePageTransitions = false @@ -43,9 +42,6 @@ abstract class ViewerConfig(preferences: PreferencesHelper, private val scope: C protected set init { - preferences.readWithTapping() - .register({ tappingEnabled = it }) - preferences.readWithLongTap() .register({ longTapEnabled = it }) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt index 7f8d73be1c..11a715faf8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt @@ -14,5 +14,5 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation */ class DisabledNavigation : ViewerNavigation() { - override var regions: List = listOf() + override var regions: List = emptyList() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt index e165da0338..77591e1dfc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt @@ -95,11 +95,6 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { } ) pager.tapListener = f@{ event -> - if (!config.tappingEnabled) { - activity.toggleMenu() - return@f - } - val pos = PointF(event.rawX / pager.width, event.rawY / pager.height) val navigator = config.navigator @@ -134,7 +129,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { config.navigationModeChangedListener = { val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay - activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart) + activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index beb39c5b88..fea2431970 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -107,11 +107,6 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr } ) recycler.tapListener = f@{ event -> - if (!config.tappingEnabled) { - activity.toggleMenu() - return@f - } - val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height) val navigator = config.navigator @@ -146,7 +141,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr config.navigationModeChangedListener = { val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay - activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart) + activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart) } frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt index 845b787726..7d0e9588e9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt @@ -148,8 +148,6 @@ class SettingsReaderController : SettingsController() { entryValues = values.indices.map { index -> "$index" }.toTypedArray() } summary = "%s" - - visibleIf(preferences.readWithTapping()) { it } } listPreference { bindTo(preferences.pagerNavInverted()) @@ -167,8 +165,6 @@ class SettingsReaderController : SettingsController() { TappingInvertMode.BOTH.name ) summary = "%s" - - visibleIf(preferences.readWithTapping()) { it } } intListPreference { bindTo(preferences.imageScaleType()) @@ -231,7 +227,6 @@ class SettingsReaderController : SettingsController() { entryValues = values.indices.map { index -> "$index" }.toTypedArray() } summary = "%s" - visibleIf(preferences.readWithTapping()) { it } } listPreference { bindTo(preferences.webtoonNavInverted()) @@ -249,8 +244,6 @@ class SettingsReaderController : SettingsController() { TappingInvertMode.BOTH.name ) summary = "%s" - - visibleIf(preferences.readWithTapping()) { it } } intListPreference { bindTo(preferences.webtoonSidePadding()) @@ -299,10 +292,6 @@ class SettingsReaderController : SettingsController() { preferenceCategory { titleRes = R.string.pref_reader_navigation - switchPreference { - bindTo(preferences.readWithTapping()) - titleRes = R.string.pref_read_with_tapping - } switchPreference { bindTo(preferences.readWithVolumeKeys()) titleRes = R.string.pref_read_with_volume_keys diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26860446b3..755ed949c0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -315,7 +315,6 @@ Navigation Volume keys Invert volume keys - Tapping Invert tapping None Horizontal