Skip to content

Commit

Permalink
fix: physical volume key direction for vertical mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Jan 25, 2024
1 parent 4e21b05 commit 523eca1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,11 @@ open class BrowserActivity : FragmentActivity(), BrowserController {

private fun handleVolumeDownKey(): Boolean {
return if (config.volumePageTurn) {
ninjaWebView.pageDownWithNoAnimation()
if (ninjaWebView.isVerticalRead) {
ninjaWebView.pageUpWithNoAnimation()
} else {
ninjaWebView.pageDownWithNoAnimation()
}
true
} else {
false
Expand All @@ -860,7 +864,11 @@ open class BrowserActivity : FragmentActivity(), BrowserController {

private fun handleVolumeUpKey(): Boolean {
return if (config.volumePageTurn) {
ninjaWebView.pageUpWithNoAnimation()
if (ninjaWebView.isVerticalRead) {
ninjaWebView.pageDownWithNoAnimation()
} else {
ninjaWebView.pageUpWithNoAnimation()
}
true
} else {
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ open class NinjaWebView(
super.dispatchKeyEvent(event)
}

protected var isVerticalRead = false
var isVerticalRead = false
fun toggleVerticalRead() {
isVerticalRead = !isVerticalRead
if (isVerticalRead) {
Expand Down

0 comments on commit 523eca1

Please sign in to comment.