Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ All notable changes to this project will be documented in this file. Take a look
* `paragraphSpacing` - Vertical margins for paragraphs.
* `hyphens` - Enable hyphenation.
* `ligatures` - Enable ligatures in Arabic.
* Fixed scroll inertia when scrolling an EPUB.

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,

private var mScrollState = SCROLL_STATE_IDLE

internal var useLegacySettings = false

private fun initWebPager() {
setWillNotDraw(false)
descendantFocusability = ViewGroup.FOCUS_AFTER_DESCENDANTS
Expand Down Expand Up @@ -550,6 +552,10 @@ class R2WebView(context: Context, attrs: AttributeSet) : R2BasicWebView(context,
}

override fun computeScroll() {
if (!useLegacySettings && scrollMode) {
return super.computeScroll()
}

mIsScrollStarted = true
if (!mScroller!!.isFinished && mScroller!!.computeScrollOffset()) {
val oldX = scrollX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ internal class EpubNavigatorViewModel(
oldSettings.readingProgression != newSettings.readingProgression ||
oldSettings.language != newSettings.language ||
oldSettings.verticalText != newSettings.verticalText ||
oldSettings.spread != newSettings.spread
oldSettings.spread != newSettings.spread ||
// We need to invalidate the resource pager when changing from scroll mode to
// paginated, otherwise the horizontal scroll will be broken.
// See https://github.com/readium/kotlin-toolkit/pull/304
oldSettings.scroll != newSettings.scroll
)

if (needsInvalidation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class R2EpubPageFragment : Fragment() {
@Suppress("DEPRECATION")
webView.setScrollMode(preferences.getBoolean(SCROLL_REF, false))
}
webView.useLegacySettings = viewModel.useLegacySettings
webView.settings.javaScriptEnabled = true
webView.isVerticalScrollBarEnabled = false
webView.isHorizontalScrollBarEnabled = false
Expand Down