Add Right and Left navigation (#4392)

and remove default navigation classes in favor of the navigation classes
This commit is contained in:
Andreas 2021-02-07 05:26:56 +01:00 committed by GitHub
parent 348c1ff29d
commit b63d24ac1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 13 deletions

View file

@ -1,8 +1,7 @@
package eu.kanade.tachiyomi.ui.reader.viewer.pager
package eu.kanade.tachiyomi.ui.reader.viewer.navigation
import android.graphics.RectF
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
/**
* Visualization of default state without any inversion
@ -14,7 +13,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
* | N | M | P | N: Move Left
* +---+---+---+
*/
class PagerDefaultNavigation : ViewerNavigation() {
class RightAndLeftNavigation : ViewerNavigation() {
override var regions: List<Region> = listOf(
Region(
@ -27,5 +26,3 @@ class PagerDefaultNavigation : ViewerNavigation() {
),
)
}
class VerticalPagerDefaultNavigation : LNavigation()

View file

@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.EdgeNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.KindlishNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.RightAndLeftNavigation
import kotlinx.coroutines.CoroutineScope
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -69,8 +70,8 @@ class PagerConfig(
override fun defaultNavigation(): ViewerNavigation {
return when (viewer) {
is VerticalPagerViewer -> VerticalPagerDefaultNavigation()
else -> PagerDefaultNavigation()
is VerticalPagerViewer -> LNavigation()
else -> RightAndLeftNavigation()
}
}
@ -80,6 +81,7 @@ class PagerConfig(
1 -> LNavigation()
2 -> KindlishNavigation()
3 -> EdgeNavigation()
4 -> RightAndLeftNavigation()
else -> defaultNavigation()
}
}

View file

@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.EdgeNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.KindlishNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.RightAndLeftNavigation
import kotlinx.coroutines.CoroutineScope
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -44,7 +45,7 @@ class WebtoonConfig(
}
override fun defaultNavigation(): ViewerNavigation {
return WebtoonDefaultNavigation()
return LNavigation()
}
override fun updateNavigation(navigationMode: Int) {
@ -53,6 +54,7 @@ class WebtoonConfig(
1 -> LNavigation()
2 -> KindlishNavigation()
3 -> EdgeNavigation()
4 -> RightAndLeftNavigation()
else -> defaultNavigation()
}
}

View file

@ -1,5 +0,0 @@
package eu.kanade.tachiyomi.ui.reader.viewer.webtoon
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation
class WebtoonDefaultNavigation : LNavigation()

View file

@ -97,6 +97,7 @@
<item>@string/l_nav</item>
<item>@string/kindlish_nav</item>
<item>@string/edge_nav</item>
<item>@string/right_and_left_nav</item>
</string-array>
<string-array name="webtoon_nav">
@ -104,5 +105,6 @@
<item>@string/l_nav</item>
<item>@string/kindlish_nav</item>
<item>@string/edge_nav</item>
<item>@string/right_and_left_nav</item>
</string-array>
</resources>

View file

@ -293,6 +293,7 @@
<string name="l_nav">L shaped</string>
<string name="kindlish_nav">Kindle-ish</string>
<string name="edge_nav">Edge</string>
<string name="right_and_left_nav">Right and Left</string>
<string name="left_to_right_viewer">Left to right</string>
<string name="right_to_left_viewer">Right to left</string>
<string name="vertical_viewer">Vertical</string>