mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 04:51:50 +01:00
Scroll up/down when tapping top/bottom thirds in vertical reading modes (closes #3363)
This commit is contained in:
parent
d44503cb19
commit
789421c7a0
@ -80,6 +80,14 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
pager.tapListener = { event ->
|
pager.tapListener = { event ->
|
||||||
|
if (this is VerticalPagerViewer) {
|
||||||
|
val positionY = event.y
|
||||||
|
when {
|
||||||
|
positionY < pager.height * 0.33f && config.tappingEnabled -> moveLeft()
|
||||||
|
positionY > pager.height * 0.66f && config.tappingEnabled -> moveRight()
|
||||||
|
else -> activity.toggleMenu()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
val positionX = event.x
|
val positionX = event.x
|
||||||
when {
|
when {
|
||||||
positionX < pager.width * 0.33f && config.tappingEnabled -> moveLeft()
|
positionX < pager.width * 0.33f && config.tappingEnabled -> moveLeft()
|
||||||
@ -87,6 +95,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
else -> activity.toggleMenu()
|
else -> activity.toggleMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pager.longTapListener = f@{
|
pager.longTapListener = f@{
|
||||||
if (activity.menuVisible || config.longTapEnabled) {
|
if (activity.menuVisible || config.longTapEnabled) {
|
||||||
val item = adapter.items.getOrNull(pager.currentItem)
|
val item = adapter.items.getOrNull(pager.currentItem)
|
||||||
|
@ -24,6 +24,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
|
|||||||
private set
|
private set
|
||||||
|
|
||||||
var currentChapter: ReaderChapter? = null
|
var currentChapter: ReaderChapter? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates this adapter with the given [chapters]. It handles setting a few pages of the
|
* Updates this adapter with the given [chapters]. It handles setting a few pages of the
|
||||||
* next/previous chapter to allow seamless transitions and inverting the pages if the viewer
|
* next/previous chapter to allow seamless transitions and inverting the pages if the viewer
|
||||||
|
@ -93,13 +93,10 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
recycler.tapListener = { event ->
|
recycler.tapListener = { event ->
|
||||||
val positionX = event.rawX
|
|
||||||
val positionY = event.rawY
|
val positionY = event.rawY
|
||||||
when {
|
when {
|
||||||
positionY < recycler.height * 0.25 && config.tappingEnabled -> scrollUp()
|
positionY < recycler.height * 0.33f && config.tappingEnabled -> scrollUp()
|
||||||
positionY > recycler.height * 0.75 && config.tappingEnabled -> scrollDown()
|
positionY > recycler.height * 0.66f && config.tappingEnabled -> scrollDown()
|
||||||
positionX < recycler.width * 0.33 && config.tappingEnabled -> scrollUp()
|
|
||||||
positionX > recycler.width * 0.66 && config.tappingEnabled -> scrollDown()
|
|
||||||
else -> activity.toggleMenu()
|
else -> activity.toggleMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user