-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Single page scrolling #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added few notes to adjust your code with coding style used in this project
| @@ -1,3 +1,4 @@ | |||
| //apply plugin: 'java' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
| android { | ||
| compileSdkVersion 25 | ||
| buildToolsVersion '25.0.3' | ||
| //buildToolsVersion '25.0.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
| @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add braces to if block
|
|
||
| apply plugin: 'com.android.application' | ||
| apply plugin: 'android-apt' | ||
| //apply plugin: 'android-apt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
| android { | ||
| compileSdkVersion 25 | ||
| buildToolsVersion "25.0.3" | ||
| //buildToolsVersion "25.0.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
| @AfterViews | ||
| void afterViews() { | ||
| pdfView.setBackgroundColor(Color.LTGRAY); | ||
| pdfView.setBackgroundColor(Color.BLACK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert it to chained style
| pdfFileName = assetFileName; | ||
|
|
||
| pdfView.fromAsset(SAMPLE_FILE) | ||
| /*pdfView.fromAsset(SAMPLE_FILE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
|
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.