Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c1090c

Browse files
committed
Update PdfiumAndroid to 1.6.1
Add .spacing() method Fix drawing with .onDraw() Add .onDrawAll() method to draw on all pages Add small rendering improvements Fix rendering when duplicated pages are passed to .pages() Update build tools Update version Update README and CHANGELOG
1 parent 0c7aec5 commit 8c1090c

File tree

9 files changed

+230
-107
lines changed

9 files changed

+230
-107
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.7.0-beta (2017-06-16)
2+
* Update PdfiumAndroid to 1.6.1, which fixed font rendering (issue #253)
3+
* Add `.spacing(int)` method to add spacing (in dp) between document pages
4+
* Fix drawing with `.onDraw(onDrawListener)`
5+
* Add `.onDrawAll(onDrawListener)` method to draw on all pages
6+
* Add small rendering improvements
7+
* Fix rendering when duplicated pages are passed to `.pages(..)`
8+
19
## 2.6.1 (2017-06-08)
210
* Fix disappearing scroll handle
311

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ Library for displaying PDF documents on Android, with `animations`, `gestures`,
1010
It is based on [PdfiumAndroid](https://github.com/barteksc/PdfiumAndroid) for decoding PDF files. Works on API 11 (Android 3.0) and higher.
1111
Licensed under Apache License 2.0.
1212

13-
## What's new in 2.6.0?
14-
* Fix fling on single-page documents
15-
* Greatly improve overall fling experience
13+
## What's new in 2.7.0-beta?
14+
* Update PdfiumAndroid to 1.6.1, which fixed font rendering (issue #253)
15+
* Add `.spacing(int)` method to add spacing (in dp) between document pages
16+
* Fix drawing with `.onDraw(onDrawListener)`
17+
* Add `.onDrawAll(onDrawListener)` method to draw on all pages
18+
* Add small rendering improvements
19+
* Fix rendering when duplicated pages are passed to `.pages(..)`
1620

17-
Version 2.6.1. fixes disappearing scroll handle
21+
This is beta release because of big number of small changes and something could go wrong (but I didn't notice)
1822

1923
## Changes in 2.0 API
2024
* `Configurator#defaultPage(int)` and `PDFView#jumpTo(int)` now require page index (i.e. starting from 0)
@@ -29,7 +33,7 @@ Version 2.6.1. fixes disappearing scroll handle
2933

3034
Add to _build.gradle_:
3135

32-
`compile 'com.github.barteksc:android-pdf-viewer:2.6.1'`
36+
`compile 'com.github.barteksc:android-pdf-viewer:2.7.0-beta'` or `2.6.1` for more stable version
3337

3438
Library is available in jcenter repository, probably it'll be in Maven Central soon.
3539

@@ -62,7 +66,10 @@ pdfView.fromAsset(String)
6266
.swipeHorizontal(false)
6367
.enableDoubletap(true)
6468
.defaultPage(0)
65-
.onDraw(onDrawListener) // allows to draw something on a provided canvas, above the current page
69+
// allows to draw something on the current page, usually visible in the middle of the screen
70+
.onDraw(onDrawListener)
71+
// allows to draw something on all pages, separately for every page. Called only for visible pages
72+
.onDrawAll(onDrawListener)
6673
.onLoad(onLoadCompleteListener) // called after document is loaded and starts to be rendered
6774
.onPageChange(onPageChangeListener)
6875
.onPageScroll(onPageScrollListener)
@@ -72,6 +79,8 @@ pdfView.fromAsset(String)
7279
.password(null)
7380
.scrollHandle(null)
7481
.enableAntialiasing(true) // improve rendering a little bit on low-res screens
82+
// spacing between pages in dp. To define spacing color, set view background
83+
.spacing(0)
7584
.load();
7685
```
7786

android-pdf-viewer/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ext {
1313
siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
1414
gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'
1515

16-
libraryVersion = '2.6.1'
16+
libraryVersion = '2.7.0-beta'
1717

1818
developerId = 'barteksc'
1919
developerName = 'Bartosz Schiller'
@@ -26,19 +26,19 @@ ext {
2626

2727
android {
2828
compileSdkVersion 25
29-
buildToolsVersion '25.0.2'
29+
buildToolsVersion '25.0.3'
3030

3131
defaultConfig {
3232
minSdkVersion 11
3333
targetSdkVersion 25
3434
versionCode 1
35-
versionName "2.6.1"
35+
versionName "2.7.0-beta"
3636
}
3737

3838
}
3939

4040
dependencies {
41-
compile 'com.github.barteksc:pdfium-android:1.5.0'
41+
compile 'com.github.barteksc:pdfium-android:1.6.1'
4242
}
4343

4444
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DragPinchManager.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,13 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
153153
int xOffset = (int) pdfView.getCurrentXOffset();
154154
int yOffset = (int) pdfView.getCurrentYOffset();
155155

156-
float minX = pdfView.toCurrentScale(pdfView.getOptimalPageWidth());
157-
float minY = pdfView.toCurrentScale(pdfView.getOptimalPageHeight());
156+
float minX, minY;
158157
if (pdfView.isSwipeVertical()) {
159-
minX = -(minX - pdfView.getWidth());
160-
minY = -(minY * pdfView.getPageCount() - pdfView.getHeight());
158+
minX = -(pdfView.toCurrentScale(pdfView.getOptimalPageWidth()) - pdfView.getWidth());
159+
minY = -(pdfView.calculateDocLength() - pdfView.getHeight());
161160
} else {
162-
minX = -(minX * pdfView.getPageCount() - pdfView.getWidth());
163-
minY = -(minY - pdfView.getHeight());
161+
minX = -(pdfView.calculateDocLength() - pdfView.getWidth());
162+
minY = -(pdfView.toCurrentScale(pdfView.getOptimalPageHeight()) - pdfView.getHeight());
164163
}
165164

166165
animationManager.startFlingAnimation(xOffset, yOffset, (int) (velocityX), (int) (velocityY),

0 commit comments

Comments
 (0)