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:
parent
6fb7a85e8a
commit
9db81a5a49
@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.util.lang.invert
|
|||||||
abstract class ViewerNavigation {
|
abstract class ViewerNavigation {
|
||||||
|
|
||||||
enum class NavigationRegion {
|
enum class NavigationRegion {
|
||||||
NEXT, PREV, MENU
|
NEXT, PREV, MENU, RIGHT, LEFT
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Region(
|
data class Region(
|
||||||
|
@ -6,11 +6,11 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
|
|||||||
/**
|
/**
|
||||||
* Visualization of default state without any inversion
|
* 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() {
|
open class LNavigation : ViewerNavigation() {
|
||||||
@ -18,19 +18,19 @@ open class LNavigation : ViewerNavigation() {
|
|||||||
override var regions: List<Region> = listOf(
|
override var regions: List<Region> = listOf(
|
||||||
Region(
|
Region(
|
||||||
rectF = RectF(0f, 0.33f, 0.33f, 0.66f),
|
rectF = RectF(0f, 0.33f, 0.33f, 0.66f),
|
||||||
type = NavigationRegion.NEXT
|
type = NavigationRegion.PREV
|
||||||
),
|
),
|
||||||
Region(
|
Region(
|
||||||
rectF = RectF(0f, 0f, 1f, 0.33f),
|
rectF = RectF(0f, 0f, 1f, 0.33f),
|
||||||
type = NavigationRegion.NEXT
|
type = NavigationRegion.PREV
|
||||||
),
|
),
|
||||||
Region(
|
Region(
|
||||||
rectF = RectF(0.66f, 0.33f, 1f, 0.66f),
|
rectF = RectF(0.66f, 0.33f, 1f, 0.66f),
|
||||||
type = NavigationRegion.PREV
|
type = NavigationRegion.NEXT
|
||||||
),
|
),
|
||||||
Region(
|
Region(
|
||||||
rectF = RectF(0f, 0.66f, 1f, 1f),
|
rectF = RectF(0f, 0.66f, 1f, 1f),
|
||||||
type = NavigationRegion.PREV
|
type = NavigationRegion.NEXT
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@ import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
|
|||||||
/**
|
/**
|
||||||
* Visualization of default state without any inversion
|
* 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 | M: Menu
|
||||||
* +---+---+---+
|
* +---+---+---+
|
||||||
* | N | M | P | N: Next
|
* | N | M | P | N: Move Left
|
||||||
* +---+---+---+
|
* +---+---+---+
|
||||||
*/
|
*/
|
||||||
class PagerDefaultNavigation : ViewerNavigation() {
|
class PagerDefaultNavigation : ViewerNavigation() {
|
||||||
@ -19,11 +19,11 @@ class PagerDefaultNavigation : ViewerNavigation() {
|
|||||||
override var regions: List<Region> = listOf(
|
override var regions: List<Region> = listOf(
|
||||||
Region(
|
Region(
|
||||||
rectF = RectF(0f, 0f, 0.33f, 1f),
|
rectF = RectF(0f, 0f, 0.33f, 1f),
|
||||||
type = NavigationRegion.NEXT
|
type = NavigationRegion.LEFT
|
||||||
),
|
),
|
||||||
Region(
|
Region(
|
||||||
rectF = RectF(0.66f, 0f, 1f, 1f),
|
rectF = RectF(0.66f, 0f, 1f, 1f),
|
||||||
type = NavigationRegion.PREV
|
type = NavigationRegion.RIGHT
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -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.ReaderPage
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
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.MainScope
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import timber.log.Timber
|
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 pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
|
||||||
val navigator = config.navigator
|
val navigator = config.navigator
|
||||||
when (navigator.getAction(pos)) {
|
when (navigator.getAction(pos)) {
|
||||||
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
|
NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
ViewerNavigation.NavigationRegion.NEXT -> moveToNext()
|
NavigationRegion.NEXT -> moveToNext()
|
||||||
ViewerNavigation.NavigationRegion.PREV -> moveToPrevious()
|
NavigationRegion.PREV -> moveToPrevious()
|
||||||
|
NavigationRegion.RIGHT -> moveRight()
|
||||||
|
NavigationRegion.LEFT -> moveLeft()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pager.longTapListener = f@{
|
pager.longTapListener = f@{
|
||||||
|
@ -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.ReaderPage
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
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.MainScope
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import rx.subscriptions.CompositeSubscription
|
import rx.subscriptions.CompositeSubscription
|
||||||
@ -111,9 +111,9 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
else {
|
else {
|
||||||
val navigator = config.navigator
|
val navigator = config.navigator
|
||||||
when (navigator.getAction(pos)) {
|
when (navigator.getAction(pos)) {
|
||||||
ViewerNavigation.NavigationRegion.MENU -> activity.toggleMenu()
|
NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
ViewerNavigation.NavigationRegion.NEXT -> scrollDown()
|
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
||||||
ViewerNavigation.NavigationRegion.PREV -> scrollUp()
|
NavigationRegion.PREV, NavigationRegion.LEFT -> scrollUp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user