Skip to content

Commit

Permalink
update jumpto center
Browse files Browse the repository at this point in the history
  • Loading branch information
nhuttm committed Jul 15, 2020
1 parent d243b39 commit b8eab86
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions android-pdf-viewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ext {

libraryDescription = 'Android view for displaying PDFs rendered with PdfiumAndroid'

siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'
siteUrl = 'https://github.com/FIT-16CLC-InteractionBook/AndroidPdfViewer'
gitUrl = 'https://github.com/FIT-16CLC-InteractionBook/AndroidPdfViewer.git'

libraryVersion = '3.2.0-beta.1'
libraryVersion = '3.3.0-beta.1'

developerId = 'barteksc'
developerName = 'Bartosz Schiller'
Expand All @@ -31,7 +31,7 @@ android {
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "3.2.0-beta.1"
versionName "3.3.0-beta.1"
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,21 +290,18 @@ public void jumpTo(int page, boolean withAnimation) {
return;
}

// assumes swiping horizontal and snapping centre

page = pdfFile.determineValidPageNumberFrom(page);
float offset = page == 0 ? 0 : -pdfFile.getPageOffset(page, zoom);
if (swipeVertical) {
if (withAnimation) {
animationManager.startYAnimation(currentYOffset, offset);
} else {
moveTo(currentXOffset, offset);
}
float offset = page == 0 ? 0 : -pdfFile.getPageOffset(page, getZoom());
offset += pdfFile.getPageSpacing(page, getZoom()) / 2f;

if (withAnimation) {
animationManager.startXAnimation(getCurrentXOffset(), offset);
} else {
if (withAnimation) {
animationManager.startXAnimation(currentXOffset, offset);
} else {
moveTo(offset, currentYOffset);
}
moveTo(offset, getCurrentYOffset());
}

showPage(page);
}

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ buildscript {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
Expand Down

0 comments on commit b8eab86

Please sign in to comment.