diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
index c4714e2ab8..18e99d7ae7 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
@@ -53,6 +53,8 @@ object PreferenceKeys {
const val webtoonSidePadding = "webtoon_side_padding"
+ const val webtoonDisableZoom = "webtoon_disable_zoom"
+
const val updateOnlyNonCompleted = "pref_update_only_non_completed_key"
const val autoUpdateTrack = "pref_auto_update_manga_sync_key"
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
index bcd8c68624..5e270c251e 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
@@ -99,6 +99,8 @@ class PreferencesHelper(val context: Context) {
fun webtoonSidePadding() = flowPrefs.getInt(Keys.webtoonSidePadding, 0)
+ fun webtoonDisableZoom() = flowPrefs.getBoolean(Keys.webtoonDisableZoom, false)
+
fun readWithTapping() = flowPrefs.getBoolean(Keys.readWithTapping, true)
fun readWithLongTap() = flowPrefs.getBoolean(Keys.readWithLongTap, true)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt
index 17a800443a..1ffd2d25d2 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt
@@ -150,6 +150,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
pager_prefs_group.gone()
crop_borders_webtoon.bindToPreference(preferences.cropBordersWebtoon())
webtoon_side_padding.bindToIntPreference(preferences.webtoonSidePadding(), R.array.webtoon_side_padding_values)
+ webtoon_disable_zoom.bindToPreference(preferences.webtoonDisableZoom())
}
/**
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt
index 6f108b892c..68898aa94c 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt
@@ -16,11 +16,18 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) : ViewerConfi
var sidePadding = 0
private set
+ var disableZoom = false
+ private set
+ var zoomPropertyChangedListener: ((Boolean) -> Unit)? = null
+
init {
preferences.cropBordersWebtoon()
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
preferences.webtoonSidePadding()
.register({ sidePadding = it }, { imagePropertyChangedListener?.invoke() })
+
+ preferences.webtoonDisableZoom()
+ .register({ disableZoom = it }, { zoomPropertyChangedListener?.invoke(it) })
}
}
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt
index 3f919569ca..9cfa485771 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt
@@ -25,6 +25,12 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
*/
private val flingDetector = GestureDetector(context, FlingListener())
+ var disableZoom = true
+ set(value) {
+ field = value
+ recycler?.canZoom = !value
+ }
+
/**
* Recycler view added in this frame.
*/
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt
index 6b70bea56e..dc65cead64 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt
@@ -32,6 +32,13 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
private var firstVisibleItemPosition = 0
private var lastVisibleItemPosition = 0
private var currentScale = DEFAULT_RATE
+ var canZoom = false
+ set(value) {
+ field = value
+ if (!value) {
+ zoom(currentScale, DEFAULT_RATE, x, 0f, y, 0f, true)
+ }
+ }
private val listener = GestureListener()
private val detector = Detector()
@@ -93,8 +100,10 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
fromX: Float,
toX: Float,
fromY: Float,
- toY: Float
+ toY: Float,
+ force: Boolean = false
) {
+ if (!canZoom && !force) return
isZooming = true
val animatorSet = AnimatorSet()
val translationXAnimator = ValueAnimator.ofFloat(fromX, toX)
@@ -129,6 +138,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
}
fun zoomFling(velocityX: Int, velocityY: Int): Boolean {
+ if (!canZoom) return false
if (currentScale <= 1f) return false
val distanceTimeFactor = 0.4f
@@ -157,6 +167,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
}
private fun zoomScrollBy(dx: Int, dy: Int) {
+ if (!canZoom) return
if (dx != 0) {
x = getPositionX(x + dx)
}
@@ -171,6 +182,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
}
fun onScale(scaleFactor: Float) {
+ if (!canZoom) return
currentScale *= scaleFactor
currentScale = currentScale.coerceIn(
MIN_RATE,
@@ -193,13 +205,13 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
}
fun onScaleBegin() {
- if (detector.isDoubleTapping) {
+ if (detector.isDoubleTapping && canZoom) {
detector.isQuickScaling = true
}
}
fun onScaleEnd() {
- if (scaleX < MIN_RATE) {
+ if (scaleX < MIN_RATE && canZoom) {
zoom(currentScale, MIN_RATE, x, 0f, y, 0f)
}
}
@@ -217,7 +229,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
}
fun onDoubleTapConfirmed(ev: MotionEvent) {
- if (!isZooming) {
+ if (!isZooming && canZoom) {
if (scaleX != DEFAULT_RATE) {
zoom(currentScale, DEFAULT_RATE, x, 0f, y, 0f)
} else {
@@ -250,7 +262,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
override fun onTouchEvent(ev: MotionEvent): Boolean {
val action = ev.actionMasked
val actionIndex = ev.actionIndex
-
+ if (!canZoom) return super.onTouchEvent(ev)
when (action) {
MotionEvent.ACTION_DOWN -> {
scrollPointerId = ev.getPointerId(0)
@@ -297,12 +309,12 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
startScroll = true
}
- if (startScroll) {
+ if (startScroll && canZoom) {
isZoomDragging = true
}
}
- if (isZoomDragging) {
+ if (isZoomDragging && canZoom) {
zoomScrollBy(dx, dy)
}
}
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 54a95ae607..0ac5826b85 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
@@ -123,6 +123,10 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
refreshAdapter()
}
+ config.zoomPropertyChangedListener = {
+ frame.disableZoom = it
+ }
+
frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
frame.addView(recycler)
}
diff --git a/app/src/main/res/layout/reader_settings_sheet.xml b/app/src/main/res/layout/reader_settings_sheet.xml
index 4adbdff6b5..2dc1dedbb0 100644
--- a/app/src/main/res/layout/reader_settings_sheet.xml
+++ b/app/src/main/res/layout/reader_settings_sheet.xml
@@ -218,7 +218,6 @@
android:layout_marginTop="0dp"
android:text="@string/page_transitions"
android:textColor="?android:attr/textColorSecondary"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/crop_borders" />
@@ -259,12 +258,20 @@
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:entries="@array/webtoon_side_padding"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/spinner_end"
app:layout_constraintRight_toRightOf="@id/spinner_end"
app:layout_constraintStart_toEndOf="@id/bottom_line"
app:layout_constraintTop_toBottomOf="@id/crop_borders_webtoon" />
+
+
+ webtoon_side_padding_text,webtoon_side_padding,webtoon_disable_zoom" />
Fullscreen
Page transitions
+ Disable zoom
Double tap animation speed
Show page number
32-bit color