AndroidPdfViewer
AndroidPdfViewer copied to clipboard
fix the bug(issue: #944) blank screen issue with viewpager2
If PDFView is used in ViewPager,it may show blank page, this issue is caused by the follow code:
@Override protected void onDetachedFromWindow() { recycle(); if (renderingHandlerThread != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { renderingHandlerThread.quitSafely(); } else { renderingHandlerThread.quit(); } renderingHandlerThread = null; } super.onDetachedFromWindow(); }
I have added an option autoReleasingWhenDetachedFromWindow that developer can make a decision whether PDFView would recycle automatically when it is detached from window.
If PDFView is used in ViewPager, we can set autoReleasingWhenDetachedFromWindow = false and call PDFView#release() when fragment or parent view is destroyed to avoid this issue.
Can this update be released? or can you provide code where to edit? i have this issue so i need to fix it on local repo.
Good Morning, i'm facing the issue here exposed: i'm using version 2.8.2 and i don't find the option autoReleasingWhenDetachedFromWindow mentioned above.
I've also tried to implement latest beta version but it seems the option is not present in this version also.
Can you please tell me if any solution has been found to this problem?
Thank you for your work
@Flaviosar78 This issue was fixed in this fork https://github.com/TalbotGooday/AndroidPdfViewer I have a fork of this fork that I publish in maven central https://github.com/muthuraj57/AndroidPdfViewer . You can use either of these, and both have fix for this issue.
Just another question: i'm
@Flaviosar78 This issue was fixed in this fork https://github.com/TalbotGooday/AndroidPdfViewer I have a fork of this fork that I publish in maven central https://github.com/muthuraj57/AndroidPdfViewer . You can use either of these, and both have fix for this issue.
Thank you sir, I've implemented your fork and i'm having same behaviour: There is any option to set to avoid blank screen?
@Flaviosar78 sorry, I fixed this particular issue on the app side instead of inside the library. I wrapped the PDFView inside my own custom view , and in onAttachedToWindow callback, I just loaded the pdf file again. This fixed the issue for me.