afreakyelf / Pdf-Viewer

A Lightweight PDF Viewer Android library which only occupies around 80kb while most of the Pdf viewer occupies up to 16MB space.
https://afreakyelf.github.io/Pdf-Viewer/
MIT License
820 stars 173 forks source link

[BUG] PinchZoomRecyclerView.canScrollVertically(1) always return false #153

Open handhand opened 2 months ago

handhand commented 2 months ago

📝 Describe the Bug

We uses pdfView.recyclerView.canScrollVertically(1) to detect whether the pdf is scrolled to the very bottom(not the last page), to ensure user has read the whole content. But since 2.1.0, PinchZoomRecyclerView.canScrollVertically(1) always return false

📖 Library Version

🚶 Steps to Reproduce

Please follow these steps to reproduce the issue:

  1. Initial Setup/Library Method Used: [e.g., initWithUrl method] In PdfViewerActivity, add the below snippet: binding.pdfView.recyclerView.addOnScrollListener(object: RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx:Int, dy:Int) { super.onScrolled(recyclerView(recyclerView, dx, dy) Log.d("pdfViewer", binding.pdfView.recyclerView.canScrollVertically(1).toString()) } } ) Run and scroll the pdf, and observe the log.

  2. Actions Taken: [e.g., Clicked on 'Load PDF']

  3. Unexpected Behavior: [e.g., PDF not loading]

  4. Relevant Code/Stack Trace: [Include code snippet or stack trace if applicable] We found that in PinchZoomRecyclerView, if scale is 1, then mPoxY is always 0, then the override computeVerticalScrollOffset() always return 0, which breaks canScrollVertically() eventually.

🤔 Expected Behavior

What did you expect to happen? canScrollVertically() returns false only when the pdf reaches the bottom

🖼️ Screenshots/Videos

If applicable, add screenshots or videos to help explain your problem.

📱 Smartphone Info:

💻 Code Snippets

Include relevant code snippets or links to code repositories.

📜 Log Output/Stack Trace

Include any error logs or stack trace for more context.

💬 Additional Context

Add any other context about the problem here. Mention if the issue is consistent, specific scenarios where the bug occurs, etc.


github-actions[bot] commented 2 months ago

Thank you for creating your first issue. We appreciate your help in making this project better. We will look into it, and get back to you soon. Need help or want to discuss this issue? Join our Discord community here to ask questions and discuss this issue live!