mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 12:49:19 +01:00
Invert tapping for Webtoon and Vertical
This commit is contained in:
parent
7f88b56d8b
commit
0ea0eba4f0
@ -32,7 +32,7 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
|||||||
.register({ tappingEnabled = it })
|
.register({ tappingEnabled = it })
|
||||||
|
|
||||||
preferences.readWithTappingInverted()
|
preferences.readWithTappingInverted()
|
||||||
.register({ tappingInverted = it })
|
.register({ tappingInverted = it })
|
||||||
|
|
||||||
preferences.readWithLongTap()
|
preferences.readWithLongTap()
|
||||||
.register({ longTapEnabled = it })
|
.register({ longTapEnabled = it })
|
||||||
|
@ -81,17 +81,22 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
})
|
})
|
||||||
pager.tapListener = { event ->
|
pager.tapListener = { event ->
|
||||||
val tappingInverted = config.tappingInverted
|
val tappingInverted = config.tappingInverted
|
||||||
|
|
||||||
if (this is VerticalPagerViewer) {
|
if (this is VerticalPagerViewer) {
|
||||||
val positionY = event.y
|
val positionY = event.y
|
||||||
|
val topSideTap = positionY < pager.height * 0.33f && config.tappingEnabled
|
||||||
|
val bottomSideTap = positionY > pager.height * 0.66f && config.tappingEnabled
|
||||||
|
|
||||||
when {
|
when {
|
||||||
positionY < pager.height * 0.33f && config.tappingEnabled -> moveLeft()
|
topSideTap && !tappingInverted || bottomSideTap && tappingInverted -> moveLeft()
|
||||||
positionY > pager.height * 0.66f && config.tappingEnabled -> moveRight()
|
bottomSideTap && !tappingInverted || topSideTap && tappingInverted -> moveRight()
|
||||||
else -> activity.toggleMenu()
|
else -> activity.toggleMenu()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val positionX = event.x
|
val positionX = event.x
|
||||||
val leftSideTap = positionX < pager.width * 0.33f && config.tappingEnabled
|
val leftSideTap = positionX < pager.width * 0.33f && config.tappingEnabled
|
||||||
val rightSideTap = positionX > pager.width * 0.66f && config.tappingEnabled
|
val rightSideTap = positionX > pager.width * 0.66f && config.tappingEnabled
|
||||||
|
|
||||||
when {
|
when {
|
||||||
leftSideTap && !tappingInverted || rightSideTap && tappingInverted -> moveLeft()
|
leftSideTap && !tappingInverted || rightSideTap && tappingInverted -> moveLeft()
|
||||||
rightSideTap && !tappingInverted || leftSideTap && tappingInverted -> moveRight()
|
rightSideTap && !tappingInverted || leftSideTap && tappingInverted -> moveRight()
|
||||||
|
@ -94,9 +94,13 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
})
|
})
|
||||||
recycler.tapListener = { event ->
|
recycler.tapListener = { event ->
|
||||||
val positionY = event.rawY
|
val positionY = event.rawY
|
||||||
|
val tappingInverted = config.tappingInverted
|
||||||
|
val topSideTap = positionY < recycler.height * 0.33f && config.tappingEnabled
|
||||||
|
val bottomSideTap = positionY > recycler.height * 0.66f && config.tappingEnabled
|
||||||
|
|
||||||
when {
|
when {
|
||||||
positionY < recycler.height * 0.33f && config.tappingEnabled -> scrollUp()
|
topSideTap && !tappingInverted || bottomSideTap && tappingInverted -> scrollUp()
|
||||||
positionY > recycler.height * 0.66f && config.tappingEnabled -> scrollDown()
|
bottomSideTap && !tappingInverted || topSideTap && tappingInverted -> scrollDown()
|
||||||
else -> activity.toggleMenu()
|
else -> activity.toggleMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user