Add tap to move by page for continues vertical reader
This commit is contained in:
parent
7f7b2901cb
commit
bcd36c8fad
@ -280,4 +280,6 @@ object PreferenceKeys {
|
||||
const val startReadingButton = "start_reading_button"
|
||||
|
||||
const val groupLibraryBy = "group_library_by"
|
||||
|
||||
const val continuousVerticalTappingByPage = "continuous_vertical_tapping_by_page"
|
||||
}
|
||||
|
@ -385,4 +385,6 @@ class PreferencesHelper(val context: Context) {
|
||||
fun startReadingButton() = flowPrefs.getBoolean(Keys.startReadingButton, true)
|
||||
|
||||
fun groupLibraryBy() = flowPrefs.getInt(Keys.groupLibraryBy, 0)
|
||||
|
||||
fun continuousVerticalTappingByPage() = flowPrefs.getBoolean(Keys.continuousVerticalTappingByPage, false)
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerViewer
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
||||
import eu.kanade.tachiyomi.util.system.GLUtil
|
||||
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
||||
@ -640,7 +639,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
RIGHT_TO_LEFT -> R2LPagerViewer(this)
|
||||
VERTICAL -> VerticalPagerViewer(this)
|
||||
WEBTOON -> WebtoonViewer(this)
|
||||
VERTICAL_PLUS -> WebtoonViewer(this, isContinuous = false)
|
||||
VERTICAL_PLUS -> WebtoonViewer(this, isContinuous = false /* SY --> */, tapByPage = preferences.continuousVerticalTappingByPage().get() /* SY <-- */)
|
||||
else -> L2RPagerViewer(this)
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import kotlin.math.min
|
||||
/**
|
||||
* Implementation of a [BaseViewer] to display pages with a [RecyclerView].
|
||||
*/
|
||||
class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = true) : BaseViewer {
|
||||
class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = true, private val tapByPage: Boolean = false) : BaseViewer {
|
||||
|
||||
/**
|
||||
* Recycler view used by this viewer.
|
||||
@ -266,6 +266,27 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
||||
* Scrolls down by [scrollDistance].
|
||||
*/
|
||||
/* [EXH] private */ fun scrollDown() {
|
||||
// SY -->
|
||||
if (!isContinuous && tapByPage) {
|
||||
val currentPage = currentPage
|
||||
if (currentPage is ReaderPage) {
|
||||
val position = adapter.items.indexOf(currentPage)
|
||||
val nextItem = adapter.items.getOrNull(position + 1)
|
||||
if (nextItem is ReaderPage) {
|
||||
if (config.usePageTransitions) {
|
||||
recycler.smoothScrollToPosition(position + 1)
|
||||
} else {
|
||||
recycler.scrollToPosition(position + 1)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
scrollDownBy()
|
||||
}
|
||||
|
||||
private fun scrollDownBy() {
|
||||
// SY <--
|
||||
if (config.usePageTransitions) {
|
||||
recycler.smoothScrollBy(0, scrollDistance)
|
||||
} else {
|
||||
|
@ -301,6 +301,19 @@ class SettingsReaderController : SettingsController() {
|
||||
}
|
||||
}
|
||||
|
||||
// SY -->
|
||||
preferenceCategory {
|
||||
titleRes = R.string.vertical_plus_viewer
|
||||
|
||||
switchPreference {
|
||||
key = Keys.continuousVerticalTappingByPage
|
||||
titleRes = R.string.tap_scroll_page
|
||||
summaryRes = R.string.tap_scroll_page_summary
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_reader_navigation
|
||||
|
||||
|
@ -180,6 +180,8 @@
|
||||
<string name="enable_zoom_out">Enable zoom out</string>
|
||||
<string name="smart_based_on_page">Smart (based on page)</string>
|
||||
<string name="smart_based_on_page_and_theme">Smart (based on page and theme)</string>
|
||||
<string name="tap_scroll_page">Tap scroll by page</string>
|
||||
<string name="tap_scroll_page_summary">Tapping will scroll by page instead of screen size when this option is enabled</string>
|
||||
|
||||
<!-- Reader -->
|
||||
<!-- Reader Actions -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user