FolioReader / FolioReader-Android

A Java ePub reader and parser framework for Android.
BSD 3-Clause "New" or "Revised" License
2.24k stars 715 forks source link

After Scroll to end of a Chapter(long chapter) , Cannot Scroll to next page (first page of the new chapter) #395

Open nuwanchamara opened 4 years ago

nuwanchamara commented 4 years ago

Issue / Feature - Cannot Scroll to next pag from end of a chapter FolioReader version -
FolioReader Stock / Modified -
Android SDK - Mobile / Tablet / Emulator Info -
Crash / Error -

Steps to reproduce / Describe in detail - open an epub which has long chapters. scroll to end of a chapter. Then try to scroll to the next page. Try to scroll from the edge of the screen it works, but scroll start from the middle of the display its not working.

sereja93 commented 4 years ago

Hi friend . You solved this problem?

nuwanchamara commented 4 years ago

Hi friend . You solved this problem?

I am using a modified version of FolioReader. In WebviewPager.kt I have changed the init() method,

` private fun init() {

    uiHandler = Handler()
    gestureDetector = GestureDetectorCompat(context, GestureListener())

    addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
        override fun onPageScrolled(
            position: Int,
            positionOffset: Float,
            positionOffsetPixels: Int
        ) {

            isScrolling = true

            if (takeOverScrolling && folioWebView != null) {
                val scrollX =
                    folioWebView!!.getScrollXPixelsForPage(position) + positionOffsetPixels
                folioWebView!!.scrollTo(scrollX, 0)
            }

            if (positionOffsetPixels == 0) {
                Log.d(LOG_TAG, "-> onPageScrolled -> takeOverScrolling = false");
                takeOverScrolling = true
                isScrolling = true
            }
        }

        override fun onPageSelected(position: Int) {
            Log.v(LOG_TAG, "-> onPageSelected -> $position")
        }

        override fun onPageScrollStateChanged(state: Int) {}
    })
}

`

just chnaged

takeOverScrolling = false isScrolling = false

krish-dev commented 4 years ago

It looks like this already fixed. However, it is not available on Bintray. Please release the latest bundle

ashokkumar88 commented 4 years ago

@nuwanchamara It is working partially though. Still need to swipe two times to go to next chapter

moqianwan commented 4 years ago

@nuwanchamara

It doesn't work on my xiaomi Mix3