AndroidPdfViewer icon indicating copy to clipboard operation
AndroidPdfViewer copied to clipboard

Rotate screen problem

Open RoyXing opened this issue 9 years ago • 3 comments

when i rotate my phone, the screen turn white.The view is not draw again.how do i solve it??

RoyXing avatar Feb 24 '17 09:02 RoyXing

Post some code, i use the .onLoad( to resize on orientation as this event is driven on orientation change as the pdf is reloaded to display.

1stmetro avatar Feb 24 '17 21:02 1stmetro

@1stmetro

 pdfView.fromUri(Uri.fromFile(pdf))
                .defaultPage(lastPageIndex)
                .onPageChange(this)
                .enableSwipe(true)
                .swipeHorizontal(false)
                .enableAnnotationRendering(true)
                .scrollHandle(new DefaultScrollHandle(this))
                .onLoad(this)
                .load();
@Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            hideToolbar();
            if (pdfComment != null)
                pdfComment.setVisibility(View.GONE);
            this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
            showToolbar();
            if (pdfComment != null && !isLocal)
                pdfComment.setVisibility(View.VISIBLE);
            this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    }
        <activity
            android:name="com.lecai.activity.PDFViewActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:launchMode="singleTask" />

It can not reload when i rotate my phone.

RoyXing avatar Feb 27 '17 01:02 RoyXing

Any update on this how to fix roation issue

zubyf09 avatar May 18 '19 20:05 zubyf09