Conversation
…ll snap current page to center. Zoom > min will use continuous scroll until zoom returns back to min, then it will snap to current page.
barteksc
left a comment
There was a problem hiding this comment.
I have added few notes to adjust your code with coding style used in this project
| @@ -1,3 +1,4 @@ | |||
| //apply plugin: 'java' | |||
| android { | ||
| compileSdkVersion 25 | ||
| buildToolsVersion '25.0.3' | ||
| //buildToolsVersion '25.0.3' |
| @Override | ||
| public void onAnimationEnd(Animator animation) { | ||
| if (pdfView.getPageViewType() == PageViewType.SINGLE && pdfView.getZoom() == pdfView.getMinZoom()) | ||
| pdfView.jumpTo(pdfView.getCurrentPage(), true); |
There was a problem hiding this comment.
Please add braces to if block
|
|
||
| private void onScrollEnd(MotionEvent event) { | ||
| if (pdfView.getPageViewType() == PageViewType.SINGLE && !pdfView.isZooming()) | ||
| pdfView.jumpTo(pdfView.getCurrentPage(), true); |
There was a problem hiding this comment.
Please add braces to if block
| page = pdfFile.determineValidPageNumberFrom(page); | ||
| float offset = -pdfFile.getPageOffset(page, zoom); | ||
| if (getPageViewType() == PageViewType.SINGLE) | ||
| offset = page == 0 ? 0 : -pdfFile.getPageOffset(page, zoom) + spacingPx; |
There was a problem hiding this comment.
Please add braces to if block
|
|
||
| apply plugin: 'com.android.application' | ||
| apply plugin: 'android-apt' | ||
| //apply plugin: 'android-apt' |
| android { | ||
| compileSdkVersion 25 | ||
| buildToolsVersion "25.0.3" | ||
| //buildToolsVersion "25.0.3" |
| @AfterViews | ||
| void afterViews() { | ||
| pdfView.setBackgroundColor(Color.LTGRAY); | ||
| pdfView.setBackgroundColor(Color.BLACK); |
There was a problem hiding this comment.
Please do not modify sample when it isn't needed
| .load(); | ||
| .load();*/ | ||
|
|
||
| PDFView.Configurator configurator = pdfView.fromAsset(SAMPLE_FILE); |
There was a problem hiding this comment.
Please revert it to chained style
| pdfFileName = assetFileName; | ||
|
|
||
| pdfView.fromAsset(SAMPLE_FILE) | ||
| /*pdfView.fromAsset(SAMPLE_FILE) |
|
And of course thank you for contribution |
|
This doesn't work, I get blocked on the first page on portait. |
|
update for those who are struggling with a view page per page, just add to the constructor And you will get a page per page view, allowing you to swipe to the next page |
|
how can show curl or flip animation on page change or on page scroll ? |
|
how to solve this problem? please guide us with code snippet. |

Added "PageViewType" with two available values: SINGLE or CONTINUOUS. Continuous behaves as it did before. Single will swipe one page at a time, centered in the viewer. Zooming will behave like Continuous in order to view the whole page (so it won't keep snapping to leading edge of page), until zoomed to min where it will re-center.