Fix navigation from feedback (#4238)

* Fix navigation from feedback (fixes #4237)

* Add additional enum values to NavigationRegion mainly for PagerViewer

Co-authored-by: arkon <arkon@users.noreply.github.com>
This commit is contained in:
Andreas E 2021-01-08 01:05:38 +01:00 committed by GitHub
parent 6fb7a85e8a
commit 9db81a5a49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 20 deletions

View File

@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.util.lang.invert
abstract class ViewerNavigation {
enum class NavigationRegion {
NEXT, PREV, MENU
NEXT, PREV, MENU, RIGHT, LEFT
}
data class Region(

View File

@ -6,11 +6,11 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
/**
* Visualization of default state without any inversion
* +---+---+---+
* | N | N | N | P: Previous
* | P | P | P | P: Previous
* +---+---+---+
* | N | M | P | M: Menu
* | P | M | N | M: Menu
* +---+---+---+
* | P | P | P | N: Next
* | N | N | N | N: Next
* +---+---+---+
*/
open class LNavigation : ViewerNavigation() {
@ -18,19 +18,19 @@ open class LNavigation : ViewerNavigation() {
override var regions: List<Region> = listOf(
Region(
rectF = RectF(0f, 0.33f, 0.33f, 0.66f),
type = NavigationRegion.NEXT
type = NavigationRegion.PREV
),
Region(
rectF = RectF(0f, 0f, 1f, 0.33f),
type = NavigationRegion.NEXT
type = NavigationRegion.PREV
),
Region(
rectF = RectF(0.66f, 0.33f, 1f, 0.66f),
type = NavigationRegion.PREV
type = NavigationRegion.NEXT
),
Region(
rectF = RectF(0f, 0.66f, 1f, 1f),
type = NavigationRegion.PREV
type = NavigationRegion.NEXT
)
)
}

View File

@ -7,11 +7,11 @@ import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
/**
* Visualization of default state without any inversion
* +---+---+---+
* | N | M | P | P: Previous
* | N | M | P | P: Move Right
* +---+---+---+
* | N | M | P | M: Menu
* +---+---+---+
* | N | M | P | N: Next
* | N | M | P | N: Move Left
* +---+---+---+
*/
class PagerDefaultNavigation : ViewerNavigation() {
@ -19,11 +19,11 @@ class PagerDefaultNavigation : ViewerNavigation() {
override var regions: List<Region> = listOf(
Region(
rectF = RectF(0f, 0f, 0.33f, 1f),
type = NavigationRegion.NEXT
type = NavigationRegion.LEFT
),
Region(
rectF = RectF(0.66f, 0f, 1f, 1f),
type = NavigationRegion.PREV
type = NavigationRegion.RIGHT
),
)
}

View File

@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation.NavigationRegion
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import timber.log.Timber
@ -97,9 +97,11 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
val navigator = config.navigator
when (navigator.getAction(pos)) {
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
ViewerNavigation.NavigationRegion.NEXT -> moveToNext()
ViewerNavigation.NavigationRegion.PREV -> moveToPrevious()
NavigationRegion.MENU -> activity.toggleMenu()
NavigationRegion.NEXT -> moveToNext()
NavigationRegion.PREV -> moveToPrevious()
NavigationRegion.RIGHT -> moveRight()
NavigationRegion.LEFT -> moveLeft()
}
}
pager.longTapListener = f@{

View File

@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation.NavigationRegion
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import rx.subscriptions.CompositeSubscription
@ -111,9 +111,9 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
else {
val navigator = config.navigator
when (navigator.getAction(pos)) {
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
ViewerNavigation.NavigationRegion.NEXT -> scrollDown()
ViewerNavigation.NavigationRegion.PREV -> scrollUp()
NavigationRegion.MENU -> activity.toggleMenu()
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
NavigationRegion.PREV, NavigationRegion.LEFT -> scrollUp()
}
}
}