mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 20:01:53 +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 {
|
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
|
||||||
if (keyCode == KeyEvent.KEYCODE_N) {
|
when (keyCode) {
|
||||||
presenter.loadNextChapter()
|
KeyEvent.KEYCODE_N -> {
|
||||||
return true
|
if (viewer is R2LPagerViewer) {
|
||||||
} else if (keyCode == KeyEvent.KEYCODE_P) {
|
binding.readerNav.leftChapter.performClick()
|
||||||
presenter.loadPreviousChapter()
|
} else {
|
||||||
return true
|
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)
|
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
|
* Called from the containing activity when a key [event] is received. It should return true
|
||||||
* if the event was handled, false otherwise.
|
* if the event was handled, false otherwise.
|
||||||
|
@ -288,17 +288,11 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun moveToNext() {
|
||||||
* Moves to the next page.
|
|
||||||
*/
|
|
||||||
open fun moveToNext() {
|
|
||||||
moveRight()
|
moveRight()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun moveToPrevious() {
|
||||||
* Moves to the previous page.
|
|
||||||
*/
|
|
||||||
open fun moveToPrevious() {
|
|
||||||
moveLeft()
|
moveLeft()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = fals
|
|||||||
val navigator = config.navigator
|
val navigator = config.navigator
|
||||||
when (navigator.getAction(pos)) {
|
when (navigator.getAction(pos)) {
|
||||||
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
|
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
ViewerNavigation.NavigationRegion.NEXT, ViewerNavigation.NavigationRegion.RIGHT -> scrollDown()
|
ViewerNavigation.NavigationRegion.NEXT, ViewerNavigation.NavigationRegion.RIGHT -> moveToNext()
|
||||||
ViewerNavigation.NavigationRegion.PREV, ViewerNavigation.NavigationRegion.LEFT -> scrollUp()
|
ViewerNavigation.NavigationRegion.PREV, ViewerNavigation.NavigationRegion.LEFT -> moveToPrevious()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,14 +252,14 @@ class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = fals
|
|||||||
/**
|
/**
|
||||||
* Scrolls up by [scrollDistance].
|
* Scrolls up by [scrollDistance].
|
||||||
*/
|
*/
|
||||||
private fun scrollUp() {
|
override fun moveToNext() {
|
||||||
recycler.smoothScrollBy(0, -scrollDistance)
|
recycler.smoothScrollBy(0, -scrollDistance)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scrolls down by [scrollDistance].
|
* Scrolls down by [scrollDistance].
|
||||||
*/
|
*/
|
||||||
private fun scrollDown() {
|
override fun moveToPrevious() {
|
||||||
recycler.smoothScrollBy(0, scrollDistance)
|
recycler.smoothScrollBy(0, scrollDistance)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,25 +275,25 @@ class WebtoonViewer(val activity: ReaderActivity, val hasMargins: Boolean = fals
|
|||||||
if (!config.volumeKeysEnabled || activity.menuVisible) {
|
if (!config.volumeKeysEnabled || activity.menuVisible) {
|
||||||
return false
|
return false
|
||||||
} else if (isUp) {
|
} else if (isUp) {
|
||||||
if (!config.volumeKeysInverted) scrollDown() else scrollUp()
|
if (!config.volumeKeysInverted) moveToNext() else moveToPrevious()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyEvent.KEYCODE_VOLUME_UP -> {
|
KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||||
if (!config.volumeKeysEnabled || activity.menuVisible) {
|
if (!config.volumeKeysEnabled || activity.menuVisible) {
|
||||||
return false
|
return false
|
||||||
} else if (isUp) {
|
} else if (isUp) {
|
||||||
if (!config.volumeKeysInverted) scrollUp() else scrollDown()
|
if (!config.volumeKeysInverted) moveToPrevious() else moveToNext()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyEvent.KEYCODE_MENU -> if (isUp) activity.toggleMenu()
|
KeyEvent.KEYCODE_MENU -> if (isUp) activity.toggleMenu()
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_RIGHT,
|
KeyEvent.KEYCODE_DPAD_RIGHT,
|
||||||
KeyEvent.KEYCODE_DPAD_UP,
|
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_LEFT,
|
||||||
KeyEvent.KEYCODE_DPAD_DOWN,
|
KeyEvent.KEYCODE_DPAD_DOWN,
|
||||||
KeyEvent.KEYCODE_PAGE_DOWN -> if (isUp) scrollDown()
|
KeyEvent.KEYCODE_PAGE_DOWN -> if (isUp) moveToNext()
|
||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
priority="1"
|
priority="1"
|
||||||
repeatable="true"
|
repeatable="true"
|
||||||
repeatable_interval="short"
|
repeatable_interval="short"
|
||||||
trigger_key="CTRL_LEFT+DPAD_RIGHT">
|
trigger_key="E">
|
||||||
<preference
|
<preference
|
||||||
name="gesture"
|
name="gesture"
|
||||||
value="click" />
|
value="click" />
|
||||||
@ -19,7 +19,7 @@
|
|||||||
priority="2"
|
priority="2"
|
||||||
repeatable="true"
|
repeatable="true"
|
||||||
repeatable_interval="short"
|
repeatable_interval="short"
|
||||||
trigger_key="CTRL_LEFT+DPAD_LEFT">
|
trigger_key="Q">
|
||||||
<preference
|
<preference
|
||||||
name="gesture"
|
name="gesture"
|
||||||
value="double_click" />
|
value="double_click" />
|
||||||
@ -41,7 +41,7 @@
|
|||||||
priority="4"
|
priority="4"
|
||||||
repeatable="true"
|
repeatable="true"
|
||||||
repeatable_interval="short"
|
repeatable_interval="short"
|
||||||
trigger_key="N">
|
trigger_key="R">
|
||||||
<preference
|
<preference
|
||||||
name="gesture"
|
name="gesture"
|
||||||
value="swipe_right" />
|
value="swipe_right" />
|
||||||
@ -52,7 +52,7 @@
|
|||||||
priority="5"
|
priority="5"
|
||||||
repeatable="true"
|
repeatable="true"
|
||||||
repeatable_interval="short"
|
repeatable_interval="short"
|
||||||
trigger_key="P">
|
trigger_key="L">
|
||||||
<preference
|
<preference
|
||||||
name="gesture"
|
name="gesture"
|
||||||
value="swipe_left" />
|
value="swipe_left" />
|
||||||
|
Loading…
Reference in New Issue
Block a user