diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt index 9a0258ba4..f96242b69 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderNavigationOverlayView.kt @@ -61,7 +61,7 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) override fun onDraw(canvas: Canvas) { if (navigation == null) return - navigation?.regions?.forEach { region -> + navigation?.getRegions()?.forEach { region -> val rect = region.rectF // Scale rect from 1f,1f to screen width and height diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt index 67e923d3f..be27506c4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ViewerNavigation.kt @@ -32,15 +32,19 @@ abstract class ViewerNavigation { private var constantMenuRegion: RectF = RectF(0f, 0f, 1f, 0.05f) - abstract var regions: List - var invertMode: ReaderPreferences.TappingInvertMode = ReaderPreferences.TappingInvertMode.NONE + protected abstract var regionList: List + + /** Returns regions with applied inversion. */ + fun getRegions(): List { + return regionList.map { it.invert(invertMode) } + } + fun getAction(pos: PointF): NavigationRegion { val x = pos.x val y = pos.y - val region = regions.map { it.invert(invertMode) } - .find { it.rectF.contains(x, y) } + val region = getRegions().find { it.rectF.contains(x, y) } return when { region != null -> region.type constantMenuRegion.contains(x, y) -> NavigationRegion.MENU diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt index 11a715faf..e6fac74d0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/DisabledNavigation.kt @@ -14,5 +14,5 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation */ class DisabledNavigation : ViewerNavigation() { - override var regions: List = emptyList() + override var regionList: List = emptyList() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/EdgeNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/EdgeNavigation.kt index 7440b1e35..ebd69ee3b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/EdgeNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/EdgeNavigation.kt @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation */ class EdgeNavigation : ViewerNavigation() { - override var regions: List = listOf( + override var regionList: List = listOf( Region( rectF = RectF(0f, 0f, 0.33f, 1f), type = NavigationRegion.NEXT, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/KindlishNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/KindlishNavigation.kt index 21bf053eb..9b6fa362a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/KindlishNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/KindlishNavigation.kt @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation */ class KindlishNavigation : ViewerNavigation() { - override var regions: List = listOf( + override var regionList: List = listOf( Region( rectF = RectF(0.33f, 0.33f, 1f, 1f), type = NavigationRegion.NEXT, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt index 8f94a6100..c2a751fb3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/LNavigation.kt @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation */ open class LNavigation : ViewerNavigation() { - override var regions: List = listOf( + override var regionList: List = listOf( Region( rectF = RectF(0f, 0.33f, 0.33f, 0.66f), type = NavigationRegion.PREV, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/RightAndLeftNavigation.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/RightAndLeftNavigation.kt index b660000f2..4c9bc6a77 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/RightAndLeftNavigation.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/navigation/RightAndLeftNavigation.kt @@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation */ class RightAndLeftNavigation : ViewerNavigation() { - override var regions: List = listOf( + override var regionList: List = listOf( Region( rectF = RectF(0f, 0f, 0.33f, 1f), type = NavigationRegion.LEFT,