Skip to content

[BUG] Content is not displayed in viewpagers when swiping back to a tab containing a PdfRendererView #235

@nordfalk

Description

@nordfalk

📝 Describe the Bug

When using a viewpager content is lost when coming back to a PDF view.

Reason:
You are releasing resurces in PdfRendererView.onDetachedFromWindow() but you are not re-aquiring the resurces in the corresponding onAttachedFromWindow(), and therefore your component doesent work inside a viewpager.

Read more here:
https://stackoverflow.com/questions/42126105/android-view-onattachedtowindow-and-ondetachedfromwindow-when-are-they-calle

📖 Library Version

  • PDF Viewer Version: v2.3.7.
    The bug is not present in v2.3.6 - see v2.3.6...v2.3.7

Specifically, I think it happens because you clear the adapter here:

Image

🖼️ Screenshots/Videos

Using implementation("io.github.afreakyelf:Pdf-Viewer:2.3.7"), first display reveals the PDF

Image Image

navigating to other tab and back again the PDF content is lost:

Image Image

🖼️ Screenshots/Videos of the same code using v2.3.6

navigating to other tab and back again the PDF content is intact:

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions