mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 16:01:48 +01:00
Fixed #693
Which because i'm a dum dum implentmented it different from upstream ...but this should also make swiping to the next chapter match the reader mode
This commit is contained in:
parent
b447b61a3e
commit
4ece78fc20
@ -402,14 +402,41 @@ class ReaderActivity :
|
||||
}
|
||||
|
||||
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_N) {
|
||||
presenter.loadNextChapter()
|
||||
return true
|
||||
} else if (keyCode == KeyEvent.KEYCODE_P) {
|
||||
presenter.loadPreviousChapter()
|
||||
return true
|
||||
when (keyCode) {
|
||||
KeyEvent.KEYCODE_N -> {
|
||||
if (viewer is R2LPagerViewer) {
|
||||
binding.readerNav.leftChapter.performClick()
|
||||
} else {
|
||||
binding.readerNav.rightChapter.performClick()
|
||||
}
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_P -> {
|
||||
if (viewer !is R2LPagerViewer) {
|
||||
binding.readerNav.leftChapter.performClick()
|
||||
} else {
|
||||
binding.readerNav.rightChapter.performClick()
|
||||
}
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_L -> {
|
||||
binding.readerNav.leftChapter.performClick()
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_R -> {
|
||||
binding.readerNav.rightChapter.performClick()
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_E -> {
|
||||
viewer?.moveToNext()
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_Q -> {
|
||||
viewer?.moveToPrevious()
|
||||
return true
|
||||
}
|
||||
else -> return super.onKeyUp(keyCode, event)
|
||||
}
|
||||
return super.onKeyUp(keyCode, event)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,16 @@ interface BaseViewer {
|
||||
*/
|
||||
fun moveToPage(page: ReaderPage)
|
||||
|
||||
/**
|
||||
* Moves to the next page.
|
||||
*/
|
||||
fun moveToNext()
|
||||
|
||||
/**
|
||||
* Moves to the previous page.
|
||||
*/
|
||||
fun moveToPrevious()
|
||||
|
||||
/**
|
||||
* Called from the containing activity when a key [event] is received. It should return true
|
||||
* if the event was handled, false otherwise.
|
||||
|
@ -288,17 +288,11 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves to the next page.
|
||||
*/
|
||||
open fun moveToNext() {
|
||||
override fun moveToNext() {
|
||||
moveRight()
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves to the previous page.
|
||||
*/
|
||||
open fun moveToPrevious() {
|
||||
override fun moveToPrevious() {
|
||||
moveLeft()
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,8 @@ class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = fals
|
||||
val navigator = config.navigator
|
||||
when (navigator.getAction(pos)) {
|
||||
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
|
||||
ViewerNavigation.NavigationRegion.NEXT, ViewerNavigation.NavigationRegion.RIGHT -> scrollDown()
|
||||
ViewerNavigation.NavigationRegion.PREV, ViewerNavigation.NavigationRegion.LEFT -> scrollUp()
|
||||
ViewerNavigation.NavigationRegion.NEXT, ViewerNavigation.NavigationRegion.RIGHT -> moveToNext()
|
||||
ViewerNavigation.NavigationRegion.PREV, ViewerNavigation.NavigationRegion.LEFT -> moveToPrevious()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -252,14 +252,14 @@ class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = fals
|
||||
/**
|
||||
* Scrolls up by [scrollDistance].
|
||||
*/
|
||||
private fun scrollUp() {
|
||||
override fun moveToNext() {
|
||||
recycler.smoothScrollBy(0, -scrollDistance)
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls down by [scrollDistance].
|
||||
*/
|
||||
private fun scrollDown() {
|
||||
override fun moveToPrevious() {
|
||||
recycler.smoothScrollBy(0, scrollDistance)
|
||||
}
|
||||
|
||||
@ -275,25 +275,25 @@ class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = fals
|
||||
if (!config.volumeKeysEnabled || activity.menuVisible) {
|
||||
return false
|
||||
} else if (isUp) {
|
||||
if (!config.volumeKeysInverted) scrollDown() else scrollUp()
|
||||
if (!config.volumeKeysInverted) moveToNext() else moveToPrevious()
|
||||
}
|
||||
}
|
||||
KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||
if (!config.volumeKeysEnabled || activity.menuVisible) {
|
||||
return false
|
||||
} else if (isUp) {
|
||||
if (!config.volumeKeysInverted) scrollUp() else scrollDown()
|
||||
if (!config.volumeKeysInverted) moveToPrevious() else moveToNext()
|
||||
}
|
||||
}
|
||||
KeyEvent.KEYCODE_MENU -> if (isUp) activity.toggleMenu()
|
||||
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT,
|
||||
KeyEvent.KEYCODE_DPAD_UP,
|
||||
KeyEvent.KEYCODE_PAGE_UP -> if (isUp) scrollUp()
|
||||
KeyEvent.KEYCODE_PAGE_UP -> if (isUp) moveToPrevious()
|
||||
|
||||
KeyEvent.KEYCODE_DPAD_LEFT,
|
||||
KeyEvent.KEYCODE_DPAD_DOWN,
|
||||
KeyEvent.KEYCODE_PAGE_DOWN -> if (isUp) scrollDown()
|
||||
KeyEvent.KEYCODE_PAGE_DOWN -> if (isUp) moveToNext()
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
|
@ -8,7 +8,7 @@
|
||||
priority="1"
|
||||
repeatable="true"
|
||||
repeatable_interval="short"
|
||||
trigger_key="CTRL_LEFT+DPAD_RIGHT">
|
||||
trigger_key="E">
|
||||
<preference
|
||||
name="gesture"
|
||||
value="click" />
|
||||
@ -19,7 +19,7 @@
|
||||
priority="2"
|
||||
repeatable="true"
|
||||
repeatable_interval="short"
|
||||
trigger_key="CTRL_LEFT+DPAD_LEFT">
|
||||
trigger_key="Q">
|
||||
<preference
|
||||
name="gesture"
|
||||
value="double_click" />
|
||||
@ -41,7 +41,7 @@
|
||||
priority="4"
|
||||
repeatable="true"
|
||||
repeatable_interval="short"
|
||||
trigger_key="N">
|
||||
trigger_key="R">
|
||||
<preference
|
||||
name="gesture"
|
||||
value="swipe_right" />
|
||||
@ -52,7 +52,7 @@
|
||||
priority="5"
|
||||
repeatable="true"
|
||||
repeatable_interval="short"
|
||||
trigger_key="P">
|
||||
trigger_key="L">
|
||||
<preference
|
||||
name="gesture"
|
||||
value="swipe_left" />
|
||||
|
Loading…
Reference in New Issue
Block a user